Persistence in Active Directory
After compromising the domain, the attacker’s goal is not to lose access even if passwords are changed, hosts are reinstalled, or the initial intrusion is detected. AD offers extraordinarily powerful persistence because its trust rests on long-lived cryptographic keys (krbtgt, service keys, certificates) that are rarely rotated and that let you forge arbitrary authentication. A Golden Ticket or a stolen CA key can grant months of invisible access. The broken invariant: a credential forged with one of those keys is valid, without re-exploiting anything. That’s why cleaning a compromised domain is far harder than detecting the compromise.
flowchart LR
DC["DCSync: krbtgt hash"] -->|"ticketer / kerberos::golden"| GT["Golden Ticket<br/>(any user, years)"]
GT --> ACC["persistent domain access"]
CA["CA private key"] -->|"certipy forge"| GC["Golden Certificate"]
GC --> ACC
Threat model
Section titled “Threat model”- Who attacks: someone who has already compromised the domain (Domain Admin or equivalent, access to a DC or the CA) and wants long-term access.
- What it breaks: that authentication rests on long-lived secrets. Whoever steals the krbtgt key forges TGTs for anyone indefinitely; whoever steals a service account’s key forges tickets for that service; whoever steals the CA private key forges certificates for anyone.
- What it gains: persistent and often invisible access, resistant to password changes and partial cleanup.
- Why it’s so hard to eradicate: none of these techniques requires re-exploiting anything. Eradicating means rotating the secrets, sometimes twice, and assuming that a single undetected persistence reopens everything.
Anatomy
Section titled “Anatomy”The clock of the keys
Section titled “The clock of the keys”- krbtgt: signs all the domain’s TGTs. Its hash lets you forge TGTs (Golden Ticket). Almost never rotated.
- Service/computer account keys: sign the TGS of their service. Enable Silver Tickets.
- CA private key: signs certificates. Enables Golden Certificates.
Why krbtgt is rotated TWICE
Section titled “Why krbtgt is rotated TWICE”The krbtgt account keeps a history of its last two passwords. Resetting it once leaves tickets signed with the previous one still valid (and a DC that hasn’t replicated yet can use the old one). It must be reset twice, with an interval for replication to complete, to invalidate all Golden Tickets. This is official Microsoft guidance (the New-KrbtgtKeys.ps1 script) and CISA’s (CM0050) after an AD incident.
Variants
Section titled “Variants”| Technique | Secret it uses | Stealth / note |
|---|---|---|
| Golden Ticket | krbtgt hash | Forges a TGT for anyone, years |
| Silver Ticket | service/computer key | Doesn’t touch the DC (very stealthy), one service |
| Diamond Ticket | krbtgt + legitimate TGT | Modifies a real TGT, evades “impossible ticket” detection |
| Sapphire Ticket | krbtgt + real account’s PAC | Uses a legitimate PAC, even stealthier |
| DCSync rights | replication ACL | Re-dump hashes whenever, without being DA |
| DCShadow | rogue DC registration | Seeds changes without the normal logs |
| AdminSDHolder / ACL backdoor | ACL | SDProp reapplies the permission hourly: “revives” |
| Golden Certificate | CA key | Survives password resets |
| Skeleton Key | in-memory DC patch | Volatile (doesn’t survive reboot) |
Red Team
Section titled “Red Team”Golden Ticket (krbtgt)
Section titled “Golden Ticket (krbtgt)”With the krbtgt account hash (from a DCSync), you forge a TGT for any user, with any group membership, valid for years:
# get the krbtgtsecretsdump.py corp.local/da:'Passw0rd!'@dc01.corp.local -just-dc-user krbtgt# forge and inject (impacket)ticketer.py -nthash <krbtgt_hash> -domain-sid <domain-SID> -domain corp.local Administratorexport KRB5CCNAME=Administrator.ccacheSilver Ticket (service key)
Section titled “Silver Ticket (service key)”With a service/computer account hash, you forge a TGS directly for that service (CIFS, HTTP, MSSQL) without going through the DC → no KDC traffic, very stealthy. Persistent access to a specific service:
ticketer.py -nthash <computer_hash> -domain-sid <SID> -domain corp.local \ -spn cifs/srv-app.corp.local AdministratorDiamond / Sapphire Ticket
Section titled “Diamond / Sapphire Ticket”Stealthier than the Golden: instead of forging from scratch, Diamond modifies a legitimate TGT (requests a real one and rewrites its PAC with the krbtgt key) and Sapphire uses the PAC of a real, privileged account. They evade detections that look for “impossible” tickets (10-year lifetimes, groups the account doesn’t have).
DCSync as persistence
Section titled “DCSync as persistence”Granting a controlled account replication rights (DS-Replication-Get-Changes + -All) lets you
re-dump hashes (including krbtgt) whenever you want, without being DA. A discreet, powerful ACL (see
ACL abuse):
dacledit.py -action write -rights DCSync -principal jdoe -target-dn 'DC=corp,DC=local' \ corp.local/da:'Passw0rd!'@dc01.corp.localDCShadow
Section titled “DCShadow”Registering a controlled machine as a rogue DC and replicating malicious changes into the directory
(adding SID history, changing memberships, seeding backdoors) without leaving the normal
modification logs. Stealthy directory-level persistence (mimikatz lsadump::dcshadow).
AdminSDHolder / ACL backdoors
Section titled “AdminSDHolder / ACL backdoors”Modifying the ACL of the AdminSDHolder object (the permission template for protected groups): every
hour, SDProp reapplies those permissions to all privileged groups → you grant yourself access that
“revives” even if removed. Same with seeded ACLs (GenericAll over DA, WriteDacl over the domain for
DCSync).
Certificates and others
Section titled “Certificates and others”- Golden Certificate: steal the CA key → forge certificates for anyone (
certipy forge), or keep a PFX of a privileged account. Survives password resets (see AD CS). - Shadow Credentials seeded over privileged accounts (see Shadow Credentials).
- GPO backdoor (see GPO abuse), hidden accounts/SPNs, Skeleton Key (in-memory DC patch, volatile).
Investigator workflow
Section titled “Investigator workflow”- After DA: DCSync the krbtgt → Golden Ticket (the quintessential domain persistence).
- Seed a discreet, distinct layer: DCSync rights or an AdminSDHolder ACL backdoor.
- For a specific, stealthy service: Silver Ticket.
- If there’s a CA: Golden Certificate (survives password rotation).
- Document each seeded persistence so you can remove it when the engagement ends.
- mimikatz (
kerberos::golden,lsadump::dcsync,lsadump::dcshadow,misc::skeleton). - impacket (
ticketer.py,secretsdump.py,dacledit.py). - Rubeus (golden/silver/diamond), Certipy (golden certificate), PowerView (ACL backdoors).
Impact and chaining
Section titled “Impact and chaining”Persistent and often invisible access to the domain, resistant to password changes and partial cleanup. It’s what turns an incident into a long-term compromise; its existence forces drastic eradication.
Blue Team
Section titled “Blue Team”Detection
Section titled “Detection”- Golden/Silver tickets: TGT/TGS used without a prior AS-REQ (4769 without the matching 4768), anomalous lifetimes (10 years), RC4 encryption, impossible SIDs/groups in the PAC.
- DCSync from a non-DC principal (4662 with the replication GUID) — high-fidelity detection.
- DCShadow: ephemeral registration of a new nTDSDSA/server in the Configuration partition; replication from an unexpected source.
- AdminSDHolder and domain ACLs (5136); accounts that reappear in protected groups after removal.
Telemetry and sources
Section titled “Telemetry and sources”- Auditing of replication (4662), of changes to sensitive objects (5136 over AdminSDHolder/domain) and of Kerberos (4768/4769 with encryption type and AS/TGS correlation).
- Microsoft Defender for Identity (Golden Ticket, DCSync, DCShadow detection).
Hardening and eradication
Section titled “Hardening and eradication”- Rotate krbtgt TWICE (with an interval for replication) → invalidates all existing Golden Tickets. An essential step after a DC compromise; use Microsoft’s script or CISA’s (CM0050), verifying replication health between resets.
- Restrict replication rights to the DCs; audit domain and AdminSDHolder ACLs regularly.
- gMSA and long passwords on service accounts (mitigates Silver Tickets by cracking); AES over RC4.
- Protect the CA (key in an HSM, auditing) to cut off Golden Certificates; review Shadow Credentials.
- Tiering/PAW, Protected Users and continuous monitoring.
Response (full eradication)
Section titled “Response (full eradication)”After a domain compromise: rotate krbtgt ×2, reset all privileged and service accounts, review AdminSDHolder and ACLs, reissue/revoke certificates if the CA fell, delete seeded accounts/SPNs/GPOs/Shadow Credentials, and rebuild the DCs if there was DCShadow or Skeleton Key. Assume that one undetected persistence reopens everything.
CVEs and real cases
Section titled “CVEs and real cases”- Golden Ticket, DCSync, DCShadow and Skeleton Key are mimikatz TTPs (MITRE T1558.001 Golden, T1558.002 Silver, T1003.006 DCSync, T1207 DCShadow, T1098 Account Manipulation).
- APT29, APT28, FIN6 and ransomware groups use Golden Tickets and DCSync to persist after the initial compromise.
- Double krbtgt rotation is official Microsoft and CISA guidance after an AD incident, precisely because of Golden Tickets.
Test checklist
Section titled “Test checklist”- Golden Ticket with the krbtgt hash (forge + use).
- Silver Ticket with a service/computer key (stealthy, doesn’t touch the DC).
- Diamond/Sapphire to evade forged-ticket detection.
- DCSync rights granted to a controlled account.
- DCShadow to seed changes without normal logs.
- AdminSDHolder / ACL backdoors (DCSync,
GenericAllover DA). - Golden Certificate (CA key) / seeded Shadow Credentials.
- Persistences documented and removed at closeout.
- Blue: was krbtgt rotated ×2 and are replication/AdminSDHolder audited?