Summary
Dokploy before 0.26.5 contains a critical path traversal vulnerability that allows authenticated users to write arbitrary files on the underlying filesystem during application deployment.
When leveraged with Dokploy's remote server deployment feature, this flaw can be used to bypass container isolation, plant cron-based executables, and achieve automatic remote code execution and full server compromise without further user interaction.
Affected context
This vulnerability arises in Dokploy's deployment pipeline where user-controlled deployment data influences filesystem paths on the host or remote servers.
It is relevant when:
- Dokploy is exposed to authenticated users or tenants who can create or modify deployments
- Deployments are executed on local or remote servers, with the orchestrator having filesystem-level access
- The deployment logic resolves or constructs file paths based on user-supplied values without strict validation or confinement to a safe base directory
In such configurations, crafted path components can cause Dokploy to place files outside the intended deployment directories.
Exploit preconditions
- Attack surface: Dokploy's deployment and remote server deployment functionality.
- Required access: Authenticated access to Dokploy with permission to create or modify deployments (e.g., projects, services, or apps).
- Trigger point: Initiation of a deployment where attacker-controlled parameters influence the target path or name of generated deployment artifacts (scripts, config files, or application files).
- Why exploitation is possible: The deployment logic fails to normalize and constrain file paths to an allowed directory tree and does not consistently reject path traversal sequences (e.g.,
../) or absolute paths, allowing arbitrary locations on the host or remote server to be targeted.
Why this happens
The core issue is improper restriction of filesystem paths derived from user-controlled input, mapping to CWE-22: Improper Limitation of a Pathname to a Restricted Directory and related canonicalization errors (CWE-35).
Instead of enforcing a fixed base directory and validating that resolved paths remain within it, the deployment process trusts path fragments or filenames supplied by authenticated users.
Attackers can exploit this looseness by:
- Injecting traversal segments to escape the intended deployment directory
- Targeting sensitive locations such as system cron directories, service configuration paths, or application code directories
This insecure pattern turns a routine deployment feature into a generalized arbitrary file write mechanism capable of delivering executable content into privileged or security-sensitive locations.
Potential impact
- Arbitrary file write on local or remote servers where deployments are executed
- Automatic remote code execution via planted cron jobs or startup scripts
- Complete compromise of remote servers, including takeover of running services
- Bypass of container isolation by writing directly to host filesystem locations
- Installation of persistent backdoors or web shells
- Unauthorized modification of application configurations and service definitions
- Data exfiltration by introducing scripts that harvest and exfiltrate secrets or user data
- Lateral movement to other systems managed from the compromised host
General mitigation guidance
Effective mitigation focuses on constraining filesystem access and eliminating traversal from deployment inputs:
- Enforce strict path normalization and validation: resolve all user-influenced paths to canonical form and verify they remain within a predefined, fixed base directory.
- Use allowlists for deployment locations: expose only a set of preconfigured, non-user-controllable directories as valid deployment targets.
- Treat all user-supplied path components as untrusted: forbid absolute paths, drive specifiers, and traversal sequences (
.., URL-encoded equivalents, symbolic link tricks) in deployment-related fields. - Separate trust domains: run deployment workers under dedicated, least-privilege accounts with access only to specific directories required for deployments.
- Avoid granting deployment processes direct access to sensitive host locations such as system cron directories, service managers, or OS configuration paths.
- Employ defense-in-depth: combine filesystem permissions, chroot/jail-style confinement, or containerization for deployment workers so that even if path validation fails, impact remains limited.
How teams detect issues like this
Detection can combine code-level analysis, configuration review, and runtime monitoring:
- Static analysis: Search code for any joins or concatenations of user-controlled data with filesystem paths (e.g.,
path.join(base, user_input)), especially around deployment routines, without subsequent canonicalization and containment checks. - Code review signals: Pay particular attention to:
- Use of raw user input in paths for script generation, configuration files, or deployment artifacts
- Lack of checks ensuring resolved paths remain under a designated deployment root directory
- Handling of remote deployment logic where host paths are derived from API parameters
- Policy enforcement: Introduce coding guidelines requiring:
- Canonicalization of paths and explicit containment checks
- Prohibition of absolute paths and traversal patterns in user-visible deployment fields
- Runtime monitoring: Log and alert on unusual write patterns from deployment processes, such as:
- Writes to system-level directories (
/etc, cron directories, service managers) - Deployment-related processes modifying files outside known application directories
Automated security scanners and SAST tools can be tuned to flag path construction patterns and missing boundary checks in deployment-related modules.

