Dalfox Server Mode Unauthenticated Arbitrary File Create/Append Vulnerability
Dalfox in REST API server mode is vulnerable to CVE-2026-45089, an unauthenticated arbitrary file create/append vulnerability, due to the `output`, `output-all`, and `debug` options being deserialized directly from the attacker's request body, allowing a network caller to create or append to any file writable by the dalfox process.
Dalfox, a cross-platform vulnerability scanner, is susceptible to an unauthenticated arbitrary file create/append vulnerability (CVE-2026-45089) when run in REST API server mode. This vulnerability stems from the insecure handling of the output, output-all, and debug fields within the model.Options struct. These fields are directly deserialized from the JSON request body of an attacker without proper sanitization, and then propagated into the scan engine’s logging path. Consequently, an attacker can create or append to any file on the host filesystem accessible to the dalfox process by sending a crafted POST request to the /scan endpoint. The default configuration lacks API key authentication, compounding the risk. This affects dalfox versions 2.12.0 and earlier.
Attack Chain
- An attacker sends a POST request to the
/scanendpoint of the dalfox REST API server. - The request body contains a JSON object with the
urlfield set to the scan target and theoptionsfield containing attacker-controlled values foroutput,output-all, anddebug. - The
postScanHandlerfunction binds the JSON request body to aReqstruct, which includes theOptionsfield of typemodel.Options. - The
ScanFromAPIfunction is called with the attacker-suppliedURLandOptionsvalues. - The
Initializefunction copies the attacker-controlledOutputFile,OutputAll, andDebugvalues from theOptionsstruct into a newnewOptionsstruct. - The
DalLogfunction is called to write log messages. Critically, the file write operation usingos.OpenFile(options.OutputFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)occurs outside theIsLibrarycheck. - The attacker-specified file path is opened in append mode, and log messages are written to it. The URL parameter is also written verbatim in the logs, allowing partial content control.
- The attacker achieves arbitrary file creation or append on the dalfox host, leading to potential system compromise.
Impact
Successful exploitation allows an attacker to create new files or append data to existing files on the dalfox host, provided the dalfox process has the necessary write permissions. This can lead to various impacts, including: arbitrary file creation (e.g., creating web shells in web-serving directories), arbitrary file append/corruption (e.g., corrupting application configuration files or cron entries), and potential remote code execution if the attacker can inject malicious content into a configuration file or script that is subsequently executed. The lack of authentication by default increases the severity, as any network-accessible dalfox instance is vulnerable.
Recommendation
- Deploy the Sigma rule
Detect Dalfox Unauthenticated File Write Attemptto identify attempts to exploit this vulnerability by monitoring for POST requests to the /scan endpoint with suspiciousoutputparameters. - Apply the recommended remediation by nullifying filesystem-dangerous fields from API-sourced requests in the
postScanHandlerfunction as outlined in the advisory. This includes settingrq.Options.OutputFile = ""before callingScanFromAPI. - As a defense-in-depth measure, guard the file write operation with
IsLibraryin theDalLogfunction, ensuring that file writes only occur in non-library (CLI) mode. - Enforce the use of the
--api-keyoption at server startup, making authentication mandatory for the REST API server. - Upgrade to a patched version of dalfox that incorporates these security fixes.
Detection coverage 2
Detect Dalfox Unauthenticated File Write Attempt
highDetects CVE-2026-45089 exploitation — POST requests to /scan with 'output' parameter indicating potential arbitrary file write.
Detect Dalfox File Write via Output Parameter
mediumDetects CVE-2026-45089 exploitation — Creates file via output parameter. The process writing is dalfox.
Detection queries are available on the platform. Get full rules →