Coolify Authenticated Remote Command Injection via Deployment Config (CVE-2026-34038)
by ThemeHackers · 2026-07-05
- Severity
- Critical
- CVE
- CVE-2026-34038 (GHSA-qqrq-r9h4-x6wp)
- Category
- web
- Affected product
- Coolify (self-hosted PaaS/deployment platform)
- Affected versions
- Versions with vulnerable ApplicationDeploymentJob.php handling of dockerfile_location / pre_deployment_command (see GHSA-qqrq-r9h4-x6wp)
- Disclosed
- 2026-07-05
- Patch status
- unpatched
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-07 |
| Author / Researcher | ThemeHackers |
| CVE / Advisory | CVE-2026-34038 (GHSA-qqrq-r9h4-x6wp) |
| Category | web |
| Severity | Critical |
| CVSS Score | 10.0 (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H) |
| Status | PoC |
| Tags | coolify, command-injection, cwe-78, rce, deployment, docker, api |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | Coolify (self-hosted PaaS/deployment platform) |
| Versions Affected | Versions with vulnerable ApplicationDeploymentJob.php handling of dockerfile_location / pre_deployment_command (see GHSA-qqrq-r9h4-x6wp) |
| Language / Platform | PHP (Laravel) backend; PoC written in Python 3 using Coolify’s REST API |
| Authentication Required | Yes (API token with application “write” permission) |
| Network Access Required | Yes |
Summary
Coolify builds shell commands for application deployment by interpolating user-supplied configuration fields — notably dockerfile_location and pre_deployment_command — directly into shell strings executed inside the build/deploy container, without adequate escaping or validation. A user holding only “write” (configuration update) permission on an application, without explicit “deploy” rights, can set these fields to shell metacharacter payloads (;, &&, pipes) and trigger a build to have them executed. Because deployment logs are readable by the same low-privileged token, command output — including exfiltrated environment variables such as database credentials and API keys — can be read back through the deployment log stream, achieving full RCE and secrets exfiltration even when the build environment is otherwise isolated from the Docker socket.
Vulnerability Details
Root Cause
dockerfile_location and pre_deployment_command values are concatenated into shell command strings in app/Jobs/ApplicationDeploymentJob.php without sufficient shell-metacharacter sanitization or strict format validation, permitting arbitrary command injection via ;, &&, and pipe sequences.
Attack Vector
- Obtain an API token with application “write” permission (deploy permission not required due to a permission-check gap).
- Send a
PATCHrequest to/api/v1/applications/{uuid}settingdockerfile_locationtoDockerfile; <command>;and/orpre_deployment_commandto the desired command. - Trigger a deployment via
POST /api/v1/applications/{uuid}/start. - Poll
/api/v1/deployments/{deployment_uuid}and parse thelogsfield to read command output streamed back in the build/deploy log.
Impact
Remote code execution within the Coolify deployment/build container as an authenticated but under-privileged user, plus exfiltration of sensitive environment variables (database credentials, API keys) via deployment logs.
Environment / Lab Setup
Target: Coolify instance (vulnerable version), reachable API endpoint
Attacker: Python 3 + requests library, valid API token with "write" permission
Proof of Concept
PoC Script
See
exploit.pyin this folder.
| |
The script lists available applications if no UUID is given, patches the target application’s dockerfile_location and pre_deployment_command fields with an injected shell payload, triggers a deployment, and polls the deployment status endpoint to stream the command output back from the build logs in real time.
Detection & Indicators of Compromise
Signs of compromise:
- Deployment logs containing output from commands unrelated to the actual build (e.g.
whoami,env,cat /etc/hosts) - API tokens without “deploy” permission successfully triggering
/starton an application - Unexpected shell metacharacters in stored
dockerfile_location/pre_deployment_commandconfiguration values
Remediation
| Action | Detail |
|---|---|
| Primary fix | Apply the vendor patch referenced in GHSA-qqrq-r9h4-x6wp once available/confirmed for the deployed version |
| Interim mitigation | Validate dockerfile_location against a strict ^[a-zA-Z0-9._\-\/]+$ pattern and reject path traversal; use escapeshellarg() for all shell-bound fields; enforce the “deploy” permission check on the deployment-trigger endpoint; audit docker_compose_location for the same issue |
References
Notes
Mirrored from https://github.com/ThemeHackers/CVE-2026-34038 on 2026-07-05.
| |