/

CVE-2026-45089

Severity:

HIGH RISK

(8.2)

Improper File System Access Control in Dalfox REST API

CVE-2026-45089

Deferred

Vulnerability type

Category:

Improper File System Access Control

CWE:

CWE-73, CWE-306, CWE-434

Impact:

Arbitrary File Write on Host Filesystem

Severity:

HIGH RISK

(8.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Dalfox's REST API server mode prior to 2.13.0 allows attackers to control log file paths via JSON options fields that are deserialized directly from client requests and passed into the logging subsystem.

Because these paths are opened for append/create without restriction and no API key is required by default, an unauthenticated remote attacker can create or append to any file writable by the dalfox process on the host filesystem.

Affected context

This vulnerability appears when Dalfox is deployed in REST API server mode and accepts JSON requests that populate model.Options, including output, output-all, and debug fields.

The issue is most relevant when the Dalfox server runs on hosts where its process user has write permissions to sensitive directories (for example, application configuration paths, log directories, or shared volumes).

It is exacerbated in environments where the REST API is reachable over a network (including internal networks) and is operated with the default configuration that lacks authentication or an API key requirement.

Exploit preconditions

  • Attack surface: Dalfox REST API HTTP endpoint exposed over a network.
  • Required access: No authentication in the default configuration; any network client that can reach the REST API can send crafted JSON.
  • Trigger point: A scan request whose JSON body sets output, output-all, or debug to attacker-chosen file paths.
  • Why exploitation is possible: User-controlled file path fields are deserialized directly into options and propagated unchanged into the logging path. The logger opens these paths with os.O_APPEND|os.O_CREATE|os.O_WRONLY outside the IsLibrary guard, so file creation/appending occurs even in modes where file output was not intended, and no validation, sanitization, or access control is applied to the supplied paths.

Why this happens

The core issue is the direct use of client-supplied file path values in filesystem operations without validation or restriction, mapping to CWE-73: External Control of File Name or Path.

Dalfox's REST API server deserializes JSON request bodies into model.Options, including logging-related fields, and then passes them through dalfox.Initialize into the logging subsystem. The logger trusts these values and calls filesystem APIs with flags that create or append files.

This design mixes remotely supplied configuration with internal host-level file operations, and the safeguard (IsLibrary guard) that should prevent file I/O in certain modes does not enclose the vulnerable log-writing block.

Additionally, the absence of default authentication or API key enforcement (related to CWE-306: Missing Authentication for Critical Function) means attackers can invoke this behavior without prior access, and the ability to influence files that may later be executed or consumed by other components can resemble aspects of CWE-434: Unrestricted Upload of File with Dangerous Type at the pattern level.

Potential impact

  • Remote creation of new files in directories writable by the Dalfox process.
  • Remote appending to existing application or system log files, which could:
  • Pollute logs with misleading entries.
  • Interfere with monitoring or incident response.
  • Overwriting or corrupting configuration files that rely on append semantics, potentially influencing behavior of Dalfox or other applications.
  • Indirect code or command execution in scenarios where appended content is later interpreted by other services (for example, if logs are ingested into pipelines that execute commands based on log data).
  • Lateral impact on multi-tenant or shared environments where Dalfox has access to common volumes.

General mitigation guidance

Effective mitigation centers on decoupling untrusted input from filesystem operations and narrowing the trust boundary around logging configuration.

Defensible patterns include:

  • Treating all file paths derived from external clients as untrusted and disallowing them as direct inputs to file open calls.
  • Restricting logging destinations to a predefined, server-side controlled set of paths or rotating strategies, rather than user-configurable paths in server mode.
  • Introducing a strict separation between library/server modes and CLI behavior so that features intended for local CLI usage (like arbitrary output file paths) are disabled or heavily constrained when servicing remote requests.
  • Enforcing robust authentication and authorization around any endpoint that can influence logging, configuration, or filesystem interaction, including API keys or tokens as a baseline.
  • Running Dalfox under a dedicated, least-privileged system account whose writable directories are tightly scoped to non-sensitive locations, and using sandboxing or containerization to limit exposure of the host filesystem.

How teams detect issues like this

High-level detection practices for this type of vulnerability include:

  • Static analysis: Configure rules to identify code paths where user-controlled fields are deserialized and used as arguments to filesystem APIs (e.g., os.OpenFile, os.Create), particularly when they bypass validation or normalization. Look for logging or configuration structs that accept arbitrary paths from external sources.
  • Code review signals: Flag patterns where REST API handlers map JSON or other request fields directly into logger or output configuration. Pay attention to mismatches between documented modes (e.g., library/server vs CLI) and actual guards enforcing behavior.
  • Runtime monitoring: Enable application-layer logging to record when unexpected or non-standard log destinations are configured, and monitor filesystem activity to detect unusual file creation or modification originating from the Dalfox process.
  • Policy enforcement: Apply organizational policies or CI checks that prohibit externally supplied file paths in server modes, and ensure that authentication requirements are enforced before endpoints that can affect logging or configuration are exposed.

Sources

SourceLink
github.comgithub.com/hahwul/dalfox/releases/tag/v2.13.0
github.comgithub.com/hahwul/dalfox/security/advisories/GHSA-8hf9-3q64-q2qf

Frequently asked

questions

It is broadly exploitable in environments where Dalfox's REST API server mode is reachable over the network and left in its default configuration without API key protection. In such cases, any network client that can connect to the service can attempt to create or append files on the host filesystem within the permissions of the Dalfox process.

By default, no authentication is required: the REST API accepts requests without an API key, so network reachability alone can suffice. The main constraint is the filesystem permissions of the Dalfox process user—only paths writable by that user can be modified.

A robust fix pattern is to prevent untrusted input from influencing filesystem paths in server mode. This typically means hard-coding or centrally configuring logging destinations, enforcing mode-specific guards that disable arbitrary output paths for library/server usage, and requiring authentication before any operation that could affect logging or filesystem state.

To avoid repeating this class of issue, design APIs so that externally exposed endpoints cannot change logging or filesystem behavior beyond tightly controlled parameters. Enforce a clear separation between local CLI features and remote service capabilities, apply strict validation and whitelisting for file operations, require authentication for sensitive functions, and integrate security-focused code review and static analysis rules that flag user-controlled file path usage.

Find out what's already
exploitable in your codebase.