SMB Relay Attacks

What is SMB Relay?

SMB Relay is an advanced technique that builds on LLMNR/NBT-NS poisoning. Instead of cracking captured hashes, we relay those hashes to specific target machines to potentially gain access.

Key concept: Use captured authentication attempts to authenticate to other systems without needing to crack passwords.

Requirements

Critical Prerequisites

  • SMB signing must be disabled or not enforced on the target machine

  • Relayed user credentials must have admin privileges on the target machine for meaningful access

  • Target must be reachable over SMB (port 445)

Identifying Vulnerable Hosts

Use Nmap to scan for hosts without SMB signing:

nmap --script=smb2-security-mode.nse -p445 10.0.0.0/24

Look for output showing:

| smb2-security-mode:
|   3:1:1:
|_    Message signing enabled but not required

This indicates SMB signing is not enforced (vulnerable to relay).

Attack Steps

1. Identify Targets Without SMB Signing

Scan the network to find vulnerable machines:

2. Set Up Responder for Relay

Configure Responder to capture but not respond to SMB/HTTP:

Edit /etc/responder/Responder.conf:

Start Responder:

Expected output:

3. Run ntlmrelayx

Use Impacket's ntlmrelayx to relay captured hashes:

Where targets.txt contains IP addresses of vulnerable machines:

4. Successful Attack Examples

Example 1: SAM Dump Success

Example 2: Interactive Shell Access

Connect to interactive shell:

Example 3: Command Execution

Success output:

5. Post-Exploitation with Gained Credentials

Using Impacket PsExec for Direct Shell Access

Once you have valid credentials (from SAM dump or other means):

Using Metasploit PsExec Module

For a more advanced post-exploitation with Meterpreter:

Module Configuration:

Expected Results:

Common ntlmrelayx Options

Example Attack Flow

  1. Discovery:

  2. Create targets file:

  3. Configure Responder:

  4. Start attack (2 terminals):

  5. Wait for authentication or trigger it

  6. Connect to interactive shell (if using -i flag):

  7. Use captured credentials for further exploitation:

Error Messages to Watch For

Mitigation

Primary Defenses

  • Enable SMB signing on all systems (required, not optional)

  • Disable LLMNR and NBT-NS (prevents initial hash capture)

  • Network segmentation to limit relay scope

SMB Signing Configuration

Via Group Policy:

  • Computer Configuration > Policies > Windows Settings > Security Settings > Local Policies > Security Options

  • Set "Microsoft network client: Digitally sign communications (always)" to Enabled

  • Set "Microsoft network server: Digitally sign communications (always)" to Enabled

Additional Measures

  • Least privilege principle - limit admin accounts

  • Account separation - don't use admin accounts for daily tasks

  • Monitor SMB traffic for unusual relay patterns

  • Use LAPS (Local Administrator Password Solution) for unique local admin passwords

Key Points for PJPT

  • SMB Relay is more dangerous than hash cracking (direct access vs. offline cracking)

  • SMB signing is the primary defense - always check this first

  • Requires admin privileges on target for meaningful access

  • Often combined with LLMNR poisoning for initial hash capture

  • Can lead to domain compromise if domain admin credentials are relayed

  • Success = "SUCCEED" message in ntlmrelayx output

  • Interactive shells provide direct file system access

  • SAM dumps give you local account hashes for further attacks

  • Metasploit psexec provides advanced post-exploitation with Meterpreter

  • Multiple tools available: Impacket psexec vs Metasploit psexec module

Tools Summary

  • nmap - Identify hosts without SMB signing

  • Responder - Capture authentication attempts (with SMB/HTTP disabled)

  • ntlmrelayx (Impacket) - Relay captured hashes

  • psexec.py (Impacket) - Use captured credentials for shell access

  • exploit/windows/smb/psexec (Metasploit) - Advanced exploitation with Meterpreter

  • netcat (nc) - Connect to interactive shells from ntlmrelayx

  • targets.txt - List of vulnerable target IPs

Last updated