Summary
An OS command injection vulnerability in Coolify's Nixpacks build pack allows attacker-controlled build parameters to be concatenated into shell commands executed on the deployment host.
When a malicious install_command is supplied by an authenticated user, it can escape the intended build context and run arbitrary commands with host-level privileges during the build phase.
Affected context
This vulnerability affects Coolify installations that use the Nixpacks build pack and allow users to define custom build parameters, including install_command.
It becomes relevant when application owners or tenant users can configure build commands that are later executed on a server responsible for building and deploying applications.
The risk increases in multi-tenant or shared-host environments where build operations execute with elevated or host-level privileges.
Exploit preconditions
- Attack surface: Coolify web interface or API exposed for configuring Nixpacks build settings
- Required access: Authenticated access with permission to set or modify install_command for a project or service
- Trigger point: Initiation of a deployment or build process that uses the crafted install_command
- Why exploitation is possible: User-controlled data is directly concatenated into a shell command string without proper validation, escaping, or context separation, enabling arbitrary command execution.
Why this happens
The core issue is the direct inclusion of user-supplied build parameters into shell command strings, mapping to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Instead of treating install_command as data within a constrained execution context (e.g., arguments to a fixed binary or structured configuration), the application embeds it into a shell command, allowing metacharacters, control operators, and additional commands to be interpreted by the shell.
This pattern reflects a broader bug class where untrusted input is passed to command interpreters without neutralization, escaping, or strict command templates, permitting attackers to alter the command's semantics and execute arbitrary operations.
Potential impact
- Attacker may execute arbitrary commands on the deployment host
- Host-level compromise and potential full takeover of the underlying server
- Unauthorized access to other applications, databases, or services deployed via Coolify
- Data exfiltration, modification, or destruction on the host and connected systems
- Lateral movement into adjacent infrastructure or internal networks
General mitigation guidance
Effective mitigation centers on eliminating direct command concatenation and constraining how user-supplied values interact with the operating system.
Recommended patterns include:
- Treat user-defined build parameters as data, not commands, and pass them as arguments to well-defined tooling rather than to a shell.
- Use high-level APIs or libraries that execute commands without invoking a shell, and avoid string-based command construction.
- Enforce strict validation and allowlisting of acceptable command fragments or options for build parameters.
- Run build processes with least privilege, isolating them in containers or sandboxes to reduce blast radius if misuse occurs.
- Clearly separate tenant-controlled configuration from host-level automation and avoid exposing sensitive execution paths to user input.
How teams detect issues like this
Detection typically involves a combination of code-level analysis and runtime monitoring:
- Static analysis rules that flag uses of shell execution functions (e.g., system, exec, shell wrappers) where user-controlled data is concatenated into command strings.
- Code review practices that require justification for any dynamic command construction and enforce patterns such as parameterized execution APIs.
- Configuration and policy checks to ensure build parameters are validated, constrained, and not passed directly to shell interpreters.
- Runtime logging and monitoring of build commands executed on hosts, with alerts for unexpected command patterns or anomalous behavior.
- Use of automated security scanning tools that can model data flow from user inputs into OS command execution sites.

