AD CS Certificate Template Checker
A single certificate template that lets any domain user type whose name goes in the certificate is enough to become a Domain Admin. Active Directory Certificate Services hides a dozen settings like that, catalogued as ESC1 to ESC16. Run a few read-only commands that ship with Windows, paste the output, and see which templates, CAs and domain controllers are exposed, with the exact flags and the fix.
Defender tool: no third-party scripts, nothing installed, nothing uploaded. Only check a domain you run or have written permission to assess. New to AD CS attacks? Read AD CS attacks (ESC1-ESC16) explained for defenders.
Chapters (5)
1. Run these read-only commands on your own domain
All of them are built into Windows: nothing to download or install beyond the ActiveDirectory PowerShell module (part of RSAT). They read settings and change nothing. The first two work as a normal domain user; the CA and domain controller ones need an administrator on those servers. Every one is optional: what you skip shows as not checked.
Where: Any domain-joined PC, as a normal domain user (ActiveDirectory PowerShell module, part of RSAT)
$cfg = (Get-ADRootDSE).configurationNamingContext
Get-ADObject -SearchBase "CN=Certificate Templates,CN=Public Key Services,CN=Services,$cfg" -LDAPFilter '(objectClass=pKICertificateTemplate)' -Properties name,'msPKI-Certificate-Name-Flag','msPKI-Enrollment-Flag','msPKI-RA-Signature',pKIExtendedKeyUsage,'msPKI-Certificate-Application-Policy','msPKI-Template-Schema-Version',nTSecurityDescriptor |
ForEach-Object { [pscustomobject]@{
name=$_.name; nameFlag=$_.'msPKI-Certificate-Name-Flag'; enrollFlag=$_.'msPKI-Enrollment-Flag'; raSignature=$_.'msPKI-RA-Signature'
eku=@($_.pKIExtendedKeyUsage); appPolicy=@($_.'msPKI-Certificate-Application-Policy'); schema=$_.'msPKI-Template-Schema-Version'
owner="$($_.nTSecurityDescriptor.Owner)"
acl=@($_.nTSecurityDescriptor.Access | ForEach-Object { [pscustomobject]@{ id="$($_.IdentityReference)"; rights="$($_.ActiveDirectoryRights)"; objectType="$($_.ObjectType)"; type="$($_.AccessControlType)" } })
} } | ConvertTo-Json -Depth 4Reads template settings and permissions only; changes nothing. Install the module with "Add-WindowsCapability -Online -Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0" (Windows) if Get-ADObject is missing.
Where: Any domain-joined PC, as a normal domain user
$cfg = (Get-ADRootDSE).configurationNamingContext
Get-ADObject -SearchBase "CN=Enrollment Services,CN=Public Key Services,CN=Services,$cfg" -LDAPFilter '(objectClass=pKIEnrollmentService)' -Properties name,dNSHostName,certificateTemplates |
ForEach-Object { [pscustomobject]@{ ca=$_.name; host=$_.dNSHostName; certificateTemplates=@($_.certificateTemplates) } } | ConvertTo-Json -Depth 3Where: On each CA server, as a local administrator (or add -config "<host>\<CA name>" from an admin workstation)
certutil -getreg policy\EditFlags certutil -getreg CA\InterfaceFlags certutil -getreg policy\DisableExtensionList certutil -getreg CA\Security
-getreg only reads the registry. Paste the output exactly as printed. "The system cannot find the file specified" for DisableExtensionList means the value is not set (fine).
Where: On each CA server (Windows Server)
Get-WindowsFeature ADCS-Web-Enrollment, ADCS-Enroll-Web-Svc | Select-Object @{n='computer';e={$env:COMPUTERNAME}}, Name, @{n='InstallState';e={"$($_.InstallState)"}} | ConvertTo-JsonWhere: On each domain controller
[pscustomobject]@{ computer=$env:COMPUTERNAME
StrongCertificateBindingEnforcement=(Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Services\Kdc' -ErrorAction SilentlyContinue).StrongCertificateBindingEnforcement
CertificateMappingMethods=(Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\Schannel' -ErrorAction SilentlyContinue).CertificateMappingMethods } | ConvertTo-JsonEmpty (null) values mean the setting is not configured, so the Windows default applies.
2. Paste or drop the output
Paste several outputs one after another, or drop saved files. Each one is recognised from its content. Nothing leaves your browser.
Loading…
Sample report · illustrative data
Sample result: AD CS findings for a made-up domain
Template and CA output from a fictional corp.example domain: eight certificate templates with their permissions, the CA's published templates, certutil -getreg output from the CA, the web enrolment roles and one domain controller's mapping settings.
Score
- Score
- 17 / 100 (PlayCISO measure, not an audit)
- Checks
- 2 pass, 8 fail, 2 to confirm
- Start with
- ESC1: requesters can name any user on an authentication template
Findings (excerpt)
| ESC | Where | What was seen | Severity |
|---|---|---|---|
| ESC1 | CorpVPNUser | Supply in the request; Client Authentication; no approval; Enroll for Domain Users | Critical |
| ESC3 | SmartcardAgent | Certificate Request Agent EKU; Enroll for Domain Users (by SID ...-513) | High |
| ESC4 | SecureEmailV2 | Domain Users hold WriteDacl on the template | Critical |
| ESC6 | CORP-CA01 | EditFlags 0x15014E includes EDITF_ATTRIBUTESUBJECTALTNAME2 | High |
| ESC9 | WorkstationAuth | CT_FLAG_NO_SECURITY_EXTENSION on a Client Authentication template; Enroll for Domain Computers | High |
| ESC10 | DC01 | StrongCertificateBindingEnforcement = 1 (compatibility mode) | High |
| ESC11 | CORP-CA01 | InterfaceFlags 0x441 without IF_ENFORCEENCRYPTICERTREQUEST | High |
| ESC15 | LegacyWebServer | Schema version 1; Supply in the request; Enroll for Authenticated Users | High |
| ESC8 | CA01 | Certificate Authority Web Enrollment installed: confirm HTTPS and EPA | Confirm |
First fixes
- CorpVPNUser: switch the subject to "Build from this Active Directory information" and limit Enroll to the VPN users group.
- SecureEmailV2: remove WriteDacl from Domain Users; set the owner to the PKI admins.
- CORP-CA01: certutil -setreg policy\EditFlags -EDITF_ATTRIBUTESUBJECTALTNAME2 and +IF_ENFORCEENCRYPTICERTREQUEST on CA\InterfaceFlags, then restart certsvc.
- DC01: install current updates and remove StrongCertificateBindingEnforcement so Full Enforcement applies (KB5014754).
- OldAnyPurpose is not published by any CA: delete it before someone publishes it.
Made-up example data. Your own run uses your inputs. Downloads of the full report need Pro.
TL;DRWhat this checker does
5 points
- Finds the Active Directory Certificate Services (AD CS) misconfigurations known as ESC1 to ESC16 in your own domain: templates anyone can use to get a certificate as an admin, templates broad groups can edit, risky CA flags and weak certificate mapping on domain controllers.
- You run short, read-only commands that are built into Windows (PowerShell Get-ADObject, certutil -getreg, Get-ItemProperty, Get-WindowsFeature) and paste the output. Nothing to download or install, and every input is optional.
- Each check shows pass, fail, needs your confirmation or not checked, with the exact flags and rights it saw, the severity, and the fix.
- Templates that no CA publishes are marked and ranked last. A "Hide domain names" switch makes the result safe to screenshot.
- Runs entirely in your browser: nothing is uploaded and no connection is made to your domain.
The twelve checks and their evidence
| ESC | Evidence from | What we look for |
|---|---|---|
| ESC1 | Templates | "Supply in the request" + authentication EKU (or none) + no approval + no signatures + Enroll for a broad group |
| ESC2 | Templates | Any Purpose EKU or no EKU, open to broad groups without approval |
| ESC3 | Templates | Certificate Request Agent EKU open to broad groups without approval |
| ESC4 | Template ACL | Broad groups with GenericAll, GenericWrite, WriteDacl, WriteOwner or WriteProperty, or owning the template |
| ESC6 | certutil policy\EditFlags | EDITF_ATTRIBUTESUBJECTALTNAME2 (0x40000) on a CA |
| ESC7 | certutil CA\Security | Broad groups with Manage CA or Manage Certificates (best effort, then confirm) |
| ESC8 | Get-WindowsFeature + you | Web enrolment installed without HTTPS and Extended Protection |
| ESC9 | Templates | CT_FLAG_NO_SECURITY_EXTENSION (0x80000) on an authentication template |
| ESC10 | DC registry | StrongCertificateBindingEnforcement 0 or 1, or the weak UPN bit (0x4) in CertificateMappingMethods |
| ESC11 | certutil CA\InterfaceFlags | IF_ENFORCEENCRYPTICERTREQUEST (0x200) turned off |
| ESC15 | Templates | Schema version 1 + "Supply in the request" + broad Enroll (CVE-2024-49019, fixed November 2024) |
| ESC16 | certutil policy\DisableExtensionList | SID extension 1.3.6.1.4.1.311.25.2 disabled for the whole CA |
How to read the result
Broad groups are Domain Users, Domain Computers, Authenticated Users, Everyone, Users and the guest groups, by name or by their well-known SIDs (S-1-5-11, S-1-1-0, RIDs 513 and 515, S-1-5-32-545). Enrol rights are the Certificate-Enrollment and Certificate-AutoEnrollment extended rights, an extended right on all objects, or full control.
A template only matters if a CA publishes it. Paste the CA listing too: affected templates that no CA publishes are kept in the report at low severity and do not fail a check. Deny entries are flagged but not subtracted, so check those templates by hand.
Fix with care: templates and CA settings are shared by everything that enrols. Change them in a maintenance window, test with a pilot group and watch the CA audit events (4886, 4887, 4899, 4900) and the domain controllers' Kdcsvc events 39 and 41 afterwards. Related practice: the Kerberos Attack Lab, the PKI Hierarchy Lab and the Rogue Listener Credential Exposure Checklist for the NTLM relay side of ESC8 and ESC11.
Sources used
- Microsoft Defender for Identity: certificate security posture assessments (ESC1-ESC4, ESC6-ESC8, ESC11, ESC15)
- [MS-CRTD] msPKI-Certificate-Name-Flag
- [MS-CRTD] msPKI-Enrollment-Flag
- Certificate-Enrollment extended right
- KB5014754: certificate-based authentication changes on domain controllers
- KB5005413: mitigating NTLM relay attacks on AD CS
- CVE-2024-49019 (Microsoft Security Response Center)
- SpecterOps: "Certified Pre-Owned" whitepaper (ESC1-ESC8)
Frequently asked questions
What is ESC1 in AD CS?
ESC1 is a certificate template that lets the requester type the subject of the certificate ("Supply in the request"), is good for logging on (Client Authentication, PKINIT, Smart Card Logon, Any Purpose or no EKU), needs no manager approval or authorised signature, and can be requested by a broad group such as Domain Users. Anyone in that group can then ask for a certificate in an administrator's name and log on as that administrator.
Does this tool attack or scan my domain?
No. It makes no connection to your network and runs no offensive tool. You run read-only commands that are built into Windows and paste the output; the page reads it in your browser and never uploads it. Only check a domain you run, or one you have written permission to assess.
Which permissions do the commands need?
The two template and CA listing commands work as an ordinary domain user, because authenticated users can read certificate templates and their permissions in Active Directory. The certutil commands read the CA's registry and need an administrator on the CA (or the -config option from an admin workstation). The domain controller command needs an administrator on that DC.
Why does a template show as fine although it has "Supply in the request"?
Supply in the request is only dangerous together with an authentication EKU, no approval, no authorised signature and enrolment by a broad group. A web server template that only Domain Admins can request, or that issues Server Authentication certificates only, is not ESC1. Version 1 templates with Supply in the request are listed separately under ESC15 (CVE-2024-49019) on unpatched CAs.
Why are ESC7 and ESC8 often "Confirm"?
Who holds Manage CA and Manage Certificates is printed by certutil in a format we read by keywords only, and web enrolment's IIS settings (HTTPS and Extended Protection) cannot be seen from Active Directory. The tool shows what it found and asks you to confirm on the CA; a confirmed item counts toward the score.
Do I still need to fix ESC6 if strong certificate mapping is enforced?
Yes. Strong mapping from KB5014754 stops most ESC6 abuse, but not where the SID extension is left out of certificates (ESC9 on a template, ESC16 on a whole CA), and the flag lets anyone put names of their choosing in certificates. Turn it off unless you have a documented need.
Is the score an audit result?
No. It is a PlayCISO measure of the evidence you pasted: checks that pass or that you confirmed, out of twelve. It does not cover ESC5, ESC12, ESC13 or ESC14, which need other evidence.
More tools like this
Related tools and labs, with new picks every day.