AD-Attacks

Understanding LLMNR and NBT-NS Poisoning: A Comprehensive Guide to Active Directory Security

RFS
2023-05-15
30 min read
Active Directory
Understanding LLMNR and NBT-NS Poisoning: A Comprehensive Guide to Active Directory Security

Introduction to LLMNR and NBT-NS Poisoning

In the ever-evolving landscape of cybersecurity, understanding potential vulnerabilities in network protocols is crucial for maintaining a robust defense against cyber threats. Two such protocols that have gained significant attention in recent years are Link-Local Multicast Name Resolution (LLMNR) and NetBIOS Name Service (NBT-NS). While these protocols serve important functions in Windows networks, they can also be exploited by attackers to perform man-in-the-middle attacks and capture user credentials. This comprehensive guide delves deep into LLMNR and NBT-NS poisoning, exploring how these attacks work, their potential impact on Active Directory environments, and most importantly, how to protect your network infrastructure from these threats.

What is LLMNR?

Link-Local Multicast Name Resolution (LLMNR) is a protocol developed by Microsoft that allows both IPv4 and IPv6 hosts to perform name resolution for other hosts on the same local link, without requiring a DNS server. It's primarily used as a fallback method when DNS name resolution fails. LLMNR was introduced with Windows Vista and is still present in modern Windows operating systems.

Key characteristics of LLMNR include:

  • It operates on multicast address 224.0.0.252 and UDP port 5355
  • It's used when DNS resolution fails or is unavailable
  • It supports both IPv4 and IPv6 networks
  • It's enabled by default on Windows systems

What is NBT-NS?

NetBIOS Name Service (NBT-NS) is an older name resolution protocol used in Windows networks. It's similar to LLMNR but is specific to NetBIOS names. NBT-NS is typically used in legacy environments or when backward compatibility is required. Despite its age, NBT-NS is still supported in modern Windows systems for compatibility reasons.

Key characteristics of NBT-NS include:

  • It operates on UDP port 137
  • It's used for NetBIOS name registration and resolution
  • It's primarily used in older Windows environments
  • It can still be found in many corporate networks due to legacy systems

How LLMNR and NBT-NS Poisoning Works

LLMNR and NBT-NS poisoning attacks exploit the way these protocols work. When a system fails to resolve a hostname using DNS, it falls back to LLMNR or NBT-NS, broadcasting a request to all systems on the local network. An attacker can respond to these broadcasts, impersonating the requested resource and potentially capturing authentication credentials.

The attack typically follows these steps:

  • 1. A user attempts to access a network resource (e.g., \\fileserver)
  • 2. DNS resolution fails
  • 3. The system sends out an LLMNR or NBT-NS broadcast to resolve the name
  • 4. The attacker responds to the broadcast, claiming to be the requested resource
  • 5. The victim's system attempts to authenticate to the attacker's machine
  • 6. The attacker captures the authentication attempt, including the user's hashed credentials

Once the attacker has captured the hashed credentials, they can attempt to crack them offline or use them in pass-the-hash attacks.

Impact on Active Directory Environments

In an Active Directory environment, LLMNR and NBT-NS poisoning can be particularly dangerous. These attacks can lead to various security breaches, including:

  • Credential Theft: Attackers can capture NTLM hashes, which can be cracked offline or used in pass-the-hash attacks.
  • Privilege Escalation: By capturing administrative credentials, attackers can gain elevated privileges within the domain.
  • Lateral Movement: Compromised credentials can be used to move laterally within the network, accessing other systems and resources.
  • Data Exfiltration: With access to multiple systems, attackers can potentially exfiltrate sensitive data from the organization.
  • Persistence: Attackers can use captured credentials to maintain long-term access to the network, even if the initial entry point is discovered and closed.

The cascading effect of these attacks can lead to a full domain compromise, making LLMNR and NBT-NS poisoning a significant threat to Active Directory security.

Tools Used for LLMNR and NBT-NS Poisoning

