ESC3
Description
ESC3 attacks make use of certificate templates that have EKU's that allow for "Certificate Request Agent". This EKU enables a principal to request a certificate on behalf of another user.
Requirements for attack path (1st condition)
Enrolment rights granted to a user or group for which we have access to
Manager approval not enabled
Authorized signatures are not required
Either the certificate EKU is set for "Certificate Request Agent". Or the certificate EKU is set for "Any Purpose"
Requirements for attack path (2nd condition)
Providing the above conditions are met for the certificate template with "Certificate Request Agent" EKU set. The following, second condition set needs to be met on a second template.
Enrolment rights granted to a user or group for which we have access to
Manager approval not enabled
The template defines an EKU which can be used for authentication for example "Client Authentication"
The template schema version is 1 or greater than 2 specifies an Application Policy Issuance Requirement that necessitates the Certificate Request Agent EKU.
No restrictions on enrollment agents are implemented at the CA level.
A likely candidate for the 2nd condition template is the default "User" template.
Linux - Enumeration
Linux - Performing the attack
Perform the initial request to the identified certificate configued with the EKU "Certificate Request Agent".
We can request a certificate on behalf of any user using any other template by including the initial certificate as proof. For authentication purposes, it is essential to request a certificate from a template that includes Client Authentication in its Extended Key Usage (EKU) settings.
For accuracy and to avoid certificate mismatch issues we should always aim to provide the -sid parameter which should be the value of the UPN we are targeting (administrator@security.local in the example below).
Finally, use the certificate file to obtain the user credentials.
Windows - Enumeration
Identify certificates that can be used for client authentication
Windows - Performing the attack
Request a certificate for the template vulnerable to ESC3.
Take the private key and certificate output and place them into seperate files.
Then merge them together with certutil to create a .pfx file.
We can request a certificate on behalf of any user using any other template by including the initial certificate as proof. For authentication purposes, it is essential to request a certificate from a template that includes Client Authentication in its Extended Key Usage (EKU) settings.
For accuracy and to avoid certificate mismatch issues we should always aim to provide the /sid parameter which should be the value of the UPN we are targeting (administrator@security.local in the example below).
Aagin, take the new key and certificate output and place them into seperate files.
Then merge them together with certutil to create a .pfx file.
Mitigations
Require manager aprovals on the certificate
Require authorized signatures
Remove weak enrollement permissions from the template
Replace "Any Purpose" (If configured) for a less descriptive one
Use Enrollment Agent restrictions on the Certificate Authority level. For example, you might want to restrict which users are allowed to act as an Enrollment Agent, and which templates can be requested.
Last updated
Was this helpful?