How I Escalated To Domain Admin Using Ad Cs And How To Fix It
A certificate template in Active Directory Certificate Services was misconfigured to allow any user to request a certificate with an arbitrary User Principal Name and use it for client authentication. An attacker with a low-privileged account could therefore obtain a certificate for the Domain Administrator and authenticate as that user, escalating to domain admin.
Published on infosecwriteups.com
If certificate templates are misconfigured, attackers can request certificates for other users, including Domain Administrators, leading to privilege escalation.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The certificate template allowed low-privileged users to enroll and to supply an arbitrary User Principal Name (UPN) in the request, and it was trusted for client authentication.
Impact
An attacker with a low-privileged domain account could impersonate the Domain Administrator and gain full control of the domain without knowing the administrator's password.
What the attacker needed
Low-privileged domain account; vulnerable certificate template (ESC1); network access to the domain controller
The fix
The template should be fixed by disabling the ability for requesters to supply an arbitrary UPN, restricting enrollment permissions, and removing unnecessary client authentication EKUs.
How it was found
- Enumerate AD CS to find vulnerable certificate templates using Certipy.
- Request a certificate from the vulnerable template while specifying the Administrator's UPN.
- Authenticate using the issued certificate to impersonate the Domain Administrator.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Active Directory Certificate Services (AD CS) issues digital certificates that can be used to log in to Windows networks. If a certificate template lets any user ask for a certificate for someone else, that user can pretend to be an administrator. Here, a low-privileged user did exactly that and gained domain admin rights.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.