Summary
Dokploy passes user-controlled values into shell commands without adequate quoting in registry credential testing and Docker Swarm cluster management endpoints. When the vulnerable remote execution path is used, an attacker may execute arbitrary commands on the remote host, potentially resulting in full service or infrastructure compromise.
Affected context
The vulnerability occurs in Dokploy deployments where registry credential testing or Docker Swarm cluster management requests reach the remote execution path. Risk is present when attacker-controlled values are interpolated into shell command strings that are executed through SSH, rather than being passed as safely separated arguments or handled through a structured API.
Exploit preconditions
- Attack surface: Registry credential testing and Docker Swarm cluster management endpoints
- Required access: Access sufficient to submit or influence values processed by one of the affected endpoints
- Trigger point: Construction and remote execution of a shell command through the SSH-backed execution path
- Why exploitation is possible: User-controlled values are inserted into shell command strings without reliable quoting or argument isolation
Why this happens
The underlying bug is command construction through unquoted template-literal interpolation. Data supplied by a user is treated as part of a shell program instead of as a data argument, allowing shell metacharacters or command separators to alter the intended command.
This behavior maps to CWE-77: Improper Neutralization of Special Elements used in a Command, commonly called OS command injection. Although safer local code paths exist, the remote path invokes a shell through SSH, preserving the injection risk when untrusted values reach that path.
Potential impact
- An attacker may execute arbitrary operating-system commands on the remote host.
- The attacker could access application secrets, registry credentials, or deployment data.
- A compromised host may be used for lateral movement within the infrastructure.
- Service availability, deployed workloads, or Docker Swarm configuration could be disrupted.
- The vulnerability can lead to broader platform or supply-chain compromise depending on execution privileges.
General mitigation guidance
Mitigation generally focuses on removing shell interpretation from application-controlled operations and reducing the trust placed in endpoint input.
Common defensive patterns include:
- Prefer structured APIs, such as the Docker API, over shell commands for container and cluster management.
- Use process execution interfaces that pass executable names and arguments separately, without invoking a shell.
- Apply strict allowlists and type-aware validation to registry, host, credential, and cluster parameters.
- Avoid interpolating user-controlled values into command strings; use safe argument escaping only where a shell is unavoidable.
- Run remote management operations with dedicated low-privilege identities and narrowly scoped permissions.
- Restrict SSH access, isolate management hosts, and avoid exposing administrative endpoints unnecessarily.
- Keep secrets out of command arguments and process listings, using protected secret-management mechanisms instead.
How teams detect issues like this
High-level detection can include:
- Static analysis rules identifying template interpolation, string concatenation, or formatting used to build shell commands.
- Code review checks for shell-backed execution helpers, SSH command construction, and missing argument boundaries.
- Tests that submit shell metacharacters as inert validation values and verify that no additional command is executed.
- Runtime monitoring for unexpected child processes, unusual SSH commands, and administrative actions originating from Dokploy services.
- Policy enforcement that restricts use of shell execution APIs and requires approved structured management interfaces.
- Automated security review tools may help identify command construction paths, but findings should be validated against actual execution behavior.

