NTLM Relay, Coercion and Signing
NTLM Step by Step ended with a flaw in the protocol: a response computed for one server's challenge is valid at any server that issued that challenge, so a machine in the middle can pass a victim's authentication on to a target of its choice. Relay turns that into an attack with two ingredients: a victim that authenticates to the attacker (tricked by name poisoning, a link to a file share, or coerced by an RPC call that makes a server authenticate back), and a target that accepts the relayed authentication without binding it to the session (no SMB signing, no LDAP signing, no channel binding, no Extended Protection). When the victim is a domain controller's computer account and the target is LDAP or AD CS web enrollment, a single relay can end in domain compromise. Every one of those ingredients has a setting that removes it. This lesson models which combinations work, how they are detected, and the order to fix them in.
Getting a victim to authenticate
- Name poisoning (LLMNR/NBT-NS/mDNS, rogue WPAD): users' machines authenticate to whoever answered (AD DNS and Name Poisoning).
- Links and files: a document, shortcut or library file pointing to
\\attacker\sharemakes Windows try SMB (or WebDAV over HTTP) with the user's credentials when the folder is opened. - Coercion: several RPC interfaces let any authenticated user ask a server to connect to a path the caller supplies, and the server authenticates with its computer account. Known examples: the Print Spooler's change-notification call (MS-RPRN, "PrinterBug"), the Encrypting File System RPC (MS-EFSR, "PetitPotam", CVE-2021-36942), DFS namespace management (MS-DFSNM) and the file-server VSS agent (MS-FSRVP). Calling any of these against a DC produces an authentication from
DC01$.
Impacket's ntlmrelayx is the best-known relay tool; Responder and Inveigh supply victims through poisoning; several small tools trigger the coercion calls. On the wire they all produce the same thing: NTLM authentications arriving from an address other than the machine named inside them.
Which relays work
The program encodes the protections a target can enforce and decides, per source protocol and target, whether a relayed authentication yields a usable session. The rules follow the protocols: SMB and LDAP signing need the session key the relay doesn't have; LDAPS channel binding and HTTP Extended Protection tie the authentication to the TLS channel the victim saw (the attacker's, not the target's); and an SMB client asks for signing in its NTLM flags, which a patched target protects with the message integrity code (MIC), so cross-protocol relay from SMB to LDAP fails unless the target is vulnerable to MIC removal (CVE-2019-1040, fixed in 2019).
def relay(source, target, t):
"""Return (works, reason) for relaying an authentication received over `source` to `target`."""
if target == "smb":
return (False, "target requires SMB signing") if t["smb_signing_required"] else (True, "unsigned SMB session")
if target == "ldap":
if t["ldap_signing_required"]:
return False, "DC requires LDAP signing"
if source == "smb" and t["mic_patched"]:
return False, "client asked for signing; MIC prevents removing the flag"
return True, "unsigned LDAP bind: can write to the directory"
if target == "ldaps":
return (False, "channel binding required") if t["ldaps_channel_binding"] else (True, "LDAPS without channel binding")
if target == "adcs-http":
if t["adcs_epa"] and t["adcs_https_only"]:
return False, "Extended Protection on HTTPS-only web enrollment"
return True, "certificate issued for the victim (ESC8)"
lab = {"smb_signing_required": False, "ldap_signing_required": False, "mic_patched": True,
"ldaps_channel_binding": False, "adcs_epa": False, "adcs_https_only": False}
hardened = {k: True for k in lab}
scenarios = [("smb", "smb", "poisoned user WS01 -> FS01"), ("smb", "ldap", "coerced FS01$ -> DC01 LDAP"),
("http", "ldap", "WebDAV from WS01 -> DC LDAP"), ("http", "ldaps", "WebDAV from WS01 -> DC LDAPS"),
("smb", "adcs-http", "coerced DC01$ -> CA01 web enrollment")]
for name, t in [("lab defaults", lab), ("hardened", hardened)]:
print(f"== {name}")
for src, dst, story in scenarios:
ok, why = relay(src, dst, t)
print(f" {'RELAY OK' if ok else 'blocked ':9} {story:38} {why}")== lab defaults
RELAY OK poisoned user WS01 -> FS01 unsigned SMB session
blocked coerced FS01$ -> DC01 LDAP client asked for signing; MIC prevents removing the flag
RELAY OK WebDAV from WS01 -> DC LDAP unsigned LDAP bind: can write to the directory
RELAY OK WebDAV from WS01 -> DC LDAPS LDAPS without channel binding
RELAY OK coerced DC01$ -> CA01 web enrollment certificate issued for the victim (ESC8)
== hardened
blocked poisoned user WS01 -> FS01 target requires SMB signing
blocked coerced FS01$ -> DC01 LDAP DC requires LDAP signing
blocked WebDAV from WS01 -> DC LDAP DC requires LDAP signing
blocked WebDAV from WS01 -> DC LDAPS channel binding required
blocked coerced DC01$ -> CA01 web enrollment Extended Protection on HTTPS-only web enrollment
The worst line in the lab is the last: a coerced DC authentication relayed to AD CS web enrollment returns a certificate for DC01$, which can then be used with PKINIT to get a TGT as the DC and from there replicate every secret. That chain (coercion + ESC8) was published in 2021 and is still found in assessments; AD CS Misconfigurations covers the CA side. The WebDAV-to-LDAP line is the other classic: an HTTP-borne authentication carries no signing request, so an unsigned LDAP bind on the DC lets the relay write attributes, for example msDS-AllowedToActOnBehalfOfOtherIdentity for an RBCD takeover (Delegation).
How relay and coercion are detected
- Name/IP mismatch: a 4624 (logon type 3, package NTLM) whose
Workstation NameisWS01but whoseSource Network Addressisn't WS01's address. The same for 4776 on DCs where the workstation is a DC (DC01) but the server forwarding the validation isn't one. - Machine accounts of DCs authenticating with NTLM to non-DC systems, or from addresses that aren't DCs; DCs should almost never use NTLM.
- Coercion RPC calls: on DCs and servers, 5145 (detailed file share) for named pipes
\spoolss,\efsrpc,\lsarpc,\netdfsopened by unusual clients, RPC Firewall or EDR telemetry for the specific operations; network sensors (Zeek's DCE/RPC log, Defender for Identity) flag the calls by operation name. - AD CS: 4886/4887 (certificate request received / issued) on the CA where the requester is a DC or server account and the request arrived over the web enrollment endpoint from a non-DC address.
- Honey shares: a UNC path in a decoy file that should never be followed; any authentication to it is an alert.
How it is fixed or prevented
In order of impact:
- SMB signing required on all servers and clients (Windows 11 24H2 Pro, Enterprise and Education require it by default for inbound and outbound connections, Windows Server 2025 for outbound ones, and DCs have long required it for inbound; set it explicitly everywhere).
- LDAP signing required and LDAPS channel binding on every DC (
LDAPServerIntegrity = 2,LdapEnforceChannelBinding = 2in Registry Settings); audit first with Directory Service events 2887/2889 and 3039–3041 to find clients that would break. - AD CS web enrollment: remove it if unused; otherwise HTTPS only with Extended Protection for Authentication and NTLM disabled on the IIS site.
- Stop coercion: disable the Print Spooler on DCs and every server that doesn't print; apply the EFSRPC and other coercion fixes; filter the RPC interfaces with RPC filters or a host firewall where possible.
- Starve the attacker of victims: LLMNR, NBT-NS and WPAD off; WebClient service disabled where WebDAV isn't needed.
- Reduce NTLM overall (Removing NTLM); Protected Users for admins.
Pitfalls
- "Signing enabled" in reports where "required" is needed. Only required stops relay.
- Fixing SMB and forgetting HTTP: Exchange, AD CS, SharePoint and many web apps accept NTLM over HTTP; each needs EPA or Kerberos-only.
- Patching coercion one CVE at a time. New coercion methods keep appearing; the durable fix is on the target side (signing, binding, EPA) plus not exposing unneeded RPC services.
- Relay to the victim itself is blocked for SMB since 2008 (MS08-068), so assessments sometimes conclude "relay doesn't work here" after testing only that case.
Practice
1. In the model, set only ldap_signing_required to True in the lab. Which scenarios still work?
SMB to FS01 (no SMB signing), WebDAV to LDAPS (no channel binding), and the AD CS relay. LDAP signing protects port 389 only; LDAPS needs channel binding.
2. Why does the relay of a coerced FS01$ authentication to LDAP on DC01 fail even in the lab model?
The coerced authentication arrives over SMB, whose client asks for signing in the NTLM negotiate flags; the patched DC verifies the MIC, so the relay can't drop the flag, and the LDAP session would need signing the relay can't do.
3. A 4624 on FS01: account DC01$, NTLM, source 10.10.0.66. List three checks.
What 10.10.0.66 is (in the lab, not a DC); whether DC01 logged a 5145 for \spoolss or \efsrpc from 10.10.0.66 just before (coercion); and what the session on FS01 did (file access, service creation). Then require SMB signing on FS01 and disable the spooler on DC01.
Test yourself
Which protection stops NTLM relay to SMB?
- SMB1
- SMB signing required on the target
- A longer password
- DNSSEC
What does coercion (PrinterBug, PetitPotam) give an attacker?
- A domain admin password
- An authentication from a server's computer account to a host the attacker chooses
- A Kerberos TGT for krbtgt
- Physical access
Which setting protects LDAPS against relay?
- LDAP signing
- LDAP channel binding
- Port 3268
- Anonymous bind
Which signal in a 4624 event suggests relay?
- Logon type 2
- The Workstation Name doesn't match the source network address
- Kerberos as the package
- Logon at 9:00