Any Purpose (2.5.29.37.0) EKU or as a Subordinate CA (No EKUs), the certificate can be used in place of any other EKU without restrictions.
This vulnerability allows certificates to be used for any purpose, effectively bypassing EKU restrictions and enabling various attack scenarios.
Vulnerability Criteria
The following criteria comprise an ESC2 vulnerability:Enterprise CA Enrollment Rights
Enterprise CA Enrollment Rights
The enterprise CA grants enrollment rights to the attacker-controlled user. Otherwise, the user would be unable to request any certificates from the CA.
Template Enrollment Rights
Template Enrollment Rights
The certificate template grants enrollment rights to the attacker-controlled user. Otherwise, the user would be unable to request certificates based on the specific template.
Manager Approval Disabled
Manager Approval Disabled
The “manager approval” feature is disabled for the certificate template. Otherwise, a “CA Manager” would have to manually review and approve the certificate request.
Authorized Signature Disabled
Authorized Signature Disabled
Unrestricted EKU
Unrestricted EKU
The certificate template defines an Extended Key Usage (EKU) that has no restrictions:
Any Purpose(2.5.29.37.0)Subordinate CA(No EKUs)
Enumeration
We can search for certificate templates with these conditions using theenum-templates --filter-vulnerable command from Certify. For more information about the command and its parameters, please refer to the Command Overview page.
Sample Output
Exploitation
Since the certificate can be used for any purpose, it is possible to use it as aCertificate Request Agent (Enrollment Agent) and mimic the abuse scenario for ESC3.
Attack Scenarios
Certificate Request Agent Abuse
The main difference between ESC2 and ESC3 is that the EKUs for the
Enrollment Agent certificates are different (Any Purpose / Subordinate CA vs Certificate Request Agent). While both allow enrollment on-behalf-of other users for any schema version 1 template, they require their own EKU to be present in the Required Application Policies for a schema version 2 (or above) template.Certificate Request
Usage as Enrollment Agent
Once you have obtained a certificate with the “Any Purpose” EKU, you can use it to request certificates on behalf of other users by leveraging it as an enrollment agent certificate.Relationship to Other ESCs
ESC3 Connection
ESC2 certificates with “Any Purpose” EKU can be used in the same way as ESC3 Certificate Request Agent certificates, making them functionally equivalent for enrollment agent attacks.
Mitigation
Defense Recommendations
- Replace “Any Purpose” EKU with specific, required EKUs
- Avoid using Subordinate CA templates for end-user certificates
- Implement proper template access controls
- Regular auditing of certificate template EKU configurations
- Consider using Application Policies instead of EKUs for more granular control