ADCS Exploitation: ESC2, ESC3, ESC5, ESC7
Additional ADCS misconfigurations beyond the most common ESC1/ESC4/ESC8 paths. Run certipy find -vulnerable to identify which ESC variants are present before choosing an attack chain. These techniques require ADCS Misconfiguration Discovery first to confirm the exact condition.
ESC2 — Any Purpose EKU
The certificate template has the Any Purpose Extended Key Usage or no EKU at all. This means certificates issued from this template can be used for any purpose, including client authentication and enrollment agent operations. If the template also allows enrollee-supplied subjects, exploit it exactly like ESC1. If not, use the issued certificate as an enrollment agent for a subsequent ESC3-style chain.
[*] Got hash for '[email protected]': fc525c9683e8fe067095ba2ddc971889
ESC3 — Enrollment Agent
Two templates are required. The first has the Certificate Request Agent EKU — obtaining it makes your certificate an enrollment agent. The second allows enrollment agents to request certificates on behalf of other users. With both, you can issue a certificate for any user including Domain Admin.
# Step 1: [*] Saved certificate and private key to '$USER.pfx' # Step 2: [*] Saved certificate and private key to 'administrator.pfx' [*] Got hash for '[email protected]': fc525c9683e8fe067095ba2ddc971889
ESC5 — CA object ACL misconfiguration
If you have write rights on the CA object in AD (pKIEnrollmentService or certificationAuthority in CN=Public Key Services,CN=Services,CN=Configuration), you can modify the CA configuration — enable disabled templates, add enrollment officers, or set the EDITF_ATTRIBUTESUBJECTALTNAME2 flag that makes every template behave like ESC1.
[*] Successfully enabled 'VulnerableUserTemplate' [*] Got hash for '[email protected]': fc525c9683e8fe067095ba2ddc971889
ESC7 — CA management rights
Two CA management rights enable privilege escalation:
ManageCA: can set the
EDITF_ATTRIBUTESUBJECTALTNAME2flag on the CA, making every template in the CA behave like ESC1. One command turns the entire CA into an ESC1 target.Issue and Manage Certificates: can approve pending or denied certificate requests. Exploit chain: request a cert from a restricted template (request is denied/pending), then approve your own request.
[*] Successfully enabled 'EDITF_ATTRIBUTESUBJECTALTNAME2' on '$CA_NAME' [*] Got hash for '[email protected]': fc525c9683e8fe067095ba2ddc971889
[*] Request ID is 23 [*] Request 23 successfully issued [*] Saved certificate and private key to 'administrator.pfx' [*] Got hash for '[email protected]': fc525c9683e8fe067095ba2ddc971889
References
-
Certipy (GitHub)github.com/ly4k/Certipy (opens in new tab)
find -vulnerable, ca -enable-attribute / -issue-request / -enable-template, req -on-behalf-of
-
Certify (GitHub)github.com/GhostPack/Certify (opens in new tab)
Windows-side ESC2/ESC3 request chains with /onbehalfof flag
-
Certified Pre-Owned — SpecterOpsposts.specterops.io/certified-pre-owned-d95910965cd2 (opens in new tab)
Original ESC1-8 definitions and attack chains by Will Schroeder and Lee Christensen
Was this helpful?
Your feedback helps improve this page.