Summary
Coolify contains a command injection vulnerability where the LocalPersistentVolume.name field is interpolated directly into docker volume shell commands without proper escaping.
An authenticated user who can define or modify storage names may inject shell metacharacters, leading to arbitrary command execution on managed servers when the associated resource is deleted.
Affected context
This vulnerability occurs in Coolify deployments where:
- Users can create or manage LocalPersistentVolume resources
- Docker volume operations are executed via shell commands on managed servers
- The volume name is passed directly into shell command strings without argument escaping
It most directly affects environments where multiple users share the same Coolify instance and have access to define or modify storage-related configurations.
Exploit preconditions
- Attack surface: Coolify web interface or API endpoints that allow creating or updating LocalPersistentVolume entries
- Required access: Authenticated access with permissions to define storage names or manage volumes
- Trigger point: Execution of docker volume shell commands during lifecycle events, particularly when a resource (and its associated volume) is deleted
- Why exploitation is possible: The LocalPersistentVolume.name field is concatenated into a shell command without quoting or escaping, allowing shell metacharacters and additional commands to be interpreted by the shell
Why this happens
The root cause is direct interpolation of user-controlled data into shell command strings without appropriate escaping or use of safer invocation mechanisms.
This aligns with CWE-78: OS Command Injection, where untrusted input is used to construct operating system commands that are then executed by a shell.
Instead of treating the volume name as a single opaque argument, the code allows it to influence the structure of the command line, enabling attackers to inject additional shell syntax and execute arbitrary commands.
Potential impact
- Authenticated users could execute arbitrary commands on managed servers
- Compromise of the Coolify-managed host environment, including potential full system takeover
- Unauthorized access to application data, databases, and secrets stored on the affected servers
- Lateral movement to other services or infrastructure reachable from the compromised host
- Disruption of hosted applications through data deletion, modification, or service interruption
General mitigation guidance
Effective mitigation focuses on isolating user input from shell interpretation and reducing trust in configuration fields:
- Use safe process invocation APIs that pass arguments as arrays and avoid invoking a shell
- Apply strict validation on storage names, limiting them to a predictable character set and length
- Introduce centralized helpers for executing system commands that always handle quoting and escaping
- Run management processes with least-privilege accounts and constrained permissions on the host
- Consider separating control-plane services from data-plane hosts to limit blast radius if command execution occurs
How teams detect issues like this
Detection can leverage both code-centric and operational approaches:
- Static analysis rules that flag direct string concatenation of user-controlled fields into shell commands
- Code review guidelines that require use of parameterized command execution utilities rather than ad-hoc shell strings
- Logging and monitoring of administrative actions, especially volume creation and deletion events, for anomalous volume names
- Host-level monitoring for unusual shell invocations originating from the Coolify process, including commands with unexpected arguments or metacharacters
Automated security scanning tools and CI checks can help identify similar patterns of unescaped shell command construction across the codebase.

