Summary
A path traversal vulnerability in the Dagu workflow engine's Web UI API allows crafted DAG filenames in certain endpoints to escape the intended DAGs directory.
When an attacker can supply a %2F-encoded filename to GET, DELETE, RENAME, or EXECUTE DAG operations, they may access or manipulate files outside the workflow directory, potentially impacting integrity and availability of the host system.
Affected context
This issue affects Dagu deployments running the built-in Web UI where:
- DAG files are managed via HTTP API endpoints (GET, DELETE, RENAME, EXECUTE).
- The server computes file locations based directly on a
{fileName}URL path parameter. - The implementation does not validate or normalize the filename for these endpoints using the same checks applied during creation.
The risk is higher in environments where the Web UI/API is exposed beyond a tightly controlled administrative network or where the Dagu process has broad filesystem permissions.
Exploit preconditions
- Attack surface: HTTP(S) endpoints of the Dagu Web UI/API responsible for DAG operations (GET, DELETE, RENAME, EXECUTE).
- Required access: Ability to send authenticated or otherwise accepted requests to these endpoints; in many setups this may be limited to administrators, but any reachable client with such access could attempt exploitation.
- Trigger point: Supplying a
{fileName}path segment containing%2F-encoded forward slashes, causing the server-side path resolution to traverse outside the intended DAGs directory. - Why exploitation is possible: The affected endpoints call
locateDAGwith unvalidated path components and rely on filesystem operations that do not enforce confinement to a specific directory, allowing directory traversal via URL-encoded separators.
Why this happens
The root cause is incomplete input validation for file path components used in filesystem operations, aligning with CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
While the CREATE DAG path was updated to normalize and validate DAG names (e.g., using filepath.Base and a ValidateDAGName function), the other DAG-related endpoints (GET, DELETE, RENAME, EXECUTE) continued to accept {fileName} directly. These code paths passed user-controlled input to locateDAG without equivalent normalization or checks, and did not robustly enforce that the resolved path remains within the configured DAG directory. URL-encoded path separators (%2F) bypassed simple string checks, leading to traversal outside the intended directory.
Potential impact
- Read access to files outside the DAGs directory, depending on the privileges of the Dagu process.
- Deletion of arbitrary files that the Dagu service account can remove, potentially causing denial of service or data loss.
- Overwriting or renaming files in directories accessible to the Dagu process, which may enable configuration tampering or workflow manipulation.
- Indirect elevation of impact if sensitive configuration, credential, or script files are exposed or modified through traversal.
General mitigation guidance
Effective mitigation focuses on strict path validation and filesystem containment:
- Normalize and validate all user-supplied path components before use:
- Apply a centralized validation routine (e.g., a
ValidateDAGName-style function) for every DAG-related endpoint. - Use path normalization functions and reject any input that changes directory context (e.g., contains path separators or resolves outside the DAG root).
- Enforce directory confinement:
- Resolve candidate paths to an absolute path and verify they remain under the intended DAG root directory before performing any filesystem operation.
- Avoid using raw user input to build filesystem paths; use whitelisting based on a known set of DAG identifiers where possible.
- Harden deployment:
- Run the Dagu service under a dedicated, least-privileged account with minimal filesystem rights.
- Place DAGs in a directory that does not contain sensitive files and is not shared with other critical application components.
- Reduce input trust:
- Restrict access to DAG management endpoints to trusted administrators and internal networks.
- Use authentication and authorization controls that limit who can create, modify, or execute DAGs.
How teams detect issues like this
Organizations can detect and monitor for this class of vulnerability through a combination of code analysis and runtime observability:
- Static analysis and code review:
- Search for handlers that consume URL path parameters or query parameters and use them to build filesystem paths without normalization and confinement checks.
- Flag any use of user-controlled strings passed into file I/O APIs (
open,os.Remove, renames, executors) without validation routines. - Enforce review checklists that require verifying directory traversal protections for all file-based APIs.
- Automated tooling:
- Configure SAST tools to identify CWE-22 patterns, such as concatenation of request parameters with directory paths.
- Use policy-based scanning in CI to prevent introduction of new endpoints that bypass common validation helpers.
- Runtime monitoring:
- Instrument logging to record requested filenames and resolved paths for DAG operations, with alerts on suspicious patterns (e.g., encoded slashes,
../sequences, or access outside the DAG directory). - Monitor file access by the Dagu service account using host-level auditing (e.g., auditd, OS query tools) to spot unexpected directories being touched.

