/

CVE-2026-42204

Severity:

HIGH RISK

(8.8)

Command Injection (CWE-78) via Coolify Docker Commands

CVE-2026-42204

Deferred

Vulnerability type

Category:

Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution on Host System

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A regression in Coolify's shell command filtering for custom Docker Compose actions allows ampersands in build and deployment-related command fields, enabling command chaining.

An authenticated team member who can configure these commands may inject arbitrary shell instructions that execute on the underlying host whenever the affected actions run.

Affected context

This vulnerability occurs in Coolify deployments that use custom Docker Compose commands for build, start, or pre/post-deployment hooks.

It is relevant when team members are allowed to define or modify these commands through the Coolify UI and the platform relies on a shell-safe pattern to sanitize or constrain what can be executed.

The regression in SHELL_SAFE_COMMAND_PATTERN reintroduced support for ampersands, which can be used to chain multiple shell commands, increasing the attack surface on the host running Coolify and Docker.

Exploit preconditions

  • Attack surface: Coolify web interface fields for custom Docker Compose build, start, and deployment hook commands.
  • Required access: Authenticated access as a team member with permission to configure project or deployment commands.
  • Trigger point: Execution of the configured Docker Compose command or deployment hook by Coolify during normal operational workflows.
  • Why exploitation is possible: The regression in SHELL_SAFE_COMMAND_PATTERN fails to properly restrict shell metacharacters such as ampersands, allowing crafted input that the shell interprets as multiple commands, enabling arbitrary command execution on the host.

Why this happens

The underlying bug class is command injection, mapped to CWE-78: Improper Neutralization of Special Elements used in an OS Command.

Coolify relies on a pattern-based filter (SHELL_SAFE_COMMAND_PATTERN) to limit what users can pass into shell-executed commands for Docker Compose operations.

The regression expanded allowable characters to include ampersands, a shell metacharacter used for command chaining and background execution, effectively breaking the trust boundary between user-supplied configuration and host-level shell execution.

Because the application constructs or forwards these strings directly to a shell without rigorous escaping or use of safer invocation mechanisms, user-controlled content can influence the structure of the executed command line rather than being treated as inert data.

Potential impact

  • Authenticated users may execute arbitrary commands on the host running Coolify.
  • Attackers could access or modify application, database, or system files on the host.
  • Host-level compromise could allow installation of additional tooling or backdoors.
  • Deployment pipelines and running containers can be tampered with or disrupted.
  • Lateral movement to other services reachable from the compromised host may occur.

General mitigation guidance

Mitigation strategies focus on removing direct shell interpretation of user-controlled command strings and tightening the configuration trust model.

Secure patterns include:

  • Avoiding construction of shell command lines from raw user input; prefer structured invocation APIs (e.g., parameterized process execution) that treat user values as arguments, not command fragments.
  • Applying strict allowlists for permissible commands and arguments in deployment hooks, limiting users to predefined operations rather than arbitrary shell syntax.
  • Enforcing robust validation that rejects shell metacharacters and control operators, rather than relying solely on regex filters that can regress.
  • Running Coolify and its Docker engine with least privilege, isolating deployment processes from sensitive host resources where practical.
  • Separating configuration roles so that only highly trusted administrators can define commands that run on the host, and using review/approval workflows for changes.

How teams detect issues like this

Effective detection involves both code-focused and configuration-focused approaches:

  • Static analysis rules or manual code review to identify locations where user-supplied strings are passed into shell execution APIs without strict argument separation or escaping.
  • Security review of command pattern filters (such as SHELL_SAFE_COMMAND_PATTERN) to ensure they implement conservative allowlists rather than permissive blocklists and to catch regressions when patterns change.
  • Logging and monitoring of deployment and build commands executed by Coolify, including recording the full command line for anomaly detection and forensic analysis.
  • Policy enforcement in CI/CD and configuration management pipelines that flags or requires approval for custom commands containing shell metacharacters or unexpected operations.
  • Optional use of automated configuration scanning tools that look for high-risk command patterns in deployment orchestrators and platform settings.

Sources

SourceLink
github.comgithub.com/coollabsio/coolify/commit/e1aac50b745cf499e710b7e35cd2a9d6a1538dd9
github.comgithub.com/coollabsio/coolify/pull/9684
github.comgithub.com/coollabsio/coolify/releases/tag/v4.0.0-beta.474
github.comgithub.com/coollabsio/coolify/security/advisories/GHSA-chg4-63hm-xv9x

Frequently asked

questions

Exploitation is limited to environments where users with Coolify team access can configure custom Docker Compose or deployment commands. It is not a public remote vulnerability, but any compromised or malicious team account can abuse it to gain host-level command execution.

An attacker must be an authenticated team member with sufficient permissions to edit build, start, or pre/post-deployment command fields in Coolify. Once they can change these configurations, the vulnerability allows their injected commands to run on the host during normal deployment activity.

The safest pattern is to decouple user-controlled data from shell interpretation: use parameterized process execution where possible, and restrict users to a curated set of actions rather than free-form shell commands. In addition, implement conservative allowlists and comprehensive validation that disallows shell metacharacters and operators.

Future prevention involves designing deployment and build systems so that user input never directly forms shell command lines, applying strict validation and allowlists to configuration fields, enforcing role-based control over who can define host-level commands, and integrating security-focused review and testing of any command-filtering logic into the development and release process.

Find out what's already
exploitable in your codebase.