Summary
An authenticated command injection vulnerability in Coolify's Destination Network Management feature allows arbitrary shell commands to be executed on managed servers.
When users with destination management permissions control the network parameter, it is passed unsafely to shell commands, enabling remote code execution as root on the host.
Affected context
The vulnerability occurs in Coolify deployments where server destinations are managed via the Destination Network Management functionality.
It becomes relevant when users are granted destination management permissions and the application builds shell commands incorporating user-controlled network values without robust sanitization or parameterization.
In such contexts, the network parameter can directly influence the command line executed on managed servers, making exploitation possible when those commands run with elevated privileges.
Exploit preconditions
- Attack surface: Destination Network Management operations exposed through Coolify's authenticated interface or API.
- Required access: Valid Coolify account with destination management permissions or equivalent administrative role over managed servers.
- Trigger point: Invoking network-related management actions that construct and execute shell commands using the
networkparameter. - Why exploitation is possible: User-controlled input is concatenated into shell commands without proper escaping, validation, or the use of safe process execution APIs, allowing injection of arbitrary command fragments that the shell interprets and runs as root.
Why this happens
This issue stems from constructing shell command strings using unvalidated, user-controlled input and then executing them in a system shell context.
Concretely, the network parameter is incorporated directly into command lines, violating the principle of separating code from data and enabling the shell to parse injected metacharacters and additional commands.
This behavior maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where insufficient input neutralization or misuse of shell-based execution primitives leads to arbitrary command execution.
Potential impact
- Attackers could execute arbitrary commands as root on managed servers.
- Managed hosts may be fully compromised, including access to applications and databases deployed via Coolify.
- System-level data could be read, modified, or destroyed, including sensitive configuration files and credentials stored on the server.
- Attackers may install backdoors or malware, turning managed servers into a foothold for broader network compromise.
- Operational continuity may be disrupted through service termination, resource exhaustion, or destructive commands.
General mitigation guidance
Effective mitigation focuses on eliminating direct shell command construction from user-controlled data and tightening privilege boundaries.
Recommended defensive patterns include:
- Replacing shell-based command concatenation with safe process execution APIs that accept argument arrays and avoid invoking a shell.
- Applying strict allowlists and structural validation to all network-related parameters so that only expected formats and values are accepted.
- Centralizing command-building logic and enforcing robust input neutralization, rejecting inputs containing shell metacharacters or unexpected tokens.
- Ensuring server management tasks run with least privilege rather than always as root, minimizing impact if a flaw is present.
- Segregating administrative functions behind strong access control and auditing to reduce exposure of powerful management surfaces.
How teams detect issues like this
Detection commonly relies on identifying insecure command execution patterns and monitoring for anomalous activity on managed servers.
Potential strategies include:
- Static analysis rules that flag use of shell execution functions (e.g.,
exec,system,shell_exec, backticks) with concatenated user inputs or unsanitized parameters. - Code review checklists that require verification of input validation, argument splitting, and avoidance of shell metacharacters in management operations.
- Application-layer policies that forbid direct passing of user-controlled strings to shell commands and enforce approved wrappers for system interactions.
- Runtime monitoring on managed servers for unusual command invocations initiated from Coolify processes, such as unexpected network tools, package managers, or data exfiltration utilities.
- Integration of automated security testing tools in CI pipelines to scan for OS command injection signatures and insecure process invocation patterns.

