Summary
Dagu can run OS commands from inline workflow specifications submitted to the /api/v2/dag-runs endpoint. When authentication is disabled—as it is by default in the affected configurations—an unauthenticated attacker who can reach the endpoint may be able to trigger remote code execution.
Affected context
The issue affects Dagu deployments in the described version range, from 1.23.0 before 2.0.0, when auth.mode is left at its default value of none. The relevant attack surface is the /api/v2/dag-runs endpoint, which accepts POST requests containing inline DAG specifications. Risk depends on whether the endpoint is reachable by untrusted parties and whether submitted steps are executed.
Exploit preconditions
- Attack surface: The Dagu
/api/v2/dag-runsAPI must be reachable by the attacker. - Required access: No credentials are required when authentication is disabled.
- Trigger point: A POST request to
/api/v2/dag-runswith an inline DAG specification. - Why exploitation is possible: The service can execute shell commands defined in submitted DAG steps without requiring authentication.
Why this happens
The underlying issue is missing authentication on an API operation that can initiate command execution. This maps to CWE-306: Missing Authentication for Critical Function: a security-sensitive function is available without first verifying the caller's identity. A default configuration that leaves authentication disabled can expose this function to unauthenticated users when the API is network-accessible.
Potential impact
- An attacker may execute arbitrary OS commands in the Dagu runtime environment.
- The application or its data could be compromised.
- A compromised runtime could be used to access other systems or resources available to its service account.
- Disruption of DAG execution or other service operations could occur.
General mitigation guidance
Defensive approaches focus on requiring identity verification before exposing functions that execute workflows.
- Configure authentication as a secure-by-default requirement for API access.
- Restrict network access to the DAG-run endpoint to trusted clients and networks.
- Treat submitted DAG specifications as untrusted; limit or disable inline specifications where they are not needed.
- Run Dagu with least-privilege OS and service-account permissions, and isolate workflow execution from sensitive resources.
- Apply authorization checks that limit which users or services can submit and run DAGs.
How teams detect issues like this
- Review configuration and deployment policies for instances where
auth.modeis unset or set tonone. - Inspect API access logs for unauthenticated POST requests to
/api/v2/dag-runs, especially requests containing inline specifications. - Use static analysis and code review to verify that authentication and authorization checks cover workflow-execution routes.
- Enforce deployment policies that require authentication and restrict network exposure for command-execution interfaces.
- Automated security reviews can help identify sensitive endpoints that lack access-control checks.

