Summary
Dokploy has an OS command injection vulnerability in the command construction used for Compose containers. An authenticated organization member who can set a malicious serviceName through backup procedures may cause commands to run as root when a scheduled backup executes.
Affected context
The issue affects Dokploy deployments where backup creation or update procedures accept a serviceName value that is later used by getComposeContainerCommand(). Risk arises when that value reaches shell command construction without adequate handling and a scheduled backup triggers execution. The mounted Docker socket may increase the impact by enabling access to host-level Docker operations.
Exploit preconditions
- Attack surface: Dokploy backup management procedures and scheduled backup execution
- Required access: Authentication as an organization member with access to the relevant backup procedures
- Trigger point: A scheduled backup that uses a stored
serviceNamevalue - Why exploitation is possible: The value is incorporated into a shell command in a way that may allow shell metacharacters to alter command execution
Why this happens
The underlying issue is OS command injection, mapped to CWE-78: Improper Neutralization of Special Elements used in an OS Command. The application uses a service name in shell command construction without reliably separating data from command syntax. As a result, attacker-controlled input may be interpreted by the shell rather than treated only as a value.
Potential impact
- Commands may execute with root privileges in the affected environment.
- An attacker could compromise the Dokploy host, particularly where the Docker socket is mounted and accessible.
- Host or container workloads may be disrupted or modified.
- Secrets or data accessible to the affected runtime could be exposed.
General mitigation guidance
Defensive approaches generally focus on avoiding shell interpretation of untrusted values and limiting the impact of any command execution.
- Prefer APIs that pass executable arguments directly without invoking a shell.
- Treat service names and other request-derived values as untrusted; validate them against a strict, context-appropriate allowlist.
- Use secure-by-default command construction and avoid string concatenation for commands.
- Restrict which organization members can manage backups and limit the privileges of the process that runs scheduled jobs.
- Minimize Docker socket exposure and apply least-privilege controls to container and host resources.
How teams detect issues like this
- Use static analysis to identify shell invocation and command-string construction that incorporates request or database values.
- Review backup creation and update flows, including how stored service names reach scheduled job execution.
- Look for code review signals such as shell APIs, string concatenation, or insufficient validation around command arguments.
- Enforce policies that prefer non-shell process APIs and require allowlist validation for values used in operating-system operations.
- Monitor scheduled backup activity and host-level process creation for unexpected commands or Docker operations.

