CVE-2026-27598 Overview
CVE-2026-27598 is a path traversal vulnerability affecting Dagu, an open-source workflow engine with a built-in web user interface. The vulnerability exists in the CreateNewDAG API endpoint (POST /api/v1/dags), which fails to properly validate DAG names before passing them to the file store. This allows authenticated users with DAG write permissions to write arbitrary YAML files to any location on the filesystem, constrained only by the process permissions.
Since Dagu executes DAG files as shell commands, this vulnerability can be escalated to remote code execution by writing malicious DAG files to the DAGs directory of another instance or by overwriting critical configuration files.
Critical Impact
Authenticated attackers can achieve remote code execution by exploiting improper input validation in the DAG creation API, enabling arbitrary file writes that can be leveraged to execute malicious shell commands.
Affected Products
- Dagu versions up to and including 1.16.7
- Dagu workflow engine installations with web UI enabled
- Multi-tenant Dagu deployments with shared filesystem access
Discovery Timeline
- 2026-02-25 - CVE-2026-27598 published to NVD
- 2026-02-25 - Last updated in NVD database
Technical Details for CVE-2026-27598
Vulnerability Analysis
The vulnerability stems from a path traversal flaw (CWE-22) in Dagu's DAG creation functionality. When a user creates a new DAG via the web API, the application accepts a DAG name parameter that is directly used to construct the file path where the YAML configuration will be stored. The lack of proper input validation allows directory traversal sequences (such as ../ or absolute paths) to escape the intended DAGs directory.
Because Dagu interprets DAG YAML files as workflow definitions that include shell command execution, an attacker who can write files to arbitrary locations can craft a malicious DAG that executes arbitrary commands when processed by the Dagu scheduler or when another user triggers the workflow.
Root Cause
The root cause lies in the generateFilePath function within internal/persis/filedag/store.go. The original implementation attempted to handle paths containing directory separators by resolving them to absolute paths, but this logic actually facilitated path traversal attacks rather than preventing them. The function failed to ensure that the resulting file path remained within the designated base directory.
Additionally, the validator in internal/core/validator.go did not properly reject special directory references like . and .., allowing these to be used as part of traversal attacks.
Attack Vector
The attack requires network access and authentication with DAG write permissions. An attacker exploits the vulnerability through the following sequence:
- Authenticate to the Dagu web interface with valid credentials
- Send a crafted POST request to /api/v1/dags with a malicious DAG name containing path traversal sequences
- The malicious YAML file is written to an attacker-controlled location
- If written to a DAGs directory, the malicious workflow executes shell commands when triggered
The security patch addresses this vulnerability by implementing proper path sanitization:
// Security patch in internal/core/validator.go
if name == "" {
return nil
}
+ if name == "." || name == ".." {
+ return ErrNameInvalidChars
+ }
if len(name) > DAGNameMaxLen {
return ErrNameTooLong
}
Source: GitHub Commit e2ed589
The file storage logic was also hardened to strip directory components and verify path containment:
// Security patch in internal/persis/filedag/store.go
// generateFilePath generates the file path for a DAG by its name.
+// It uses filepath.Base to strip directory components and verifies
+// the result stays inside baseDir to prevent path traversal.
func (store *Storage) generateFilePath(name string) string {
- if strings.Contains(name, string(filepath.Separator)) {
- filePath, err := filepath.Abs(name)
- if err == nil {
- return filePath
- }
- }
- filePath := fileutil.EnsureYAMLExtension(path.Join(store.baseDir, name))
- return filepath.Clean(filePath)
+ safeName := filepath.Base(name)
+ filePath := fileutil.EnsureYAMLExtension(path.Join(store.baseDir, safeName))
+ filePath = filepath.Clean(filePath)
+ // Verify the resolved path is inside baseDir.
+ basePrefix := filepath.Clean(store.baseDir) + string(filepath.Separator)
+ if !strings.HasPrefix(filePath, basePrefix) {
+ return filepath.Join(store.baseDir, "_invalid.yaml")
+ }
+ return filePath
}
Source: GitHub Commit e2ed589
Detection Methods for CVE-2026-27598
Indicators of Compromise
- Unexpected YAML files appearing outside the designated DAGs directory
- DAG creation requests containing path traversal sequences (../, ..\\, or absolute paths) in API logs
- Unusual shell command execution originating from Dagu worker processes
- New or modified YAML files in system configuration directories
Detection Strategies
- Monitor HTTP request logs for POST /api/v1/dags requests containing suspicious characters like .., /, or \ in the DAG name parameter
- Implement file integrity monitoring on Dagu configuration and DAGs directories to detect unauthorized file creation
- Review application logs for DAG creation events with names containing path separators or special directory references
- Deploy web application firewall rules to block requests with path traversal patterns in JSON payloads
Monitoring Recommendations
- Enable verbose logging on the Dagu API server to capture full request details for forensic analysis
- Set up alerts for file writes outside the expected DAGs directory by the Dagu process
- Monitor for unexpected workflow executions, especially those containing suspicious shell commands
- Implement user activity auditing to track DAG creation and modification events by user account
How to Mitigate CVE-2026-27598
Immediate Actions Required
- Upgrade Dagu to a version containing commit e2ed589105d79273e4e6ac8eb31525f765bb3ce4 or later immediately
- Review existing DAG files for any unexpected or malicious content that may have been injected
- Audit user accounts with DAG write permissions and revoke unnecessary access
- Check system directories for any unauthorized YAML files that may have been written via this vulnerability
Patch Information
The vulnerability has been fixed in commit e2ed589105d79273e4e6ac8eb31525f765bb3ce4. The patch implements two key security controls:
- Input validation enhancement: The validator now explicitly rejects . and .. as DAG names
- Path containment verification: The file path generation function uses filepath.Base() to strip directory components and verifies the final path remains within the base directory
For detailed information, refer to the GitHub Security Advisory GHSA-6v48-fcq6-ff23.
Workarounds
- Restrict DAG write permissions to only essential administrative users until the patch can be applied
- Deploy a reverse proxy or WAF rule to filter requests containing path traversal patterns in the DAG name field
- Run Dagu with minimal filesystem permissions to limit the impact of arbitrary file writes
- Isolate Dagu instances in containerized environments with restricted volume mounts
# Example: Run Dagu with restricted filesystem access using Docker
docker run -d \
--name dagu \
--read-only \
--tmpfs /tmp \
-v /app/dags:/app/dags:rw \
-v /app/config:/app/config:ro \
--user 1000:1000 \
dagu:latest
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


