/

CVE-2025-59157

Severity:

CRITICAL RISK

(9.9)

OS Command Injection in Coolify Git Repository Configuration

CVE-2025-59157

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution on Deployment Server

Severity:

CRITICAL RISK

(9.9)

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 command injection vulnerability in Coolify allows arbitrary shell commands to be injected through the Git Repository field during project creation.

When a crafted repository value is used in the deployment workflow, these commands run on the underlying server, meaning even regular member users can potentially execute system-level operations.

Affected context

This vulnerability appears in Coolify instances where user-supplied Git repository values are fed into shell commands as part of the deployment process.

It primarily affects deployment workflows that build, clone, or otherwise interact with Git repositories based on untrusted user input, without adequate sanitization or separation between data and shell execution.

Regular member accounts that can create or configure projects with a Git repository URL are within the blast radius of this issue.

Exploit preconditions

  • Attack surface: Web application interface for creating or configuring projects in Coolify.
  • Required access: Authenticated access as a regular member user with permission to define or edit the Git Repository field for a project.
  • Trigger point: Initiation of the deployment workflow (e.g., project creation, redeploy, or automated build) where the Git repository value is passed to the shell.
  • Why exploitation is possible: The Git Repository field is interpolated into shell commands without robust input validation, quoting, or use of a safe process execution API. This allows injected shell metacharacters to be interpreted as additional commands.

Why this happens

The core issue is the construction of shell commands that directly embed user input from the Git Repository field.

Instead of treating user input as opaque data, the deployment logic likely interpolates it into command strings executed by a shell (e.g., /bin/sh -c "git clone <user_input>").

This pattern aligns with CWE-78: Improper Neutralization of Special Elements used in an OS Command, where failure to properly escape, validate, or avoid shell contexts allows attackers to introduce additional arguments or standalone commands.

The abstract bug class is: combining untrusted input with shell command strings, rather than using parameterized or API-based execution that isolates arguments.

Potential impact

  • Execution of arbitrary commands on the Coolify server hosting the deployment workflow
  • Reading, modifying, or deleting files accessible to the Coolify process
  • Compromise of deployed applications and associated secrets or environment variables
  • Pivoting to other infrastructure components reachable from the Coolify host
  • Installation of backdoors, cryptominers, or other persistent malware on the server
  • Disruption of CI/CD pipelines and unauthorized deployment of attacker-controlled code

General mitigation guidance

Effective mitigation focuses on removing direct shell interpretation of user input from deployment flows and reducing trust in configuration fields:

  • Prefer high-level, parameterized process execution APIs (e.g., language-native process spawn functions) that pass arguments as arrays instead of through shell command strings.
  • Strictly validate the Git repository input against an allowlist of expected formats (e.g., standard Git URLs or SSH-style repository specifiers) and reject any values containing shell metacharacters or unexpected tokens.
  • Normalize and canonicalize repository inputs before use, ensuring they cannot be interpreted as command sequences.
  • Apply least-privilege principles to the deployment service account so that, even if command execution occurs, its ability to affect the system and other services is constrained.
  • Isolate deployment tasks in hardened environments (containers, jails, or dedicated build agents) to limit the impact of any abuse of system commands during deployment workflows.

How teams detect issues like this

Detection generally relies on both code-centric and operational techniques:

  • Static analysis patterns: Search for points where user-controlled configuration fields (such as repository URLs) are concatenated into command strings passed to shells or command interpreters.
  • Code review signals: Pay attention to any use of shell execution APIs (e.g., exec, system, popen, shell_exec, or similar wrappers) that take interpolated strings containing user input from project or repository configuration.
  • Policy enforcement: Introduce secure coding guidelines that discourage or forbid arbitrary shell command construction in deployment logic, backed by pre-commit hooks or CI jobs that flag risky patterns.
  • Runtime monitoring: Monitor deployment servers for anomalous commands or processes started during project creation and deployment (e.g., unexpected system utilities, network scanning tools, or shells).
  • Automated security scanners or SAST tools can supplement manual review by flagging known command injection patterns and tainted data flows from HTTP parameters or configuration fields into OS command APIs.

Sources

SourceLink
github.comgithub.com/coollabsio/coolify/security/advisories/GHSA-5cg9-38qj-8mc3

Frequently asked

questions

Yes, if a Coolify instance is exposed and allows remote users to authenticate as regular members, the vulnerability can be exploited remotely via the web interface by supplying crafted values in the Git Repository field.

The attacker needs authenticated access as at least a regular member user with permission to create or configure projects and define the Git Repository field; no elevated administrative privileges are strictly required.

The safest approach is to avoid constructing shell commands from user input altogether, using parameterized process-execution APIs instead. When shell usage is unavoidable, inputs must be strictly validated, escaped, and restricted to a well-defined, minimal set of allowed formats or values.

Prevention starts with design: treat all user-supplied configuration as untrusted, avoid shell-based orchestration where possible, enforce input schemas and allowlists, and add security checks in CI to detect command construction patterns. Complement this with regular security-focused code reviews of deployment and automation components, which are particularly prone to injection flaws.

Find out what's already
exploitable in your codebase.