Summary
Dalfox's REST API server mode allows attacker-controlled JSON to populate shell command options (FoundAction and FoundActionShell) that are executed on the host when scan findings occur.
When the server is exposed and no API key is configured, any unauthenticated caller who can reach the port can trigger arbitrary command execution under the Dalfox process account.
Affected context
This vulnerability manifests when Dalfox is run in REST API server mode (dalfox server) and left listening on its default interface and port (0.0.0.0:6664) without requiring an API key.
In this configuration, the /scan endpoint accepts JSON bodies that are mapped directly into internal scan options, including callback-style actions that execute shell commands on the host.
Environments where the Dalfox server is reachable from untrusted networks or shared internal segments are particularly exposed, as untrusted clients can influence post-finding actions.
Exploit preconditions
- Attack surface: HTTP REST API at
/scanon the Dalfox server port (default 6664) - Required access: Network connectivity to the Dalfox server; no authentication needed if
--api-keyis not configured - Trigger point: Submission of crafted JSON in a POST request to
/scanthat setsFoundAction/FoundActionShell - Why exploitation is possible: The server directly deserializes attacker-supplied JSON into
model.Options, anddalfox.InitializepropagatesFoundActionandFoundActionShellinto runtime scan options without sanitization or policy checks, allowing arbitrary shell commands to be executed when a scan finding occurs
Why this happens
The core issue lies in binding untrusted configuration input directly to executable behavior, a pattern that spans multiple weakness classes.
The REST API deserializes request JSON into shared configuration structures (model.Options) that are later used to define post-finding actions.
By allowing clients to specify FoundAction and FoundActionShell dynamically, the application blends configuration and control: untrusted data becomes part of a shell command executed by the Dalfox process.
This behavior aligns with:
- CWE-78 (OS Command Injection): External input is incorporated into OS-level command execution mechanisms without adequate validation or restriction.
- CWE-15 (External Control of System or Configuration Setting): Attackers can control runtime options that define how the system behaves in response to scan findings.
- CWE-306 (Missing Authentication for Critical Function): The ability to define and trigger these actions is exposed via an unauthenticated endpoint when no API key is supplied.
Potential impact
- Remote execution of arbitrary OS commands under the identity of the Dalfox process
- Complete takeover of the host running the Dalfox server, subject to process privileges
- Creation of network backdoors, pivot points, or staging environments for further attacks
- Exfiltration or destruction of local files and data accessible to the Dalfox process
- Abuse of Dalfox as an internal attack tool to scan or attack other services
General mitigation guidance
Effective mitigation centers on separating untrusted input from executable actions and reducing exposure of control surfaces:
- Treat post-finding actions as server-side configuration only, not client-supplied options; reject or ignore these fields for API clients.
- Constrain any shell execution paths with strict allowlists of commands or eliminate shell invocation in favor of safer, parameterized APIs.
- Require strong authentication for any endpoint that influences runtime behavior, and default to secure configurations (e.g., binding only to localhost, requiring an API key).
- Apply least-privilege principles to the Dalfox process, reducing the blast radius if command execution occurs (limited filesystem and network access).
- Introduce validation and policy enforcement layers that explicitly forbid or strip dangerous options from incoming requests.
How teams detect issues like this
Detection can focus on both code-level patterns and runtime behavior:
- Static analysis and code review:
- Flag deserialization of request bodies directly into option/config objects that feed into command execution or callbacks.
- Look for usages of
FoundAction,FoundActionShell, or similar fields where values can originate from HTTP requests. - Identify any shell execution functions (e.g.,
exec,os/exec, or equivalent) that accept parameters not clearly constrained by server-side configuration. - Runtime and operational monitoring:
- Monitor Dalfox server logs and HTTP access logs for unusual or repeated POST requests to
/scanfrom unrecognized sources. - Instrument process-level monitoring to detect unexpected child processes or commands spawned by the Dalfox process.
- Implement WAF or API gateway rules to restrict access and inspect suspicious payloads targeting control-related fields.
- Policy and tooling:
- Use automated security scanning tools or linters that highlight unvalidated command execution paths and missing authentication on critical endpoints.
- Enforce configuration baselines (e.g., local binding, mandatory API key) through infrastructure-as-code and deployment policies.

