Summary
A command injection vulnerability in Dokploy allows shell commands to be executed on a managed server when a user with permission to read Traefik files supplies a crafted configuration path.
The issue becomes risky when user-controlled path data reaches a shell command without strict validation or safe argument handling.
Affected context
The vulnerability occurs in Dokploy's Traefik configuration-reading workflow when the path accepted by the settings API is passed to a remote shell command. Deployments are exposed when an authenticated user has the traefikFiles.read permission and the application does not constrain the path to approved files or avoid shell interpretation.
Exploit preconditions
- Attack surface: Dokploy settings API and managed-server Traefik configuration access
- Required access: An authenticated user with
traefikFiles.readpermission - Trigger point: Processing a user-influenced configuration path through the Traefik file-reading operation
- Why exploitation is possible: The path is interpolated into a shell command, allowing shell metacharacters to alter command interpretation
Why this happens
The underlying flaw is an OS command injection caused by incorporating externally influenced path data into a shell command without using safe argument boundaries or sufficiently strict validation.
This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, because input that should represent a file path can instead influence shell parsing and command execution.
Potential impact
- An attacker may execute arbitrary commands on a managed server
- Server credentials, application data, or deployment secrets could be exposed
- The affected host could be modified, disrupted, or used for lateral movement
- Running services and deployed workloads could be tampered with
General mitigation guidance
Mitigation generally focuses on removing shell interpretation from file access operations and reducing trust in request-controlled paths.
Common defensive patterns include:
- Use direct file APIs or process-spawn interfaces with argument arrays instead of shell-interpolated commands
- Restrict paths to an allowlisted directory and approved filenames
- Canonicalize and validate paths before access, while preventing traversal outside intended locations
- Treat permission checks as necessary but insufficient input protection
- Run managed-server agents and related services with least privilege
- Limit accessible secrets, filesystem locations, and administrative capabilities
- Apply secure-by-default input validation and centralized command-execution policies
How teams detect issues like this
Detection can include:
- Static analysis for shell execution APIs receiving concatenated or interpolated request data
- Code review checks for command strings constructed with paths, filenames, or query parameters
- Taint analysis tracing API input into remote execution helpers
- Runtime logging of command-execution requests, rejected paths, and unusual Traefik file access
- Policy enforcement that prohibits shell-based file reads when direct filesystem APIs are available
- Automated security review tools configured to identify CWE-78 patterns

