ADCS ESC13: Find Certificate Templates That Grant Group Membership

ADCS ESC13 is a certificate template whose issuance policy is linked to an AD group. Anyone who signs in with a certificate from that template is treated as a member of the group, without ever being added to it. It's a real Windows feature, meant to grant extra access only to people using a smart card. It becomes a problem when broad groups can enroll. This post shows you how to find every linked policy, check what each group can do and narrow who gets it.

Privileged Access & Permissions High 10 min read
PriorityHigh. Enrolling in the template can potentially grant a privileged group's access to any enrollee
What decides itAn issuance policy with msDS-OIDToGroupLink set, on a published sign-in template that broad groups can enroll in without approval
Who's affectedForests that use Authentication Mechanism Assurance, or where a policy was linked to a group and forgotten
FixLimit enrollment to the people meant to get the group, require approval, or remove the link if nothing uses it

Check it now: are any issuance policies linked to a group?

PowerShell
Import-Module ActiveDirectory -ErrorAction Stop
$pks = "CN=Public Key Services,CN=Services,$((Get-ADRootDSE).configurationNamingContext)"
$templates = Get-ADObject -SearchBase "CN=Certificate Templates,$pks" -LDAPFilter '(msPKI-Certificate-Policy=*)' -Properties msPKI-Certificate-Policy
Get-ADObject -SearchBase "CN=OID,$pks" -LDAPFilter '(msDS-OIDToGroupLink=*)' -Properties displayName, msPKI-Cert-Template-OID, msDS-OIDToGroupLink |
    ForEach-Object {
        $oid = $_.'msPKI-Cert-Template-OID'
        [pscustomobject]@{
            Policy      = $_.displayName
            Group       = ($_.'msDS-OIDToGroupLink' -split ',')[0] -replace '^CN='
            UsedBy      = ($templates | Where-Object { $_.'msPKI-Certificate-Policy' -contains $oid }).Name -join ', '
        }
    }

Runs as any domain user with the ActiveDirectory module. It lists every issuance policy linked to a group, the group and the templates that use the policy. No output means nothing in your forest uses this feature, so ESC13 can't apply. The scripts below show who can enroll and what each group can do.

You checked one setting. The free scan checks the rest of your on-prem AD in a few minutes.

Nothing gets installed on your domain controllers. Only HTTPS leaves your network.

What ADCS ESC13 is

An issuance policy is a label a template can stamp into its certificates, such as "issued on a smart card after an ID check." In AD, each policy is an object in the forest's OID container. Microsoft's schema reference describes msDS-OIDToGroupLink as the attribute that "identifies the group object that corresponds to the issuance policy represented by this OID."

That link powers a Windows feature called Authentication Mechanism Assurance. Microsoft's step-by-step guide says it "adds an administrator-designated global group membership to a user's Kerberos token" when the user signs in with a certificate. For example, you can grant a group access to Tier 0 systems, then link it to your smart card policy. Admins then only get that access when they sign in with the smart card. The guide calls it a global group. Its setup script goes further and requires a universal security group with no members.

SpecterOps named the misuse of this ESC13 in their 2024 ESC13 research. A template is ESC13 when it carries a group-linked policy, allows sign-in and lets someone enroll who shouldn't get that group's access.

Why ADCS ESC13 is dangerous

Enrollment becomes group membership

SpecterOps puts it plainly: AD treats "principals authenticating with a certificate of this template as members of the group." So anyone who can enroll can sign in with the certificate and get a Kerberos ticket that includes the group. They never show up in the group's member list. MITRE ATT&CK tracks this as T1649, Steal or Forge Authentication Certificates.

The group usually exists to grant something important

Nobody links a policy to a group for low-value access. The whole point of the feature is to gate sensitive access behind a strong sign-in. So the linked group often has rights on Tier 0 systems, or sits inside a privileged group. If Domain Users can enroll in the template, that access potentially belongs to every user.

Membership reviews won't show it

The linked group is empty by design. A review of privileged group members, or a tool that lists who's in each group, shows nobody. The access only appears in the Kerberos ticket at sign-in. SpecterOps also notes there's no generic way to tell a malicious use apart from a legitimate one in the logs.

