How I Found an OS Command Injection (RCE) in Coolify
Coolify built a shell command for health checks by inserting user-supplied values without escaping, allowing an authenticated user to inject arbitrary OS commands. An attacker could run commands as root inside the deployed container, steal secrets, and potentially move laterally.
Published on medium.com
So, I got my second CVE— and this time it’s a Remote Code Execution in Coolify, a platform used by thousands of developers to deploy their applications. Let me walk you through the entire journey — how I found it, how the exploit works, and what you can learn from it.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
User-controlled health check settings were interpolated directly into a shell command string without escaping or validation.
Impact
An authenticated user could execute arbitrary commands as root inside any deployed container, steal secrets, backdoor applications, and potentially move laterally or escape the container if privileged.
What the attacker needed
Authenticated Coolify account; permission to edit applications; API token or web UI access
The fix
The vulnerability was fixed by passing all user-controlled values through escapeshellarg() before inserting them into the shell command.
How it was found
- Authenticate to Coolify and obtain an API token.
- Send a PATCH request to the application API with a malicious health_check_host value.
- Trigger a deployment or restart via the API.
- Verify command execution by reading the output file inside the container.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A health check is a small test that Coolify runs to see if your app is alive. The problem was that Coolify put the user's settings directly into a command that the computer runs, so a user could add extra commands that the computer would also run. This let a normal user run any command inside the container, as root.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.