Summary
Dokploy contains an operating system command injection vulnerability in its backup restoration workflow, where a user-controlled database name is embedded in shell commands. An authenticated user with backup restore permission may trigger arbitrary command execution in the Docker-privileged host context when a crafted value is processed.
Affected context
The vulnerability occurs in Dokploy deployments using the backup restoration feature before version 0.29.13. The affected workflow passes the databaseName parameter through restore builders for PostgreSQL, MariaDB, MySQL, and MongoDB, where nested shell commands are executed through Node.js. Risk depends on an authenticated account having permission to restore backups and on the restoration process running with access to a Docker-privileged context.
Exploit preconditions
- Attack surface: Authenticated backup restoration functionality exposed through the tRPC subscription
- Required access: An account with the
backup:restorepermission - Trigger point: Processing a supplied
databaseNameduring backup restoration - Execution context: Node.js invokes shell text that is subsequently used with
docker exec - Why exploitation is possible: The database name is incorporated into nested shell commands without sufficiently separating data from executable shell syntax
Why this happens
The underlying flaw is command construction from untrusted input. The databaseName value is passed into restore commands for multiple database engines and becomes part of shell text executed by Node.js. Shell metacharacters or substitutions in that value can be interpreted by /bin/sh before the intended database operation runs. This maps primarily to CWE-78: Improper Neutralization of Special Elements used in an OS Command, with CWE-77: Improper Neutralization of Special Elements in Command describing the broader command-injection class.
Potential impact
- An attacker may execute arbitrary commands on the host
- The attacker could access or alter application and backup data
- Docker control may enable container manipulation or lateral movement
- Host credentials, secrets, or mounted resources could be exposed
- Persistent compromise or service disruption may result
General mitigation guidance
Mitigation generally focuses on preventing user-controlled values from becoming shell syntax and reducing the privileges available to restoration workers.
Common defensive patterns include:
- Avoiding shell interpretation for database and container operations
- Using structured process-spawn APIs with argument arrays instead of shell command strings
- Applying strict allowlists for database names and other identifiers
- Treating authentication and authorization as separate from input validation
- Removing unnecessary Docker socket, host filesystem, and elevated runtime access
- Running restore jobs with least-privilege identities and isolated service accounts
- Separating backup metadata from executable command construction
How teams detect issues like this
Organizations can look for:
- Static analysis findings involving shell execution APIs, command concatenation, template interpolation, or shell-enabled process creation
- Code review signals where request parameters or database identifiers flow into
exec,sh -c, container commands, or restoration utilities - Policy checks that prohibit dynamic shell strings when structured argument APIs are available
- Runtime monitoring for unexpected child processes, shell launches, Docker control operations, or commands originating from restore workers
- Authorization and audit logs showing unusual backup restoration activity or repeated malformed database identifiers
Automated code review and software composition tools may help identify command-construction patterns, but runtime controls remain important for privileged deployment components.

