AD CS Template With Any Purpose or Enrolment Agent Usage (ESC2, ESC3)

Certificate templates open to low-privileged users issue Any Purpose or enrolment agent certificates that can be used to obtain certificates for other users.

SeverityHigh
CVSS 3.18.8 CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H Open in the calculator
CVSS 4.08.7 CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N Open in the calculator
CWECWE-266: Incorrect Privilege Assignment
OWASP Top 10A06:2025 Insecure Design
MITRE ATT&CKT1649 Steal or Forge Authentication Certificates, T1550.003 Pass the Ticket
CategorySecurity Misconfiguration

Description

An enterprise CA publishes a certificate template that low-privileged users can enrol in and whose certificates grant more than authentication as the requester. Two closely related cases, documented as ESC2 and ESC3 in the Certified Pre-Owned research, are covered here.

In ESC2, the template has the Any Purpose EKU (2.5.29.37.0) or no EKU at all. The certificate can then be used for any purpose, including client authentication and acting as an enrolment agent, and a certificate with no EKU may also be usable to sign further certificates, which systems that trust the CA for purposes other than domain authentication could accept.

In ESC3, the template issues certificates with the Certificate Request Agent EKU (1.3.6.1.4.1.311.20.2.1). An enrolment agent can request certificates on behalf of other users, so any user with enrolment rights on the vulnerable template can obtain that capability, directly in ESC3 or through an Any Purpose certificate in ESC2, then use a second template that accepts enrolment agent requests and permits authentication to obtain a certificate for any other account, including a domain administrator, giving full control of the domain. Schema version 1 templates, such as the default User template, accept such requests, and the CA does not restrict enrolment agents by default. The resulting certificates remain valid until they expire or are revoked, regardless of password changes.

Certipy, Certify, BloodHound and PingCastle identify both conditions from the template and CA objects in Active Directory.

Remediation

  • Replace Any Purpose and empty EKU lists with the specific EKUs each template needs, and remove the Certificate Request Agent EKU from any template that ordinary users can enrol in.
  • Restrict enrolment on enrolment agent templates to the small group of staff or systems that act as enrolment agents, removing broad groups such as Domain Users, Domain Computers and Authenticated Users.
  • Configure enrolment agent restrictions on the CA (the Restrict enrollment agents option on the Enrollment Agents tab of the CA's properties), limiting which agents may enrol on behalf of which users and with which templates.
  • Require CA certificate manager approval on templates that must keep broad EKUs, and stop publishing templates that are not needed.
  • Review the CA database for certificates issued from these templates, and for certificates requested on behalf of other users, and revoke any that are not legitimate.

Confirm the fix by running certipy find -vulnerable again and attempting an on-behalf-of request with an enrolment agent certificate obtained by an ordinary user, which should fail.

References


Add This Finding to Your Library

In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.

Free trial  ·  No card required

Only need the reporting? Our reporting tool is free and open source, with the same library.


More Active Directory Findings

Every Active Directory finding