Defensive counterpart to everything in this module. Use it two ways: as an operator, to anticipate what controls will trip you and what logs the blue team will chase; as a report author, to translate each offensive finding into a concrete remediation the client can implement.
Protocol Hardening
SMB Signing (required)
Breaks SMB relay attacks (ntlmrelayx -t smb://...) outright.
# Enforce on all SMB clients and servers (via GPO or locally)
Set-SmbServerConfiguration -RequireSecuritySignature $True
Set-SmbClientConfiguration -RequireSecuritySignature $True
# Check posture across subnet
crackmapexec smb 10.10.10.0/24 --gen-relay-list signing_off.txtGPO path: Computer Config → Policies → Windows Settings → Security Settings → Local Policies → Security Options → Microsoft network server: Digitally sign communications (always) = Enabled.
LDAP Signing & Channel Binding
Blocks LDAP relay to the DC (the quiet cousin of SMB relay — used to grant RBCD/DCSync rights).
Domain controller: LDAP server signing requirements = Require signingDomain controller: LDAP server channel binding token requirements = Always- Validate:
nmap -p 389 --script ldap-rootdse+ check event 2889 (unsigned binds) on DCs.
NTLM Reduction
- Audit with GPO
Network security: Restrict NTLM: Audit Incoming NTLM Traffic - Then move to
Deny all accountson DCs — kills NTLM-based relay entirely. - Protected Users members can’t use NTLM anyway (see below).
Account Hygiene
LAPS (Local Admin Password Solution)
Randomizes the local admin password per host, stored as an AD attribute readable only by delegated groups. Kills password reuse → PtH → lateral sweeps.
# Audit who can read LAPS passwords
Find-LAPSDelegatedGroups
Find-AdmPwdExtendedRights # watch for "All Extended Rights" = full read
Get-LAPSComputers # as a delegated user, shows cleartext pw + expiryDeploy via the Windows LAPS client (Server 2019+) or legacy AdmPwd.dll. Scope reads to a tiered admin group, not Domain Admins.
gMSA for Service Accounts
Group Managed Service Accounts auto-rotate their 240-byte password every 30 days — Kerberoasting them yields a hash no wordlist will touch. Single biggest Kerberoast mitigation.
# Create and allow retrieval by a group
New-ADServiceAccount -Name svc_sql -DNSHostName sql.corp.local `
-PrincipalsAllowedToRetrieveManagedPassword "SQL Servers"
Install-ADServiceAccount -Identity svc_sqlMigrate any SPN-bearing account found via Get-ADUser -Filter {ServicePrincipalName -like "*"} into gMSA.
Protected Users Group (Server 2012 R2+)
Membership enforces:
- No NTLM authentication
- No DES or RC4 Kerberos keys (AES only)
- No cached plaintext credentials (CredSSP, Digest, WDigest)
- No delegation (constrained or unconstrained)
- TGT lifetime capped at 4 hours, no renewal
- Long-term keys not cached after initial TGT
Get-ADGroup -Identity "Protected Users" -Properties Members
Add-ADGroupMember "Protected Users" -Members tier0adminStage first
Adding service accounts, scheduled-task runners, or anything using RC4/NTLM will break them instantly. Pilot with a single admin, monitor for 4648/4625, then roll out.
AdminSDHolder
The CN=AdminSDHolder object in CN=System holds a template ACL. The SDProp task copies it to every protected principal (adminCount=1) every 60 minutes — so an attacker ACL on a DA will be reverted. But an attacker who adds themselves to AdminSDHolder’s ACL gets re-stamped onto every DA, EA, and krbtgt on the next SDProp run. Audit it.
Get-DomainObjectAcl -SearchBase "CN=AdminSDHolder,CN=System,DC=corp,DC=local" `
-ResolveGUIDs | ? {$_.ActiveDirectoryRights -match "GenericAll|WriteDacl|WriteOwner"}Tier Model (Tier 0 / 1 / 2)
- Tier 0 — DCs, ADFS, PKI, cloud sync, anything controlling identity. Admins log in only from Tier 0 PAWs.
- Tier 1 — servers, apps, databases. Separate admin account from T0.
- Tier 2 — workstations, helpdesk. Never shares creds with T0/T1.
Enforced via GPO logon restrictions (Deny logon locally / via RDP / via network) and silo policies. Breaks the classic workstation → server → DC credential chain.
Detection — Key Event IDs
Collect from DCs + member servers into SIEM. The high-signal IDs:
| Event ID | Where | What it catches |
|---|---|---|
| 4624 | all | Successful logon — field LogonType (3=net, 10=RDP, 9=explicit creds overpass) |
| 4625 | all | Failed logon — spraying produces fan-out of 4625s from one source |
| 4648 | all | Logon with explicit credentials — PtH, PtT, runas, overpass-the-hash |
| 4662 | DC | Directory object access; filter Properties for the DS-Replication-Get-Changes-All GUID {1131f6ad-9c07-11d1-f79f-00c04fc2dcd2} → DCSync |
| 4768 | DC | TGT requested — baseline, hunt RC4 (Ticket Encryption Type 0x17) when AES expected |
| 4769 | DC | TGS requested — Kerberoast = many 4769s for SPN accounts, encryption type 0x17 |
| 4776 | DC | NTLM credential validation — spikes = NTLM-based spraying |
| 5140 | FS | Network share accessed — IPC fan-out = lateral movement |
| 7045 | member | Service installed — psexec-style (service name like BTOBTO, random 8-char) |
| 1102 | all | Audit log cleared — attacker cleanup |
DCSync hunt
EventCode=4662 AND Properties="*1131f6ad*"with a source that isn’t a DC computer account = someone is DCSyncing. Alert same-day.
Kerberoast indicators
4769 where TicketEncryptionType=0x17 (RC4)
AND ServiceName != krbtgt
AND TargetUserName not in known_service_accounts
Golden / Silver ticket indicators
- 4769 for a service with no preceding 4768 (silver = no TGT request at DC)
- 4624 LogonType 3 with
AuthenticationPackageName=Kerberosbut anomalous AccountDomain in the TGT (golden with mistyped domain) - TGT lifetime > 10h (default is 10h) → forged
Honey Objects & Canaries
Low-effort, high-signal tripwires.
- Honey user — real account, SPN set (bait for Kerberoast),
adminCount=1, long/random password, no actual access. Any 4769 for it = an attacker enumerating SPNs. Add description: “do not use — service reserved.” - Honey computer — fake computer object with a weak password set; monitor 4624 to it.
- Honey share — SMB share named
Backups/IT-Adminwith canary tokens inside; 5140 = recon. - Canary tokens — https://canarytokens.org — DNS/HTTP tokens embedded in SYSVOL scripts, Groups.xml, LSASS memory dumps. Any trigger is a compromise.
Posture Assessment Tools
Run periodically (quarterly min) and before any assessment report:
- BloodHound / BloodHound CE — attack-path graph.
Shortest Paths to Domain Admins,Kerberoastable Users with Admin Privileges,Users with Foreign Group Membership. - PingCastle — one-command AD maturity scan with a letter-grade report. Great for executive-facing output.
- PurpleKnight — similar to PingCastle, Semperis.
- Grouper2 — GPO misconfig scanner (passwords in GPP, bad ACLs on scripts).
- ADRecon — snapshots config into an Excel workbook for diffing year over year.
Hardening Checklist (Operator Shortlist)
-
ms-DS-MachineAccountQuota = 0(kills noPac + RBCD prerequisite) - SMB signing required everywhere
- LDAP signing + channel binding required on DCs
- NTLM deny-by-default on DCs (after audit)
- Disable Print Spooler on DCs and servers that don’t print (kills PrinterBug/PrintNightmare)
- LAPS deployed, delegated reads scoped tightly
- All service accounts migrated to gMSA
- krbtgt rotated twice/year (script-driven, 10h+ gap between rotations)
- Protected Users populated with tier-0 admins (staged)
- Tier 0 PAWs — no internet, no email, no T1/T2 logon
- No passwords in description, SYSVOL scripts, or GPP
- AdminSDHolder ACL audited quarterly
- Disable WDigest, disable SMBv1
- Honey user with SPN + canary token in SYSVOL
- SIEM alerts: 4662 DCSync GUID, 4769 RC4 non-krbtgt, 7045 random-named services
Mapping Back to Attack Chapters
| Attack | Mitigation |
|---|---|
| Kerberoast | gMSA; AES-only; monitor 4769 RC4 |
| AS-REP Roast | Clear DONT_REQ_PREAUTH; strong passwords |
| PtH | LAPS; disable NTLM; Protected Users; Credential Guard |
| Golden Ticket | Rotate krbtgt twice; Protected Users (4h TGT); monitor 4769 anomalies |
| Silver Ticket | gMSA; monitor 4624 LogonType 3 w/o preceding 4768 |
| DCSync | Audit replication rights; alert on 4662 GUID 1131f6ad |
| ExtraSids / child→parent | Treat any child DA = forest compromise; rotate child krbtgt; cannot be filtered intra-forest |
| noPac | Patch + ms-DS-MachineAccountQuota=0 |
| PetitPotam | Patch; EPA + require-SSL on AD CS; disable NTLM on CA |
| Unconstrained delegation | Remove flag; put sensitive accounts in Protected Users |
Related
- 19 · Active Directory Enumeration & Attacks — module index
- 00 · Cheatsheet & Checklist
- AD Fundamentals
- Core Protocols
- External Recon & Initial Enumeration
- LLMNR & NBT-NS Poisoning
- Password Policy & User Lists
- Password Spraying
- Credentialed Enumeration (Linux)
- Credentialed Enumeration (Windows)
- Kerberoasting & AS-REP Roasting
- ACL Abuse
- Lateral Movement & Attacks
- Trust Abuse
