ADCS Exploitation: ESC1, ESC4, ESC6, ESC8
ADCS exploitation uses misconfigured certificate templates or CA settings to obtain a certificate for a privileged account without knowing that account's credentials. The certificate is then used to request a TGT or retrieve the account's NT hash via PKINIT. Most paths lead to Domain Admin in a single chain.
Run ADCS Misconfiguration Discovery first to confirm which ESC variant is present before using any technique here.
ESC1 — certificate for arbitrary UPN
ESC1 allows a low-privileged user to request a certificate with an arbitrary Subject Alternative Name. By specifying a Domain Admin UPN in the SAN, the resulting certificate authenticates as that account. This is a direct path to Domain Admin from any domain user account.
[*] Requesting certificate via RPC [+] Successfully requested certificate [*] Certificate: administrator.pfx
[*] Using principal: [email protected] [*] Trying to get TGT... [+] Got TGT [*] Saved credential cache to 'administrator.ccache' [*] NT hash for 'administrator': fc525c9683e8fe067095ba2ddc971889
ESC4 — modify template then exploit as ESC1
ESC4 gives you write access on a certificate template object. Use Certipy to overwrite the template configuration to introduce ESC1 conditions, request a certificate as a privileged account, then restore the original template to avoid leaving a permanent misconfiguration.
[+] Successfully updated template 'VulnTemplate' [+] Successfully requested certificate [*] NT hash for 'administrator': fc525c9683e8fe067095ba2ddc971889
ESC8 — NTLM relay to AD CS web enrollment
ESC8 relays NTLM authentication from a coerced DC or privileged account to the CA web enrollment endpoint. The relay requests a certificate on behalf of the coerced account. Since DCs authenticate with their machine account, a relayed DC authentication yields a DC certificate — which can then be used to perform DCSync via PKINIT.
This requires the CA web enrollment endpoint to be running over HTTP and NTLM relay protections to be absent.
[*] SMBD-Thread-4: Connection from CORP/DC01$ CORP.LOCAL [*] Authenticating against http://10.10.10.10/certsrv/certfnsh.asp as CORP/DC01$ [+] Successfully requested certificate for DC01$ [*] Base64 certificate for DC01$: MIIRbQIBAzCC...
[+] Got TGT [*] NT hash for 'DC01$': a3b4c5d6e7f8... Administrator:500:aad3b435b51404eeaad3b435b51404ee:fc525c9683e8fe067095ba2ddc971889:::
ESC6 — EDITF_ATTRIBUTESUBJECTALTNAME2
When this flag is set on the CA, any template accepts a custom SAN in the certificate request regardless of individual template settings. Exploitation is identical to ESC1 but works against any enrollable template — the default User template is usually sufficient.
[+] Successfully requested certificate [*] NT hash for 'administrator': fc525c9683e8fe067095ba2ddc971889
After obtaining an NT hash via certificate authentication, proceed to DCSync and Domain Takeover to dump all domain hashes, or use Pass-the-Hash and Pass-the-Ticket to move laterally immediately.
References
-
Certipy — GitHubgithub.com/ly4k/Certipy (opens in new tab)
req, auth, template, find command reference
-
Impacket — GitHubgithub.com/fortra/impacket (opens in new tab)
ntlmrelayx --adcs flag for ESC8 relay
-
PetitPotam — GitHubgithub.com/topotam/PetitPotam (opens in new tab)
MS-EFSR coercion for triggering DC authentication
-
Coercer — GitHubgithub.com/p0dalirius/Coercer (opens in new tab)
Multi-protocol coercion tool covering PetitPotam, PrinterBug, and others
-
Certified Pre-Owned — SpecterOpsposts.specterops.io/certified-pre-owned-d95910965cd2 (opens in new tab)
Original ESC1-ESC8 exploitation research
Was this helpful?
Your feedback helps improve this page.