Several tools are commonly used by both attackers and penetration testers to perform LLMNR and NBT-NS poisoning attacks. Understanding these tools is crucial for both offensive and defensive security professionals:

  • Responder: A popular open-source tool that automates LLMNR and NBT-NS poisoning attacks. It can capture authentication attempts and perform various spoofing attacks.
  • Inveigh: A PowerShell LLMNR/NBNS/mDNS/DNS spoofer and man-in-the-middle tool designed for penetration testers.
  • Metasploit: The well-known penetration testing framework includes modules for LLMNR and NBT-NS spoofing.
  • Wireshark: While not an attack tool, this network protocol analyzer can be used to monitor LLMNR and NBT-NS traffic on a network.

It's important to note that these tools should only be used in controlled environments with proper authorization. Unauthorized use of such tools on networks you don't own or have explicit permission to test is illegal and unethical.

Command Examples for LLMNR and NBT-NS Poisoning

Here are some command examples for performing LLMNR and NBT-NS poisoning attacks using popular tools. Remember, these should only be used in authorized testing environments:

sudo responder -I eth0 -wrfv

Start Responder to listen on eth0 interface with default options

Import-Module .\Inveigh.psd1; Invoke-Inveigh -ConsoleOutput Y -LLMNR Y -NBNS Y -mDNS Y -HTTP Y -HTTPS Y

Start Inveigh in PowerShell to perform LLMNR and NBT-NS poisoning

use auxiliary/spoof/llmnr/llmnr_response

Use Metasploit's LLMNR spoofing module

Mitigation Strategies

Protecting your Active Directory environment from LLMNR and NBT-NS poisoning attacks requires a multi-layered approach. Here are some effective mitigation strategies:

  • Disable LLMNR and NBT-NS: The most effective mitigation is to disable these protocols entirely if they're not required in your environment. This can be done through Group Policy.
  • Implement Network Access Control: Use 802.1x or similar technologies to prevent unauthorized devices from connecting to the network.
  • Use Strong Authentication: Implement multi-factor authentication and use strong, unique passwords for all accounts.
  • Enable SMB Signing: This can help prevent man-in-the-middle attacks on SMB connections.
  • Use DNS Security Extensions (DNSSEC): This can help prevent DNS spoofing attacks.
  • Segment Your Network: Implement proper network segmentation to limit the potential spread of an attack.
  • Regular Security Awareness Training: Educate users about the risks of connecting to untrusted networks and the importance of verifying network resource authenticity.
  • Implement Least Privilege: Ensure users only have the minimum necessary permissions to perform their job functions.
  • Use IPsec: Implement IPsec policies to encrypt network traffic and prevent eavesdropping.
  • Monitor Network Traffic: Use intrusion detection systems (IDS) and security information and event management (SIEM) tools to monitor for suspicious network activity.

Command Examples for Mitigation

Here are some command examples to help mitigate LLMNR and NBT-NS poisoning risks:

reg add "HKLM\SYSTEM\CurrentControlSet\Services\DNSCache\Parameters" /v EnableMulticast /t REG_DWORD /d 0 /f

Disable LLMNR via Windows Registry

netsh interface ipv4 set global multicastforwarding=disabled

Disable NetBIOS over TCP/IP

Set-SmbServerConfiguration -EnableSMB1Protocol $false -Force

Disable SMBv1 protocol using PowerShell

Detection Techniques

Detecting LLMNR and NBT-NS poisoning attempts is crucial for maintaining a secure network environment. Here are some effective detection techniques:

  • Network Monitoring: Use tools like Wireshark to monitor for suspicious LLMNR and NBT-NS traffic.
  • Intrusion Detection Systems (IDS): Configure your IDS to alert on potential poisoning attempts.
  • Windows Event Logs: Monitor for Event ID 4697 (scheduled task creation) and 7045 (service creation), which may indicate post-exploitation activity.
  • Honeypots: Set up honeypot systems to detect and alert on poisoning attempts.
  • Anomaly Detection: Implement machine learning-based anomaly detection systems to identify unusual network behavior.
  • Log Analysis: Regularly analyze authentication logs for signs of unauthorized access or unusual patterns.
  • Network Traffic Analysis: Use network traffic analysis tools to identify potential man-in-the-middle attacks.
  • Endpoint Detection and Response (EDR): Deploy EDR solutions to monitor endpoint behavior and detect potential compromise.

