Summary
A command injection vulnerability in Dokploy allows an authenticated organization member with service read permission to influence a repository path used in a shell command. Under deployments where the affected procedure is reachable and the container has elevated host integration, this may enable arbitrary command execution as root in the container and potentially compromise the Docker host.
Affected context
The vulnerability occurs in Dokploy's patch repository workflow when a user-controlled repository path is passed to a shell command without safe argument quoting. It may affect deployments where an authenticated organization member has the required service read permission and where the Dokploy container has access to the Docker socket, increasing the potential impact beyond the container itself.
Exploit preconditions
- Attack surface: The
patch.readRepoDirectoriestRPC procedure and its repository patching workflow - Required access: An authenticated organization member with
service:readpermission - Trigger point: Processing a user-controlled
repoPathvalue in a shell command - Why exploitation is possible: The path is incorporated into a command without robust argument separation or metacharacter handling
- Privilege context: The command executes as root inside the Dokploy container; Docker socket access may extend control to the host and managed applications
Why this happens
The underlying bug is an OS command injection flaw caused by combining user-controlled data with a shell command without safe argument quoting or structured process invocation. Shell metacharacters can alter command interpretation when input is treated as command text rather than as a distinct argument. This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, commonly known as OS command injection. The supplied service identifier does not sufficiently constrain the repository path or compensate for the unsafe command construction.
Potential impact
- Arbitrary commands may execute with root privileges inside the Dokploy container
- Application secrets and deployment data could be accessed or modified
- Managed applications could be disrupted, altered, or replaced
- Docker resources may be controlled when the Docker socket is mounted
- The underlying host could be compromised through privileged Docker operations
- Attackers could perform lateral movement or supply-chain sabotage
General mitigation guidance
Mitigation generally focuses on removing shell interpretation from repository operations and reducing the trust placed in request parameters.
Common defensive patterns include:
- Use structured process APIs that pass executable arguments separately instead of invoking a shell
- Validate repository paths against an allowlisted format and expected workspace boundaries
- Canonicalize paths and reject traversal, unexpected separators, and shell control characters
- Resolve repository locations from trusted server-side identifiers rather than accepting arbitrary paths
- Apply authorization checks to both the service identity and the requested repository resource
- Avoid mounting the Docker socket where it is not required; when unavoidable, minimize its exposure and permissions
- Run patching components with a non-root identity and least-privilege container capabilities
- Preserve security boundaries even when input validation is bypassed
How teams detect issues like this
Detection approaches may include:
- Static analysis rules identifying shell execution APIs receiving concatenated or interpolated request data
- Code review checks for
child_process.execor equivalent APIs used with user-controlled values - Searches for missing argument quoting, shell invocation, and path validation around repository operations
- Runtime monitoring for unexpected child processes, Docker API activity, or command execution by the Dokploy service
- Policy enforcement requiring structured process-spawning APIs and approved path-validation helpers
- Automated security review tools that flag user input flowing into command interpreters