How ADCS ESC13 works: enrolling in a template with a group-linked policy puts that group in the user's ticket
How a linked issuance policy turns enrollment into group membership. Tap to enlarge.

Find ESC13 in your forest

Issuance policies and templates live in the forest's Configuration partition, so these scripts cover the whole forest. They run as any domain user with the AD module.

List ADCS ESC13 templates and who can enroll

For every template that carries a group-linked policy, this shows the group it grants, whether it allows sign-in, whether approval is required, which CAs publish it and who can enroll.

PowerShell
Import-Module ActiveDirectory -ErrorAction Stop
$pks = "CN=Public Key Services,CN=Services,$((Get-ADRootDSE).configurationNamingContext)"
# Everyone, NETWORK, INTERACTIVE, Anonymous, Authenticated Users, This Organization, Users
$low = 'S-1-1-0', 'S-1-5-2', 'S-1-5-4', 'S-1-5-7', 'S-1-5-11', 'S-1-5-15', 'S-1-5-32-545'
# Domain Users, Domain Guests and Domain Computers of any domain
$lowRid = '^S-1-5-21-\d+-\d+-\d+-51[345]$'
$enroll = [guid]'0e10c968-78fb-11d2-90d4-00c04f79dc55'
$auth = '1.3.6.1.5.5.7.3.2', '1.3.6.1.4.1.311.20.2.2', '1.3.6.1.5.2.3.4', '2.5.29.37.0'
$links = @{}
Get-ADObject -SearchBase "CN=OID,$pks" -LDAPFilter '(msDS-OIDToGroupLink=*)' -Properties msPKI-Cert-Template-OID, msDS-OIDToGroupLink |
    ForEach-Object { $links[$_.'msPKI-Cert-Template-OID'] = $_.'msDS-OIDToGroupLink' }
$cas = Get-ADObject -SearchBase "CN=Enrollment Services,$pks" -LDAPFilter '(objectClass=pKIEnrollmentService)' -Properties certificateTemplates
Get-ADObject -SearchBase "CN=Certificate Templates,$pks" -LDAPFilter '(msPKI-Certificate-Policy=*)' -Properties msPKI-Certificate-Policy, pKIExtendedKeyUsage, msPKI-Enrollment-Flag, msPKI-RA-Signature, nTSecurityDescriptor |
    ForEach-Object {
        $t = $_
        $groups = $t.'msPKI-Certificate-Policy' | Where-Object { $links.ContainsKey($_) } | ForEach-Object { ($links[$_] -split ',')[0] -replace '^CN=' }
        if (-not $groups) { return }
        $ekus = @($t.pKIExtendedKeyUsage)
        $enrollers = $t.nTSecurityDescriptor.GetAccessRules($true, $true, [System.Security.Principal.SecurityIdentifier]) |
            Where-Object {
                $_.AccessControlType -eq 'Allow' -and (
                    (($_.ActiveDirectoryRights -band [System.DirectoryServices.ActiveDirectoryRights]::GenericAll) -eq [System.DirectoryServices.ActiveDirectoryRights]::GenericAll) -or
                    ((($_.ActiveDirectoryRights -band [System.DirectoryServices.ActiveDirectoryRights]::ExtendedRight) -ne 0) -and
                     ($_.ObjectType -eq $enroll -or $_.ObjectType -eq [guid]::Empty)))
            } |
            ForEach-Object {
                $sid = $_.IdentityReference
                try { $name = $sid.Translate([System.Security.Principal.NTAccount]).Value } catch { $name = $sid.Value }
                if ($sid.Value -in $low -or $sid.Value -match $lowRid) { "$name (low privilege)" } else { $name }
            }
        [pscustomobject]@{
            Template    = $t.Name
            Grants      = $groups -join ', '
            SignIn      = $ekus.Count -eq 0 -or @($ekus | Where-Object { $_ -in $auth }).Count -gt 0
            Approval    = [bool]($t.'msPKI-Enrollment-Flag' -band 2) -or [int]$t.'msPKI-RA-Signature' -gt 0
            PublishedOn = ($cas | Where-Object { $_.certificateTemplates -contains $t.Name }).Name -join ', '
            Enrollers   = ($enrollers | Sort-Object -Unique) -join '; '
        }
    }

