Summary
Dokploy contains a command injection vulnerability in the handling of user-controlled Traefik configuration. An attacker who can influence affected configuration fields may execute arbitrary operating-system commands on managed remote servers with the privileges of the configured SSH user.
Affected context
The issue occurs in Dokploy's remote Traefik configuration workflow when YAML generated from user-controlled values is embedded in a shell command and executed on a managed server. Risk is present where attackers can influence redirect rules, replacement values, authentication usernames, domain hosts, or middleware settings, and the deployment uses an SSH account with meaningful permissions.
Exploit preconditions
- Attack surface: Remote server configuration through Dokploy's Traefik management functionality
- Required access: Ability to create or modify the affected Traefik configuration values
- Trigger point: Execution of the generated remote configuration command
- Why exploitation is possible: Serialized user input is interpolated into shell command text without complete shell-safe escaping, allowing shell metacharacters and quoting boundaries to alter command interpretation
Why this happens
The vulnerability results from constructing a shell command by interpolating serialized, user-controlled YAML into an echo command executed remotely. YAML serialization does not provide shell-command escaping, so values containing shell-significant characters can escape the intended quoting context and be interpreted as additional shell syntax. This is an OS command injection weakness under CWE-77, compounded by an incomplete remediation that did not protect every user-controlled configuration field.
Potential impact
- Attackers may execute arbitrary commands on managed remote servers
- The commands could run with the privileges of the configured SSH user
- Confidential application data or deployment secrets may be exposed
- Attackers could modify services, configurations, or stored data
- Compromised hosts may be used for lateral movement or persistence
General mitigation guidance
Mitigation typically focuses on eliminating shell interpretation from remote configuration workflows and reducing trust in user-controlled values.
Common defensive patterns include:
- Use direct process execution or structured remote APIs instead of shell command construction
- Pass configuration through safely handled files, standard input, or argument arrays rather than interpolated command strings
- Apply context-appropriate shell escaping when a shell cannot be avoided
- Validate Traefik fields against strict schemas and allowlists for expected formats
- Treat serialized YAML as data, not as a security boundary for command execution
- Use dedicated, least-privileged SSH accounts with restricted filesystem and service permissions
- Limit which users or tenants can alter remote routing and middleware configuration
How teams detect issues like this
High-level detection can include:
- Static analysis rules that flag string interpolation or concatenation used to build shell commands
- Code review checks for
exec, remote command helpers, and shell invocation with serialized user input - Searches for generated command strings containing configuration variables or YAML output
- Runtime monitoring for unexpected child processes launched by deployment services
- Audit logging of remote command execution and changes to Traefik configuration
- CI policy checks requiring structured process APIs or approved escaping utilities
Automated code review and software composition tools may help identify command-construction patterns, but findings should be validated against actual trust boundaries.

