/

CVE-2026-34158

Severity:

HIGH RISK

(8.8)

Command Injection (CWE-78) in Coolify Docker Helper

CVE-2026-34158

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

Coolify's executeInDocker() helper improperly quotes user-controlled commands, allowing crafted input to break out of the intended shell context.

When attackers can modify specific application settings, they may inject shell metacharacters and execute arbitrary commands directly on the managed server host during deployments.

Affected context

This vulnerability arises in Coolify deployments where application commands are constructed from editable settings and passed through the executeInDocker() helper.

The issue is most relevant when operators rely on Docker confinement for safety but allow users or automation to configure docker_compose_custom_build_command or docker_compose_custom_start_command without strict validation.

In such environments, shell-based wrapping of commands combined with insufficient quoting can lead to unintended execution on the host system that orchestrates Docker.

Exploit preconditions

  • Attack surface: Web interface or API endpoints that allow editing of application settings, specifically custom Docker Compose build and start commands.
  • Required access: Ability to modify docker_compose_custom_build_command or docker_compose_custom_start_command (e.g., authenticated user with configuration privileges or compromised admin account).
  • Trigger point: Invocation of deployment or build workflows that call executeInDocker() and interpolate the configured command into a shell.
  • Why exploitation is possible: The helper wraps the command in single quotes without escaping embedded single quotes or shell metacharacters, enabling an attacker to terminate the quoted string and append arbitrary shell commands that run on the host.

Why this happens

The underlying bug is an instance of CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

The executeInDocker() helper assumes that wrapping user-controlled input in single quotes is sufficient to contain it, but it does not escape internal single quotes or other shell control characters.

As a result, user-supplied values are composed directly into a command line that the shell interprets, allowing the attacker to alter command structure instead of merely providing data.

This pattern exemplifies the broader class of insecure command construction where application logic conflates configuration strings (data) with executable shell syntax, without using safer invocation mechanisms such as parameterized APIs or argument lists.

Potential impact

  • Attackers may execute arbitrary commands on the host that manages Docker containers.
  • They could install backdoors or malware on the server hosting Coolify.
  • Compromised hosts may be used to pivot into other infrastructure or internal networks.
  • Application deployments can be sabotaged, disrupted, or manipulated to exfiltrate secrets.
  • Data stored on the host or accessible services may be read, modified, or destroyed.

General mitigation guidance

Mitigation centers on eliminating direct shell interpretation of untrusted configuration strings and enforcing strict separation between data and executable command structure.

Common defensive patterns include:

  • Avoid composing shell commands from raw configuration values; instead, use APIs or process execution functions that accept arguments as structured lists.
  • When shell usage is unavoidable, apply robust escaping and quoting routines that neutralize special characters, or restrict configuration inputs to a safe subset without shell metacharacters.
  • Treat all user-editable deployment and build settings as untrusted and validate them against whitelists or schemas that enforce acceptable commands or parameters.
  • Run the orchestration service with least privilege on the host, reducing the damage potential of any injected command that does execute.
  • Isolate deployment automation from sensitive host resources and secrets so that command execution, even if compromised, has limited reach.

How teams detect issues like this

Detection typically involves analyzing how commands are built and where user-controlled values flow into shell execution paths.

Useful approaches include:

  • Static analysis rules that flag string concatenation or interpolation into functions like exec, system, or shell-based helpers, especially when the source is configuration or user input.
  • Code review checklists that call out any use of shell command construction in deployment or build helpers and require justification and input validation.
  • Security policies that prohibit direct shell invocation from web-facing configuration without strict sanitization, backed by automated checks in CI pipelines.
  • Runtime monitoring of deployment hosts for anomalous command patterns, unexpected processes, or command lines containing configuration-derived payloads.

Sources

SourceLink
github.comgithub.com/coollabsio/coolify/security/advisories/GHSA-j6j2-frv3-g6f7

Frequently asked

questions

Exploitation is limited to environments where an attacker can modify specific Coolify application settings that feed into executeInDocker(), but in such cases, it can lead to full command execution on the host that runs Docker.

The attacker generally needs authenticated access with permission to change docker_compose_custom_build_command or docker_compose_custom_start_command, or the ability to compromise an account or integration that controls these settings.

The safest approach is to stop building shell commands from raw configuration strings and instead invoke Docker or related tools via structured APIs or argument lists, ensuring that user-supplied values are treated strictly as data and validated before use.

Design deployment and automation components around principle-of-least-privilege and secure command invocation, enforce input validation on all configuration-driven commands, prefer non-shell execution mechanisms, and use automated reviews or static analysis to detect command construction patterns early in development.

Find out what's already
exploitable in your codebase.