What to look for: rows where SignIn is True, Approval is False, PublishedOn isn't empty and Enrollers includes anyone who shouldn't get the group in Grants. An entry marked (low privilege) is the worst case.

Check what each linked group can do

This shows each linked group's scope, member count, adminCount and the groups it's nested in.

PowerShell
Import-Module ActiveDirectory -ErrorAction Stop
$pks = "CN=Public Key Services,CN=Services,$((Get-ADRootDSE).configurationNamingContext)"
Get-ADObject -SearchBase "CN=OID,$pks" -LDAPFilter '(msDS-OIDToGroupLink=*)' -Properties msDS-OIDToGroupLink |
    ForEach-Object {
        $g = Get-ADGroup -Identity $_.'msDS-OIDToGroupLink' -Properties memberOf, adminCount, GroupScope, member
        [pscustomobject]@{
            Group      = $g.Name
            Scope      = $g.GroupScope
            Members    = @($g.member).Count
            AdminCount = $g.adminCount
            # Groups this one is nested in, which its holders also get
            MemberOf   = ($g.memberOf | ForEach-Object { ($_ -split ',')[0] -replace '^CN=' }) -join ', '
        }
    }

What to look for: an adminCount of 1, or any privileged group in MemberOf. Either one means the group carries admin rights. Every enrollee would get them too. Then check the group's direct permissions on servers and in AD. A Members count above 0 means the link isn't set up the way Microsoft's guide expects.

Check ADCS ESC13 with Insight Recon

The free scan includes Certificate Template Grants Group Membership via Issuance Policy in ADCS (ESC13), a High check. It finds every issuance policy linked to a group. Then it lists published templates that carry one of those policies and allow sign-in, with no approval or authorized signature required. A broad group also has to hold Enroll, all extended rights or full control. Broad groups here are Everyone, Anonymous, Authenticated Users, NETWORK, INTERACTIVE, This Organization and Users. Domain Users, Domain Guests and Domain Computers from any domain count too. It also honors deny entries on the template. Owners and accounts that can only edit the template show up under ESC4 instead. Each template names the group its policy links to. The finding is Critical when that group is Administrators, Domain Admins, Enterprise Admins or Schema Admins, or is nested inside one of them. If the scan can't confirm that, because it couldn't read every membership or the group is in another domain, it says so and keeps the finding at High. If no policy in the forest is linked to a group, the check passes. It also comes with the Hacker Insight, remediation steps and compliance mappings.

Know what the ADCS ESC13 check doesn't decide

Some things are still yours to check. The check only rates the linked group by its membership. It doesn't look at what the group can do through permissions, like DCSync rights or local admin on servers, so run the group script. Membership in other privileged groups, such as Account Operators or Backup Operators, doesn't raise the rating either. The check skips templates no CA publishes. If it can't read a CA's template list, it treats every template as published, so it may list one nobody can request right now. When unpublished templates would match, a note on the result says how many. They show up in the script above with an empty PublishedOn. A custom group with many members won't count as low privilege, so check the Enrollers column yourself.

Related ADCS checks beyond ESC13

  • User-controlled certificate template subject in ADCS (ESC1), a different way a template can hand out access. Our ADCS ESC1 post covers it.
  • Unrestricted certificate template modification rights in ADCS (ESC4), templates that broad groups can rewrite to add a linked policy. Our ADCS ESC4 post covers it.
  • Vulnerable PKI Object Access Control in ADCS (ESC5), which includes write access to the OID container where the links live. Our ADCS ESC5 post covers it.

You can see what the findings look like in our sample report. The full list is in our check library.

Find every template that grants group membership, plus the other ADCS attack paths.

It runs from any Windows machine that can reach your DCs, with a standard domain account. Every core AD check is free for one domain.

Before you change a linked policy

Find out whether the link is in use on purpose. Then decide who should get the group and narrow enrollment to them.

Find out whether it's intentional

