Summary
A critical OS command injection vulnerability in Dokploy allows an authenticated user with application create or update permission to influence shell commands through the dockerImage field. When a build targets the local host or a remote SSH build target, crafted input may execute arbitrary commands and expose host or project data.
Affected context
The vulnerability occurs in Dokploy Docker build workflows before version 0.29.13, where the dockerImage value is treated as an optional string and interpolated into shell commands without adequate quoting. It may affect deployments that permit authenticated users to create or update applications and that use either local builds or remote SSH build targets.
Exploit preconditions
- Attack surface: Dokploy application creation or update functionality and its Docker build process
- Required access: An authenticated account with permission to create or update applications
- Trigger point: Processing of the
dockerImagefield during a local or remote Docker build - Why exploitation is possible: User-controlled input is inserted into shell commands without robust argument separation or escaping, allowing shell interpretation on the selected build host
Why this happens
The underlying issue is command construction from untrusted application metadata. The dockerImage field is validated only as a string and is then interpolated into shell commands without quoting or safe process-argument handling. This behavior maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, because shell syntax supplied through a data field can be interpreted as executable command content.
Potential impact
- An attacker may execute arbitrary commands on a local build host
- An attacker may execute commands on a configured remote SSH build target
- Host credentials, environment secrets, or configuration data could be exposed
- Other projects, containers, or build artifacts may be accessed or modified
- Build integrity could be undermined through artifact tampering or supply-chain abuse
- The affected host could be used for lateral movement, depending on its privileges and network access
General mitigation guidance
Mitigation generally focuses on preventing user-controlled values from becoming shell syntax.
Common defensive patterns include:
- Use APIs that pass commands and arguments as structured arrays rather than constructing shell command strings
- Apply strict allowlist validation for image references, registries, names, tags, and digests
- Treat application metadata as untrusted even when submitted by authenticated users
- Avoid invoking a shell when direct process execution is sufficient
- Apply least-privilege permissions to local and remote build accounts
- Restrict build-host network access and protect environment secrets from build processes
- Isolate builds from other projects and sensitive host resources
- Enforce immutable or centrally governed build configuration where practical
How teams detect issues like this
High-level detection can include:
- Static analysis rules for string interpolation or concatenation of user-controlled values into shell commands
- Code review checks for shell execution APIs that receive assembled command strings
- Tests using metacharacter handling and argument-boundary cases without relying on production systems
- Runtime monitoring for unexpected child processes launched by build services
- Audit logging for application updates, build-target selection, and unusual build commands
- Policy enforcement requiring structured process execution and approved container image references
- Automated code review tools that flag command construction from request or application metadata

