Summary
Dockge contains a path traversal vulnerability because stack names are validated when saved but not when existing stacks are read or deleted. An authenticated user may use a crafted stack reference to access Compose or environment-file contents outside the managed stacks directory, and may delete eligible directories that contain a valid Compose file.
Affected context
The issue can affect Dockge deployments where stack-related socket handlers accept user-controlled names and resolve them into filesystem paths without applying the same allow-list validation used during writes. Risk is greater when the Dockge process has broad filesystem permissions, runs with elevated privileges, or operates with authentication disabled through an administrative auto-login configuration.
Exploit preconditions
- Attack surface: Authenticated stack-management socket operations
- Required access: A logged-in Dockge account, unless authentication is disabled through a supported configuration option
- Trigger point: Stack lookup, Compose metadata retrieval, or stack deletion
- Why exploitation is possible: Read and delete paths construct filesystem locations from stack names without enforcing the write-path name restrictions
- Deletion condition: The resolved target must contain a valid Compose file for the Docker Compose shutdown operation to complete successfully
Why this happens
The vulnerability results from inconsistent input validation across object lifecycle operations. Dockge applies an allow-list to stack names during saving, but path getters and stack lookup routines use the supplied name directly when constructing filesystem paths. This permits path components to escape the intended stacks directory and maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal.
Potential impact
- Sensitive values from accessible
.envfiles or accepted Compose files could be disclosed - Unrelated application configuration and deployment secrets may be exposed
- Eligible directories could be deleted recursively
- Services associated with deleted Compose projects could be disrupted
- A privileged Dockge process could expose or remove a wider set of host files
- Access to the Docker socket could increase the consequences of host or container compromise
General mitigation guidance
Mitigation generally focuses on enforcing one canonical, trust-minimized validation policy for every stack operation.
Common defensive patterns include:
- Validate stack identifiers before every read, update, and delete operation
- Resolve candidate paths canonically and require them to remain beneath the configured stacks directory
- Prefer server-side stack identifiers or opaque references over filesystem-derived names
- Separate metadata retrieval from destructive filesystem operations
- Require explicit authorization and confirmation for deletion
- Run Dockge with least-privilege filesystem access and avoid unnecessary root permissions
- Restrict Docker socket exposure and use a narrowly privileged container or proxy where practical
- Keep authentication enabled and apply role-based authorization to stack management
How teams detect issues like this
Organizations can look for path traversal risks through:
- Static analysis rules that identify filesystem path construction from socket, HTTP, or RPC parameters
- Code review checks comparing validation coverage across create, read, update, and delete paths
- Tests using canonical-path assertions to verify that resolved locations remain within an approved directory
- Runtime monitoring for access to
.env, Compose files, or directories outside the configured stacks root - Audit rules for recursive deletion and Docker Compose operations initiated by unusual accounts
- Policy enforcement requiring authentication, least privilege, and restricted Docker socket access
Automated code review and security scanning tools may help identify inconsistent validation and unsafe path-joining patterns.