If your organization uses Authentication Mechanism Assurance, the link is deliberate. Removing it would cut off the access it was built to grant. Instead, narrow enrollment. If nobody knows why the link exists, check what the group has access to before you change anything. An unexplained link on a broadly enrollable template is worth treating as a possible compromise.

Pick the fix that fits

SpecterOps recommends most of these:

  • Narrow who can enroll to the people meant to get the group. This is the main fix when the feature is in use.
  • Require CA certificate manager approval on templates linked to privileged groups.
  • Remove the link if nothing depends on it.
  • Limit who can change templates and issuance policies to Tier 0 admins. That way nobody can add a link later.

Save the current settings

Note the template's permissions and the policy's current link so you can put them back. The scripts below print or save both before they change anything.

Fix ADCS ESC13 safely

ADCS ESC13 fix order: check the group, narrow enrollment, require approval or unlink, then watch
The order for fixing ESC13. Tap to enlarge.

Each script below is a dry run with -WhatIf. Drop that to apply. They need Enterprise Admins, or rights delegated on the template or policy object. Change SmartcardTier0 and Tier0 Smartcard Policy to your names.

1. Narrow who can enroll

This removes Enroll and Autoenroll for the broad groups and keeps their Read access. It saves the current permissions to a file first. It warns about entries that combine Enroll with other rights, which you fix on the template's Security tab. Before you apply it, give Enroll to the group of people who should get the linked group's access.

PowerShell
# Dry run. Drop -WhatIf to apply.
# Needs Enterprise Admins, or permission to change the template's security.
Import-Module ActiveDirectory -ErrorAction Stop
$pks = "CN=Public Key Services,CN=Services,$((Get-ADRootDSE).configurationNamingContext)"
$t = Get-ADObject -SearchBase "CN=Certificate Templates,$pks" -LDAPFilter '(cn=SmartcardTier0)'
if (-not $t) { throw 'Template not found.' }
$low = 'S-1-1-0', 'S-1-5-2', 'S-1-5-4', 'S-1-5-7', 'S-1-5-11', 'S-1-5-15', 'S-1-5-32-545'
$lowRid = '^S-1-5-21-\d+-\d+-\d+-51[345]$'
$enrollRights = [guid]'0e10c968-78fb-11d2-90d4-00c04f79dc55', [guid]'a05b8cc2-17bc-4802-a710-e7c15ab866a2', [guid]::Empty
$path = "AD:$($t.DistinguishedName)"
$acl = Get-Acl -Path $path -ErrorAction Stop
# Saves the current permissions so you can put them back
$acl.Sddl | Set-Content -Path ".\$($t.Name)-acl.sddl"
foreach ($ace in $acl.GetAccessRules($true, $false, [System.Security.Principal.SecurityIdentifier])) {
    if ($ace.AccessControlType -ne 'Allow' -or ($ace.IdentityReference.Value -notin $low -and $ace.IdentityReference.Value -notmatch $lowRid)) { continue }
    if ($ace.ActiveDirectoryRights -eq 'ExtendedRight' -and $ace.ObjectType -in $enrollRights) {
        [void]$acl.RemoveAccessRuleSpecific($ace)
    } elseif ($ace.ActiveDirectoryRights -band [System.DirectoryServices.ActiveDirectoryRights]::ExtendedRight) {
        Write-Warning "$($ace.IdentityReference) holds Enroll combined with other rights. Fix it on the template's Security tab."
    }
}
Set-Acl -Path $path -AclObject $acl -ErrorAction Stop -WhatIf

2. Require approval on privileged templates

This turns on CA certificate manager approval. Every request then waits for a person. It prints the current value first. To undo it, set the flag back to that value.

PowerShell
# Dry run. Drop -WhatIf to apply.
# Needs Enterprise Admins, or write rights on the template object.
Import-Module ActiveDirectory -ErrorAction Stop
$pks = "CN=Public Key Services,CN=Services,$((Get-ADRootDSE).configurationNamingContext)"
$t = Get-ADObject -SearchBase "CN=Certificate Templates,$pks" -LDAPFilter '(cn=SmartcardTier0)' -Properties msPKI-Enrollment-Flag
if (-not $t) { throw 'Template not found.' }
Write-Output ("Current msPKI-Enrollment-Flag: 0x{0:X}" -f $t.'msPKI-Enrollment-Flag')
# 0x2 is CT_FLAG_PEND_ALL_REQUESTS: every request waits for a certificate manager
Set-ADObject -Identity $t -Replace @{ 'msPKI-Enrollment-Flag' = ($t.'msPKI-Enrollment-Flag' -bor 2) } -ErrorAction Stop -WhatIf

