Summary
Dokploy versions 0.26.6 and earlier contain an OS command injection vulnerability in the /docker-container-logs WebSocket endpoint, where user-supplied tail and since parameters are concatenated directly into shell commands.
An authenticated user who can access this endpoint may be able to execute arbitrary commands with root privileges on the host system where Dokploy runs.
Affected context
This vulnerability affects Dokploy deployments that expose the /docker-container-logs WebSocket API for retrieving container logs.
The risk is present when:
- The backend constructs shell commands to fetch logs (e.g., via
docker logs) and - The
tailandsinceparameters from authenticated clients are inserted into those shell commands without strict validation, escaping, or parameterization.
Any environment where Dokploy runs with elevated privileges (such as root) increases the severity of potential compromise.
Exploit preconditions
- Attack surface: Network-accessible Dokploy instance exposing the
/docker-container-logsWebSocket endpoint. - Required access: Valid authenticated user account or any credentials sufficient to invoke the logs WebSocket endpoint.
- Trigger point: Supplying crafted values in the
tailand/orsincequery or message parameters that are incorporated into a shell command. - Why exploitation is possible: The application builds shell commands by concatenating raw parameter values without validation, quoting, or use of a safer API, allowing shell metacharacters to break out of the intended command context and run arbitrary commands.
Why this happens
The core issue is reliance on string-based shell command construction using untrusted input fields (tail and since) in the /docker-container-logs WebSocket endpoint.
Instead of treating these fields as data and constraining them to numeric or well-defined formats, Dokploy directly appends them to command strings that are executed by a shell.
This pattern maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, where attackers can inject shell metacharacters or additional commands because no rigorous input validation, escaping, or parameterization is applied.
Potential impact
- Execution of arbitrary commands with root privileges on the Dokploy host.
- Complete compromise of the underlying server, including installing backdoors or modifying system configuration.
- Access to or manipulation of other containers and workloads managed by Dokploy.
- Unauthorized access to sensitive configuration secrets, environment variables, and data volumes.
- Use of the compromised server as a pivot point for lateral movement within the infrastructure.
General mitigation guidance
Mitigation generally focuses on eliminating direct shell command construction and constraining input:
- Replace shell-based invocations with library or API calls (e.g., Docker SDKs) that treat parameters as data rather than shell fragments.
- Enforce strict typing and bounds for parameters such as
tailandsince(e.g., integers or well-validated duration formats) and reject anything that does not conform. - Avoid passing user input through a shell; if process execution is necessary, use exec-style APIs with argument arrays rather than single concatenated command strings.
- Apply least-privilege principles so the Dokploy process does not run as root where possible, reducing the blast radius of any exploitation.
- Implement centralized input validation and normalization for all logging and diagnostic endpoints to avoid similar bugs in related code paths.
How teams detect issues like this
Effective detection often combines code-level and runtime perspectives:
- Static analysis: Configure rules to flag use of shell execution functions (e.g.,
exec,system,spawnwithshell: true) where untrusted input variables flow directly into the command string. - Code review: Look for log or diagnostic endpoints that construct commands from request parameters; pay attention to concatenation patterns, string interpolation, and missing validation or type checks.
- Security testing: Include web and WebSocket endpoints in dynamic application security testing, focusing on sending crafted parameter values to identify command injection behavior.
- Runtime monitoring: Monitor for unusual command executions by the Dokploy process (e.g., unexpected binaries, network tools) via host-based intrusion detection or audit logs, and alert on anomalous activity patterns.

