Summary
A critical OS command injection vulnerability in Dokploy's backup restoration workflow allows an authenticated member with backup-restore permission to influence shell commands through database and backup file fields. Under these conditions, commands may execute in the Dokploy host context, even when the referenced database container or backup file does not exist.
Affected context
The issue occurs in Dokploy deployments using the backup restoration subscription before the corrected release. User-controlled databaseName and backupFile values are incorporated into database-specific restore commands and remote or local file paths without reliably separating data from shell syntax. Exploitation depends on access to the backup-restore functionality and the permissions granted to the affected account.
Exploit preconditions
- Attack surface: The
backup.restoreBackupWithLogstRPC subscription and related restore utilities - Required access: An authenticated Dokploy member with backup-restore permission
- Trigger point: Processing a backup restoration request containing attacker-influenced database or backup file values
- Execution context: Commands may run through local or remote command execution helpers in the Dokploy host context
- Why exploitation is possible: Input values are interpolated into shell command pipelines and paths without safe argument separation or strict trust-boundary enforcement
Why this happens
The vulnerability results from constructing shell commands through string interpolation with values that originate from an authorized user request. When database names or backup paths are concatenated into command strings, shell metacharacters and control syntax may be interpreted as commands rather than treated as ordinary data.
This behavior maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, commonly known as OS command injection. The underlying insecure pattern is passing dynamically assembled command text to a shell-capable execution mechanism instead of using structured arguments and constrained, validated values.
Potential impact
- An attacker may execute arbitrary operating-system commands
- The Dokploy host or associated execution environment could be compromised
- Application data, credentials, backups, or deployment configuration may be exposed
- An attacker could modify services, containers, or stored data
- Persistence, lateral movement, or broader infrastructure disruption could occur
General mitigation guidance
Mitigation generally focuses on removing shell interpretation from restore workflows and reducing the trust placed in request-controlled values.
Common defensive patterns include:
- Use process APIs that pass executable names and arguments as separate values without invoking a shell
- Apply strict allowlists and schema validation to database identifiers, backup names, and storage paths
- Resolve permitted files and resources through controlled server-side identifiers rather than raw client-supplied paths
- Keep local and remote restore implementations consistent in their argument handling and validation
- Run restore operations with least-privilege service accounts and restricted host, filesystem, and container permissions
- Treat authorization as a boundary for access control, not as evidence that input is safe
- Avoid exposing command construction details to request handlers and centralize safe execution wrappers
How teams detect issues like this
Detection programs commonly look for:
- Static analysis findings involving string interpolation, concatenation, or templating passed to shell-capable execution functions
- Code review signals such as request fields embedded directly in command strings, paths, or remote execution expressions
- Tests that submit boundary characters and unexpected identifiers to restore workflows and verify that they remain data
- Runtime monitoring for unusual child processes, restore commands, outbound connections, or file changes initiated by the Dokploy service
- Policy enforcement requiring structured process execution, input allowlists, and security review for privileged restore operations
Automated code review and software composition analysis tools may help identify command-construction patterns, but findings should be validated against the actual execution path.

