ENGINEERING

A fake IT-support call on Teams ended in domain admin. Check AD CS for ESC1 and ESC8

Someone in accounting gets a Teams message from “IT Support”. There’s a problem with their account, and IT can fix it if they just accept a Quick Assist session. They click Allow. (We spent years teaching users to trust the help desk. It works on attackers’ help desks too.)

That’s how the intrusions in Microsoft’s latest report on fake IT-support calls started. In two of them the attackers went from that one session to domain admin through Active Directory Certificate Services (AD CS), and they didn’t need an exploit. They used two settings a lot of us have and have never looked at. So there’s no patch to install this time. You have to find the settings yourself, and I went and did that in my lab.

It isn’t rare, either. According to SecureWorld, about 30% of the organizations Microsoft watched saw at least one fake IT-support attempt over Teams in the first half of the year.

The two settings

Both have names from SpecterOps’ 2021 Certified Pre-Owned research, which is still the best explanation of how AD CS gets abused.

ESC1, a certificate template that lets the requester say who they are. The template has “Supply in the request” turned on (in AD that’s the ENROLLEE_SUPPLIES_SUBJECT flag), the certificate is good for logging on (Client Authentication, Smart Card Logon, or no usage restriction at all), there’s no manager approval, and a broad group like Domain Users can enroll. Put those together and any user can ask the CA for a certificate that names a domain admin, and the CA issues it. In Microsoft’s first case, that’s the template the victim had (techinformed).

ESC8, CA Web Enrollment over plain HTTP with NTLM. The old /certsrv web page. If it answers over HTTP and accepts NTLM, an attacker can force a domain controller to authenticate to them (PetitPotam does it over EFSRPC) and relay that authentication to Web Enrollment. The CA then issues a certificate for the domain controller’s own machine account. That was Microsoft’s second case.

Both are configuration, which is why they hang around for years.

What we found in the lab

My lab domain controller is Server 2025 running an enterprise CA (corp-DC1-CA), the same one from the 802.1X certificate post. I wrote a read-only check, ran it from a member workstation as SYSTEM through RFF, and changed one setting at a time on the CA to see what it caught.

A template with “subject in request” isn’t ESC1 on its own. The lab already has one: a NAC device template where the requester supplies the subject, with Client Authentication in the usage. It looks exactly like ESC1. But only Domain Admins can enroll in it, so a normal user can’t use it, and the check left it alone. When I gave Domain Users the Enroll permission on that template, the check flagged it right away. When I took the permission away again, it went clean.

So the question isn’t only which templates allow subject in request. It’s which of those a low-privileged group can actually enroll in. Almost every template lets Authenticated Users read it. That’s normal, and reading isn’t enrolling. (My first version of the check got this wrong. It treated any bit of the “full control” mask as full control, so plain Read looked like Enroll, and it flagged the built-in Subordinate CA template. Full control means all of those bits are set, so that’s what the check looks for now.)

On Server 2025, Web Enrollment is locked down by default. I installed the Web Enrollment role fresh and looked at IIS. /certsrv came up with “Require SSL” on and Extended Protection for Authentication set to Require, and plain HTTP got a 403 with no login offered. That’s the safe setup, and it’s what Microsoft has recommended since PetitPotam in 2021 (KB5005413). An older CA, or one where someone turned SSL off to get enrollment working, is a different story. When I set the SSL requirement and Extended Protection back to off, /certsrv answered plain HTTP with a 401 offering Negotiate and NTLM, and the check flagged it as ESC8. Turning them back on cleared it.

This is the exposed state as an RFF job, run as SYSTEM on a workstation:

RFF job result on CLIENT2: Issue found. Web Enrollment over HTTP with NTLM on corp-DC1-CA, and the LabNACDevice template enrollable by Domain Users with the requester naming the subject

And after both fixes:

RFF job result on CLIENT2: No issue. HTTP to Web Enrollment refused with 403, no ESC1 template found

How to check yours

You don’t have to be on the CA for this. The templates and who can use them are stored in Active Directory, and any domain-joined PC can read them. For each template your CA publishes, look for all four of these together:

  1. “Supply in the request” on the Subject Name tab (msPKI-Certificate-Name-Flag has bit 0x1).
  2. A usage that can log on: Client Authentication, Smart Card Logon, PKINIT, Any Purpose, or no usage restriction.
  3. No “CA certificate manager approval” and no required authorized signatures.
  4. Enroll or Autoenroll for Domain Users, Domain Computers, Authenticated Users, Everyone or Users.

dsacls on the template object shows who can enroll:

dsacls "CN=<template>,CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,DC=corp,DC=contoso,DC=com"

Look for Allow <group> Enroll lines. On my safe template, only Domain Admins had Enroll.

Count Domain Computers as low-privileged too. By default any domain user can add up to ten computer accounts to the domain (ms-DS-MachineAccountQuota), so “only computers can enroll” doesn’t keep a determined user out.

For ESC8, browse to http://<your CA>/certsrv/ from a workstation. If it asks you to sign in over plain HTTP, it’s exposed. A 403, or no Web Enrollment at all, is what you want to see.

What to do

For an ESC1 template, any one of these breaks it: take Enroll away from the broad group (that’s the one I tested), require CA certificate manager approval, or turn off “Supply in the request” and build the subject from Active Directory. If the template exists for something that really needs the requester to supply the name, like web servers or network gear, limit Enroll to the accounts that request those certificates.

For ESC8, require SSL and Extended Protection on the /certsrv application in IIS. These are the two settings I turned back on:

Import-Module WebAdministration
Set-WebConfigurationProperty -PSPath 'IIS:\' -Location 'Default Web Site/CertSrv' `
  -Filter 'system.webServer/security/access' -Name sslFlags -Value 'Ssl'
Set-WebConfigurationProperty -PSPath 'IIS:\' -Location 'Default Web Site/CertSrv' `
  -Filter 'system.webServer/security/authentication/windowsAuthentication/extendedProtection' `
  -Name tokenChecking -Value 'Require'

Requiring SSL only works if the site has an HTTPS binding with a valid certificate. My lab CA didn’t have one, so I proved that plain HTTP gets refused, not that HTTPS enrollment works afterwards. If nobody uses the Web Enrollment pages (most enrollment goes through autoenrollment or certreq), removing the role is cleaner:

Uninstall-AdcsWebEnrollment -Force
Uninstall-WindowsFeature ADCS-Web-Enrollment

Removing IIS along with it needed a restart of the CA server.

For the front door, limit which outside organizations can chat with your users in Teams, and make sure people know how your real help desk will contact them. I didn’t test the Teams settings in the lab, so go by Microsoft’s current documentation for your tenant.

A clean result for these two doesn’t mean AD CS is hardened. There are a dozen more ESC paths (ESC2 through ESC16), and tools like Locksmith and Certipy check many of them. ESC1 and ESC8 are the two Microsoft just saw used, so they’re the two to close first.

Doing it with RFF

The RFF Script Library has a check for this: “AD CS takeover paths after a fake IT-support call (ESC1 templates, ESC8 Web Enrollment)”. It reads every published template and its permissions from Active Directory, tests each CA’s /certsrv over plain HTTP, and names anything exposed along with the group that can use it. It runs as SYSTEM from any domain-joined Windows machine, so run it on one workstation per forest, and again after anyone touches a template or the CA.

RFF is free for your first 100 endpoints: getrff.com.

One email per new post, nothing else. Unsubscribe in one click. Or use the RSS feed.

Comments

Comments use GitHub Discussions, so you'll need a GitHub account to post. Corrections are especially welcome.