Summary
Coolify versions prior to 4.0.0-beta.469 contain an OS command injection flaw in the application deployment health check logic.
Authenticated users who can configure health check parameters may inject shell metacharacters into deployment commands, leading to arbitrary command execution inside deployment containers.
Affected context
This vulnerability affects Coolify deployments where users are allowed to configure application health checks for deployments.
The issue occurs in the generate_healthcheck_commands() function, which builds shell commands using the health_check_host, health_check_method, and health_check_path parameters.
When these values come from user-controlled configuration and are executed as shell commands inside deployment containers without strict sanitization or escaping, they may enable command injection.
Exploit preconditions
- Attack surface: Application deployment and health check configuration in the Coolify UI or API
- Required access: Authenticated access with permissions to create or modify application health check settings
- Trigger point: Execution of the generated health check commands during or after application deployment
- Why exploitation is possible: User-supplied values are directly interpolated into shell commands without proper escaping or argument separation, allowing shell metacharacters to alter command structure
Why this happens
The underlying bug class is OS command injection, mapped to CWE-78: Improper Neutralization of Special Elements used in an OS Command.
In ApplicationDeploymentJob::generate_healthcheck_commands(), user-configurable fields such as health_check_host, health_check_method, and health_check_path are concatenated into shell command strings.
Because these values are not safely escaped, validated, or passed as discrete arguments to an execution API that avoids shell interpretation, the shell treats embedded special characters as control operators.
This design implicitly trusts configuration input and conflates data with command syntax, enabling attackers to inject additional commands or modify the command's behavior.
Potential impact
- Execution of arbitrary commands inside deployment containers
- Unauthorized access to application data or environment variables within the container
- Lateral movement to other services reachable from the compromised container
- Tampering with deployed applications, including configuration or filesystem modifications
- Use of compromised containers as a pivot point for further attacks in the infrastructure
General mitigation guidance
Effective mitigation focuses on separating untrusted data from command logic and minimizing shell usage.
Common defensive patterns include:
- Avoiding direct shell invocation where possible and using high-level libraries or APIs to perform health checks (e.g., HTTP clients) instead of shelling out
- When commands are unavoidable, using process execution APIs that pass arguments as arrays instead of a single shell-parsed string
- Strictly validating and constraining health check parameters to expected formats (e.g., whitelisting HTTP methods and validating host/path patterns)
- Applying proper escaping and neutralization of shell metacharacters on any user-supplied input that might influence commands
- Running deployment and health check processes with the least privileges necessary and isolating containers to limit blast radius
How teams detect issues like this
Detection typically combines code-level analysis with configuration review:
- Static analysis rules that flag string concatenation or interpolation into shell execution functions within deployment or health check code paths
- Code review checklists that highlight any use of shell commands built from request parameters or configuration fields
- Runtime monitoring for anomalous command executions from deployment containers, such as unexpected utilities or outbound connections
- Configuration audits to identify health check definitions containing suspicious shell metacharacters or patterns unlikely in normal URLs or hosts
Automated SAST or CI-integrated security scanners can help identify command construction patterns that mix untrusted input with shell syntax.