3. Remove links nothing uses

This clears the group link from one issuance policy. It prints the current link first. To undo it, set msDS-OIDToGroupLink back to the printed value with Set-ADObject -Replace. Certificates already issued keep the policy. Without the link, they no longer grant the group.

PowerShell
# Dry run. Drop -WhatIf to apply.
# Needs Enterprise Admins. Only do this if nothing relies on the group for access control.
Import-Module ActiveDirectory -ErrorAction Stop
$pks = "CN=Public Key Services,CN=Services,$((Get-ADRootDSE).configurationNamingContext)"
$policy = Get-ADObject -SearchBase "CN=OID,$pks" -LDAPFilter '(displayName=Tier0 Smartcard Policy)' -Properties msDS-OIDToGroupLink
if (-not $policy) { throw 'Issuance policy not found.' }
Write-Output "Current link: $($policy.'msDS-OIDToGroupLink')"
Set-ADObject -Identity $policy -Clear 'msDS-OIDToGroupLink' -ErrorAction Stop -WhatIf

4. Revoke certificates you can't explain

Certificates already issued from the template keep granting the group while the link exists. Review who holds them on the CA. Then revoke any you can't explain with certutil -revoke and publish a new CRL with certutil -crl.

Keep ADCS ESC13 closed

  • Watch the OID container. Audit changes there with Audit Directory Service Changes (event 5136). A new msDS-OIDToGroupLink value is how ESC13 starts.
  • Watch template changes. A template that gains a linked policy, or broad Enroll rights, needs a look.
  • Baseline certificate sign-ins. SpecterOps recommends collecting enrollment and certificate sign-in events to spot unusual use.
  • Re-run the scan. It flags the template again if broad groups can enroll.

ADCS ESC13 checklist

  • Do you know why each issuance policy is linked to a group?
  • Can only the intended people enroll in templates that carry a linked policy?
  • Do templates linked to privileged groups require approval?
  • Have you removed links that nothing depends on?
  • Is every linked group empty, as Microsoft's guide expects?
  • Can only Tier 0 admins change templates and issuance policies?
  • Did you revoke certificates you can't explain?

A "no" on the second question means someone outside the intended group can potentially get its access by enrolling.

Compliance mapping

FrameworkReferenceWhy it applies
MITRE ATT&CKT1649Steal or Forge Authentication Certificates. A certificate from the template adds a group to the holder's Kerberos ticket.
CIS Controls v8Control 4, Control 6Secure configuration of enterprise assets and access control management. Group access should only go to the intended people.
NIST CSF 2.0PR.AA-05Access permissions follow least privilege. A broadly enrollable linked template hands a group's access to anyone.

ADCS ESC13 FAQ

What is ADCS ESC13?

A template whose issuance policy is linked to an AD group, which broad groups can enroll in. Signing in with its certificate puts the group in the user's ticket.

Is linking a policy to a group a bad idea?

No. It's how Authentication Mechanism Assurance works. It only becomes ESC13 when the wrong people can enroll.

Why doesn't the group show any members?

Microsoft's setup requires the linked group to be empty. Access comes from the certificate at sign-in rather than from membership.

Does removing the link break existing certificates?

They keep working for sign-in. They just stop granting the group.

Does Insight Recon check for ADCS ESC13?

Yes. The free scan includes Certificate Template Grants Group Membership via Issuance Policy in ADCS (ESC13), along with the other ADCS checks.

See whether any of your templates hand out group access to everyone.

It runs from any Windows machine that can reach your DCs, with a standard domain account. Every core AD check is free for one domain.

Not ready to scan?

AD Signal is our monthly look at what's changing in AD security and how real domains score. Read the latest report.

References