The misconfiguration was initially disclosed by Oliver Lyak in this blogpost.
Vulnerability Criteria
The following criteria comprise an ESC10 vulnerability:ESC10 Prerequisites
ESC10 Prerequisites
- The Schannel certificate mapping has been downgraded to allow
userPrincipalName(UPN) mapping. - We have
GenericWriterights on a user or computer object in the environment.
- The enterprise CA grants enrollment rights to the attacker-controlled user.
- The certificate template grants enrollment rights to the attacker-controlled user.
- The “manager approval” feature is disabled for the certificate template.
- The “authorized signature” feature is disabled for the certificate template.
- The certificate template defines an Extended Key Usage (EKU) that enables Schannel client authentication:
Client Authentication(1.3.6.1.5.5.7.3.2)Any Purpose(2.5.29.37.0)Subordinate CA(No EKUs)
- The certificate template must define a UPN-mappable or DNS-mappable flag in its
Certificate Name Flagattribute:SUBJECT_ALT_REQUIRE_UPNSUBJECT_ALT_REQUIRE_SPN- This flag relies on theuserPrincipalNameattribute, despite the name hinting at SPN.SUBJECT_ALT_REQUIRE_DNS- This does not work if the target is a user (as they do not have thedNSHostNameattribute)
Attack Process
The attack scenario consists of the following steps:ESC10 Attack Steps
ESC10 Attack Steps
-
Temporarily modify a mapping attribute of the principal to match that of the target principal that we want to impersonate.
- If the template has the
SUBJECT_ALT_REQUIRE_UPNflag or theSUBJECT_ALT_REQUIRE_SPNflag, theuserPrincipalNameattribute of the attacker-controlled principal must match theuserPrincipalNameorsAMAccountNameattribute of the target principal. - If the template has the
SUBJECT_ALT_REQUIRE_DNSflag, thedNSHostNameattribute of the attacker-controlled principal must match thedNSHostNameattribute of the target principal.
- If the template has the
- Request a certificate from the vulnerable template. The issued certificate will contain a Subject Alternative Name (SAN) based on the mapping attribute of our requesting user (which is identical to that of our target principal).
- Revert the temporary mapping attribute modification. The target principal is now the only user in the domain with an attribute that matches the one in our issued certificate.
- Authenticate over Schannel as the impersonated user. This is possible because Schannel ignores the SID security extension in the certificate and the mapping attribute of the certificate matches only our target principal (after we reverted our own changes).
Detection
We can search for certificate templates with these conditions using theenum-templates --filter-client-auth command from Certify. For more information about the command and its parameters, please refer to the Command Overview page.
Exploitation Example
Once we have identified a certificate template that our attacker-controlled user can enroll in, we can perform the weak certificate mapping attack. Since the certificate template contains theSUBJECT_ALT_REQUIRE_UPN flag, we must modify the userPrincipalName of our attacker-controlled user to match a target principal that we want to impersonate.
Administrator). This can be done using the request command from Certify.
cert.pfx).
PassTheCert and confirm that we have successfully elevated our privileges by impersonating the Administrator user.