Summary
Dokploy's Docker file upload feature in versions 0.29.1 and earlier fails to sanitize the destinationPath parameter before embedding it into a shell command.
An authenticated user can inject shell metacharacters into this parameter, escape the intended docker cp command, and execute arbitrary operating system commands on the Dokploy host.
Affected context
This vulnerability arises in Dokploy deployments that expose the Docker file upload functionality to authenticated users.
The application constructs a shell command (e.g., wrapping docker cp) using the user-supplied destinationPath parameter without robust validation or escaping.
Any environment where this feature is available—such as multi-tenant self-hosted PaaS setups or shared internal platforms—may be affected, particularly when users can supply arbitrary upload destinations.
Exploit preconditions
- Attack surface: HTTP(S) interface for Dokploy's file upload to containers
- Required access: Valid authenticated Dokploy account with permission to upload files to a container
- Trigger point: Submission of a crafted
destinationPathvalue containing shell metacharacters (e.g.,;,&&, or unescaped quotes) during file upload - Why exploitation is possible: The backend directly interpolates
destinationPathinto a shell command string passed to a system shell, allowing user-controlled data to break out of the intendeddocker cpcontext and execute arbitrary commands
Why this happens
The bug stems from constructing shell commands by concatenating user-controlled input without strict validation or proper escaping.
Instead of calling process execution APIs with structured argument lists, the implementation uses a shell interpreter, which treats characters like ;, &&, and quotes as control operators.
This pattern maps directly to CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection'), where an application fails to neutralize or constrain special shell syntax embedded in externally supplied data.
Potential impact
- Arbitrary command execution on the Dokploy host operating system
- Compromise of the host machine running Dokploy and its Docker daemon
- Access to or modification of other containers, images, and volumes managed by Dokploy
- Extraction of sensitive data such as environment variables, secrets, configuration files, or access tokens
- Use of the compromised host as a pivot point for lateral movement within the network
- Denial of service by stopping containers, consuming resources, or tampering with Dokploy's runtime environment
General mitigation guidance
Mitigation focuses on eliminating shell-based construction of commands and constraining user input used in process execution:
- Prefer direct invocation of Docker or OS commands using APIs or libraries that accept argument arrays, avoiding any intermediate shell.
- Enforce strict validation on
destinationPath, allowing only expected patterns (e.g., normalized paths without metacharacters, limited to specific directories or formats). - Apply robust escaping or quoting routines only as a secondary safeguard, ensuring shell special characters cannot alter command structure.
- Run Dokploy components and associated Docker operations under least-privilege accounts, limiting the blast radius of a compromise.
- Introduce strict multi-tenant isolation controls, separating workloads by project, namespace, or host where feasible.
- Implement secure defaults for file upload paths and disallow arbitrary path specification when not strictly needed.
How teams detect issues like this
Detection can combine preventative code analysis with runtime monitoring:
- Static analysis: Configure rules or linters to flag use of shell-based execution APIs (e.g.,
sh,bash,system,execwith string commands) that include interpolated user input, especially around Docker management code. - Code review: Require security-focused review for features that invoke external commands, checking for concatenated command strings, unvalidated parameters, and improper handling of paths or filenames.
- Policy enforcement: Establish internal guidelines banning shell invocation for Docker operations; enforce via pull request templates, checklists, and CI gates.
- Runtime monitoring: Use host-based intrusion detection or logging to watch for unusual shell processes spawned by Dokploy, suspicious
dockerinvocations, or unexpected commands executed under the Dokploy service account.

