Summary
Dokploy's registry deletion logic constructs a docker logout command using unsanitized user-controlled input, allowing shell metacharacters inside registryUrl to influence command execution.
If an attacker can register or control a registry URL value, they may inject arbitrary shell commands that execute with the Dokploy server's privileges when a registry is deleted.
Affected context
This vulnerability appears in Dokploy's backend service responsible for managing container registries, specifically in the deleteRegistry function within packages/server/src/services/registry.ts.
The issue is exposed whenever a registry record containing an attacker-controlled registryUrl value is deleted and the server issues docker logout ${response.registryUrl}.
Environments are at risk where:
- Users can create or modify registry configurations, and
- The Dokploy server has permission to run Docker CLI commands on the host without additional sandboxing.
Exploit preconditions
- Attack surface: HTTP/API interface or UI flow that creates or manages registry configurations in Dokploy.
- Required access: Ability to supply or influence the
registryUrlvalue used by the registry management subsystem (e.g., adding or editing a registry entry). - Trigger point: Invoking the registry deletion feature (directly or indirectly) so that the backend executes
docker logout ${response.registryUrl}. - Why exploitation is possible: The logout command interpolates
registryUrldirectly into a shell command without escaping, allowing shell metacharacters and command separators to be interpreted by the shell rather than treated as plain data.
Why this happens
The underlying bug is a classic OS command injection issue: user-controlled data is concatenated into a shell command string and executed without proper escaping or parameterization.
While the related docker login path uses shEscape() to safely handle the registry URL, the docker logout path omits this protection and passes the raw registryUrl to the shell.
This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, where shell metacharacters in input are not neutralized, allowing attackers to alter the commands executed by the server.
Potential impact
- Execution of arbitrary shell commands with the Dokploy server's operating system privileges.
- Unauthorized access to or modification of application and system files on the host.
- Retrieval or exfiltration of sensitive data such as environment variables, credentials, or configuration files.
- Lateral movement from the Dokploy host to other infrastructure or services reachable from that host.
- Service disruption, including stopping containers, altering deployments, or causing denial of service.
General mitigation guidance
Effective mitigation focuses on eliminating unsafe command construction patterns and minimizing the privileges of components that must issue OS commands.
Recommended defensive patterns include:
- Avoid embedding user-controlled strings directly into shell command lines; instead, use APIs or libraries that accept argument arrays without invoking a shell.
- Apply the same escaping and validation logic consistently across all command paths (e.g., ensure
docker logoutuses the sameshEscape()or equivalent mechanism asdocker login). - Validate registry URLs against a strict whitelist of acceptable formats (e.g., hostnames, optional port) before they are stored or used.
- Isolate and run the Dokploy server with the minimum OS privileges necessary, limiting its ability to impact the broader system.
- Where feasible, confine Docker and related tooling within restricted environments (containers, namespaces, or dedicated service accounts) to reduce blast radius.
How teams detect issues like this
Detection is best approached by combining code-centric and operational strategies:
- Static analysis: Configure rules or linters to flag uses of shell-executing functions (e.g.,
exec,spawnwith{ shell: true }, or similar APIs) when they incorporate variables or concatenated strings. Highlight discrepancies where some paths use escaping helpers but others do not. - Code review: During review of infrastructure-management or deployment code, look for inconsistent use of escaping helpers, direct string interpolation into commands, and any invocation of Docker or system binaries that includes user-controllable values.
- Security policies: Enforce development policies that prefer non-shell execution APIs (argument arrays) and require centralized helper functions for command construction, with automated checks in CI to prevent bypassing these helpers.
- Runtime monitoring: Monitor logs and command execution telemetry for anomalous command patterns originating from the Dokploy server, such as unexpected shell operators, redirections, or chained commands in Docker-related invocations.