Command Examples for Detection

Here are some command examples to help detect LLMNR and NBT-NS poisoning attempts:

tshark -i eth0 -f "udp port 5355 or udp port 137"

Use tshark to monitor LLMNR and NBT-NS traffic

Get-WinEvent -FilterHashtable @{LogName='Security';ID=4697,7045}

Use PowerShell to check for suspicious Windows Event Log entries

nmap -p137,138,139,445 --script nbstat.nse <target>

Use Nmap to scan for open NetBIOS ports and gather NetBIOS information

Best Practices for Secure Name Resolution

To minimize the risk of LLMNR and NBT-NS poisoning attacks, consider implementing these best practices for secure name resolution in your network:

  • Use DNS over HTTPS (DoH) or DNS over TLS (DoT) to encrypt DNS queries and prevent eavesdropping.
  • Implement a robust internal DNS infrastructure with proper redundancy and security measures.
  • Regularly update and patch DNS servers to address known vulnerabilities.
  • Use split-horizon DNS to separate internal and external name resolution.
  • Implement DNS filtering to block access to known malicious domains.
  • Regularly audit DNS configurations and zone files for misconfigurations or unauthorized changes.
  • Use DNSSEC to digitally sign DNS records and prevent DNS cache poisoning attacks.
  • Implement DNS-based authentication of named entities (DANE) for additional security.
  • Monitor DNS query logs for signs of potential DNS tunneling or data exfiltration attempts.

Command Examples for Secure DNS Configuration

Here are some command examples to help configure secure DNS settings:

dnssec-keygen -a RSASHA256 -b 2048 -n ZONE example.com

Generate DNSSEC keys for a domain

dnssec-signzone -A -3 $(head -c 1000 /dev/random | sha1sum | cut -b 1-16) -o example.com.signed example.com

Sign a DNS zone with DNSSEC

dig +dnssec example.com

Verify DNSSEC signatures for a domain

As technology evolves, so do the threats to network security. While LLMNR and NBT-NS poisoning attacks have been known for some time, they continue to be effective due to the prevalence of these protocols in many networks. Looking ahead, security professionals should be aware of emerging trends and potential future threats:

  • IPv6 Adoption: As more networks adopt IPv6, new attack vectors related to IPv6 name resolution may emerge.
  • Cloud and Hybrid Environments: The increasing use of cloud and hybrid environments may introduce new challenges in securing name resolution across different network boundaries.
  • IoT Devices: The proliferation of Internet of Things (IoT) devices may introduce new vulnerabilities related to name resolution in complex, heterogeneous networks.
  • AI-powered Attacks: Attackers may leverage artificial intelligence to automate and enhance poisoning attacks, making them more difficult to detect and mitigate.
  • Quantum Computing: The advent of quantum computing may necessitate new approaches to securing network protocols, including those used for name resolution.

Conclusion

LLMNR and NBT-NS poisoning attacks remain a significant threat to Active Directory environments and network security in general. By understanding how these attacks work and implementing appropriate mitigation strategies, organizations can significantly reduce their risk exposure. Remember, a defense-in-depth approach is key to maintaining a robust security posture against these and other network-based attacks.

As the cybersecurity landscape continues to evolve, it's crucial for IT professionals to stay informed about emerging threats and best practices. Regular security assessments, continuous monitoring, and ongoing education are essential components of a comprehensive security strategy. By remaining vigilant and proactive, organizations can better protect their Active Directory environments and critical assets from the ever-present threat of network-based attacks.

Related Posts

Learn about Pass-the-Hash attacks, a critical lateral movement technique in Active Directory environments. Understand how attackers exploit NTLM hashes, detection methods, and effective mitigation strategies.