Summary
A critical OS command injection vulnerability in Dokploy allows an authenticated member with service deployment permission and an attached SSH key to influence a deployment command through a custom Git URL. When the Git provider processes the URL, unquoted domain data is incorporated into an ssh-keyscan command, which may allow arbitrary commands to execute on the Dokploy host.
Affected context
The issue occurs in Dokploy's Git provider handling for custom SSH-based Git URLs. It becomes risky when a user can deploy a service, provide or control a custom Git URL, and has an SSH key attached to their account or deployment configuration. The vulnerable command construction is reached during deployment while the target host is added to known-hosts data.
Exploit preconditions
- Attack surface: Dokploy service deployment and custom Git provider configuration
- Required access: An authenticated member with permission to deploy services
- Additional condition: An SSH key must be attached or available for the deployment workflow
- Trigger point: Processing a custom Git URL and executing the generated
ssh-keyscancommand - Why exploitation is possible: User-controlled domain data is interpolated into a shell command without adequate shell quoting
Why this happens
The vulnerability results from constructing a shell command with attacker-influenced Git URL data and failing to quote the interpolated domain safely. Shell metacharacters or command syntax embedded in that data may be interpreted by the host shell instead of being treated as ordinary input. This behavior maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, commonly called OS command injection.
Potential impact
- An attacker may execute arbitrary commands on the Dokploy host
- The application runtime and deployment environment could be compromised
- Deployment secrets, source code, or service credentials may be exposed
- Attackers could alter deployed applications or deployment configuration
- The host could be used for lateral movement or further infrastructure compromise
General mitigation guidance
Mitigation generally focuses on removing shell interpretation from deployment workflows and reducing trust in user-controlled repository data.
Common defensive patterns include:
- Prefer direct process-execution APIs that pass arguments separately rather than invoking a shell
- Apply strict validation and allowlisting to Git URL schemes, hosts, ports, and path formats
- Use robust argument escaping when a shell invocation cannot be avoided
- Keep deployment identities and host privileges limited to the resources they require
- Isolate deployment workers from sensitive host and control-plane interfaces
- Avoid exposing private keys or broad credentials to processes that handle user-controlled repository URLs
How teams detect issues like this
Organizations can look for:
- Static analysis findings involving shell execution APIs and string interpolation
- Code review signals where URLs, hostnames, or paths are concatenated into command strings
- Deployment logs showing unexpected
ssh-keyscan, shell, or process execution failures - Policy checks that require argument-array process execution for external commands
- Runtime monitoring for unusual child processes, network connections, or file changes by Dokploy services
Automated security review tools may help identify unquoted command construction and user-controlled data flows.

