Adversary-in-the-Middle: LLMNR/NBT-NS Poisoning and SMB Relay

By responding to LLMNR/NBT-NS network traffic, adversaries may spoof an authoritative source for name resolution to force communication with an adversary controlled system. This activity may be used to collect or relay authentication materials.

Link-Local Multicast Name Resolution (LLMNR) and NetBIOS Name Service (NBT-NS) are Microsoft Windows components that serve as alternate methods of host identification. LLMNR is based upon the Domain Name System (DNS) format and allows hosts on the same local link to perform name resolution for other hosts. NBT-NS identifies systems on a local network by their NetBIOS name. [1][2]

Adversaries can spoof an authoritative source for name resolution on a victim network by responding to LLMNR (UDP 5355)/NBT-NS (UDP 137) traffic as if they know the identity of the requested host, effectively poisoning the service so that the victims will communicate with the adversary controlled system. If the requested host belongs to a resource that requires identification/authentication, the username and NTLMv2 hash will then be sent to the adversary controlled system. The adversary can then collect the hash information sent over the wire through tools that monitor the ports for traffic or through Network Sniffing and crack the hashes offline through Brute Force to obtain the plaintext passwords.

In some cases where an adversary has access to a system that is in the authentication path between systems or when automated scans that use credentials attempt to authenticate to an adversary controlled system, the NTLMv1/v2 hashes can be intercepted and relayed to access and execute code against a target system. The relay step can happen in conjunction with poisoning but may also be independent of it.[3][4] Additionally, adversaries may encapsulate the NTLMv1/v2 hashes into various protocols, such as LDAP, SMB, MSSQL and HTTP, to expand and use multiple services with the valid NTLM response. 

Several tools may be used to poison name services within local networks such as NBNSpoof, Metasploit, and Responder.[5][6][7]

ID: T1557.001
Sub-technique of:  T1557
Platforms: Windows
Contributors: Andrew Allen, @whitehat_zero; Eric Kuehn, Secure Ideas; Matthew Demaske, Adaptforward
Version: 1.4
Created: 11 February 2020
Last Modified: 25 October 2022

Procedure Examples

ID Name Description
S0363 Empire

Empire can use Inveigh to conduct name service poisoning for credential theft and associated relay attacks.[8][9]

S0357 Impacket

Impacket modules like ntlmrelayx and smbrelayx can be used in conjunction with Network Sniffing and LLMNR/NBT-NS Poisoning and SMB Relay to gather NetNTLM credentials for Brute Force or relay attacks that can gain code execution.[10]

G0032 Lazarus Group

Lazarus Group executed Responder using the command [Responder file path] -i [IP address] -rPv on a compromised host to harvest credentials and move laterally.[11]

S0378 PoshC2

PoshC2 can use Inveigh to conduct name service poisoning for credential theft and associated relay attacks.[12]

S0192 Pupy

Pupy can sniff plaintext network credentials and use NBNS Spoofing to poison name services.[13]

S0174 Responder

Responder is used to poison name services to gather hashes and credentials from systems within a local network.[7]

G0102 Wizard Spider

Wizard Spider has used the Invoke-Inveigh PowerShell cmdlets, likely for name service poisoning.[14]

Mitigations

ID Mitigation Description
M1042 Disable or Remove Feature or Program

Disable LLMNR and NetBIOS in local computer security settings or by group policy if they are not needed within an environment. [15]

M1037 Filter Network Traffic

Use host-based security software to block LLMNR/NetBIOS traffic. Enabling SMB Signing can stop NTLMv2 relay attacks.[3][4][16]

M1031 Network Intrusion Prevention

Network intrusion detection and prevention systems that can identify traffic patterns indicative of AiTM activity can be used to mitigate activity at the network level.

M1030 Network Segmentation

Network segmentation can be used to isolate infrastructure components that do not require broad network access. This may mitigate, or at least alleviate, the scope of AiTM activity.

Detection

ID Data Source Data Component Detects
DS0029 Network Traffic Network Traffic Content

Monitor for traffic on ports UDP 5355 and UDP 137 if LLMNR/NetBIOS is disabled by security policy.

Network Traffic Flow

Monitor for network traffic originating from unknown/unexpected hardware devices. Local network traffic metadata (such as source MAC addressing) as well as usage of network management protocols such as DHCP may be helpful in identifying hardware.

DS0019 Service Service Creation

Monitor for newly constructed services/daemons through Windows event logs for event IDs 4697 and 7045. [4] Deploy an LLMNR/NBT-NS spoofing detection tool.[17]

DS0024 Windows Registry Windows Registry Key Modification

Monitor HKLM\Software\Policies\Microsoft\Windows NT\DNSClient for changes to the "EnableMulticast" DWORD value. A value of "0" indicates LLMNR is disabled.

References