Table of Contents

What Are SMB Null Sessions?

5 min. read

SMB null sessions are unauthenticated, anonymous connections to a Windows system using the Server Message Block protocol. Established without verifying the identity of the initiating user or application, they allow attackers to connect to the IPC$ share without valid credentials. This legacy vulnerability enables the unauthorized enumeration of users, groups, and password policies during network reconnaissance.

Key Points

  • Broken Access Control: SMB null sessions on domain-joined devices (e.g., workstations or servers) enable enumeration of Active Directory domain information via unauthenticated network connections.
  • Data Exposure: Exploiting SMB null sessions may result in the collection of data that can be utilized to perform additional attacks against the internal network.
  • Impact: Enables various Active Directory data to be enumerated, including domain accounts (i.e., user and computer accounts), domain groups, and the domain password policy without first obtaining valid domain credentials.
  • Detection: Monitor for Event ID 4624 (Anonymous Logon) and Event ID 5140 (Access to Share) targeting IPC$.
  • Prevention: Disable unauthenticated remote access to the named pipes and shares of domain-joined devices (e.g., workstations or servers).

 

SMB Null Sessions Explained

An SMB null session occurs when a connection is established to a Windows system over the Server Message Block protocol without the connecting party providing a valid username and password.

While originally intended to allow legacy systems to perform network operations without first authenticating, this configuration has become a significant security liability in the modern threat landscape.

Establishing a null session grants an anonymous user limited capabilities on the affected device. If the device is joined to an Active Directory (AD) domain, an attacker can enumerate various information configured for the target domain, including:

  • Retrieving lists of local and domain users
  • Identifying active network shares
  • Uncovering system security policies
  • Determining the specific operating system version and service pack level

Such information is invaluable for attackers, as it provides a roadmap for subsequent privilege escalation or lateral movement. While modern Windows Server versions no longer ask whether newly promoted AD forests should be compatible with legacy Windows NT-based systems and applications, older versions allowed System Administrators to select this option.

If this compatibility option were selected during upgrades of existing AD environments, it would add the “Anonymous Users” group to the built-in “Pre-Windows 2000 Compatible Access” group. This is an often-overlooked important note because it results in “Anonymous Users” having read access to the Active Directory environment through membership to the “Pre-Windows 2000 Compatible Access” group.

Modern security architectures, such as zero trust, advocate removing all unauthenticated pathways to ensure every request is explicitly verified. The Mechanics of Abuse: How Null Sessions Work

 

The Mechanics of Abuse: How Null Sessions Work

To comprehend the risk and secure SMB effectively, it is necessary to first understand the root cause of SMB null sessions. SMB null sessions leverage the Server Message Block (SMB) and Common Internet File System (CIFS) protocols. The specific target is the IPC$ share, a hidden administrative share essential for remote administration and inter-process communication.

A standard null session connection command looks like this:

 

net use \\192.168.1.1\IPC$ "" /u:""

 

When a Windows host is configured to allow this type of connection, the operating system issues a valid security token to an unauthenticated user. While this token has limited privileges, it often retains the "Everyone" permission set in older or misconfigured environments.

Attackers leverage this access to interact with Named Pipes (e.g., “samr” (Security Account Manager), “lsarpc” (Local Security Authority), and “browser” (Computer Browser) that serve as interfaces for querying system information.

 

Valid Use Cases for SMB Null Sessions

Security professionals often ask why this vulnerability exists at all. While the default stance for any modern enterprise should be to disable null sessions entirely, there are edge cases where they are enabled for operational continuity.

Legacy Application Support

Older operational technology (OT) environments or legacy financial applications built for legacy Windows NT domains may rely on null sessions to poll servers for status updates without managing authentication tokens. Disabling null sessions in these fragile environments can lead to an immediate denial of service state for critical business processes.

Specific Storage Appliance Configurations

Certain network attached storage (NAS) appliances integrated into Windows domains may require null session access to perform name mapping or initial share enumeration before a user authenticates. In these scenarios, the device acts as a translation layer, and blocking anonymous enumeration can prevent legitimate users from browsing available file shares.

 

Risks of SMB Null Sessions

The presence of a null session vulnerability is rarely a direct path to escalated privileges within a domain, but it enables initial reconnaissance that lowers the cost of an attack.

Enumeration via RID Brute Forcing

The most significant risk posed by SMB null sessions is RID Brute Forcing. Every object in Active Directory has a Security Identifier (SID), which ends in a Relative Identifier (RID). The Administrator account always has a RID of 500, while the Guest account has a RID 501.

Attackers use enumeration tools (e.g., enum4linux or rpcclient) to cycle through thousands of RID numbers via a null session. For each valid RID supplied, the server will respond with the corresponding username.

This effectively provides an attacker with a verified list of valid usernames without first identifying valid domain credentials. This eliminates the guesswork in a brute-force attack; the attacker no longer needs to guess who to attack, only what their password is.

RID brute forcing via an SMB null session
RID brute forcing via an SMB null session

Password Policy Reconnaissance

Through the “lsarpc” pipe, attackers can query the domain's password policy. They can determine:

  • Minimum password length.
  • Password complexity requirements.
  • Account lockout thresholds (e.g., lockout after 5 failed attempts).
Retrieving the domain password policy via an SMB null session
Retrieving the domain password policy via an SMB null session

Armed with the username list (via RID cycling) and the lockout policy, an attacker can craft a password spray attack that stays just under the lockout threshold, significantly increasing their chances of success while evading detection.

 

Proactive Detection of SMB Null Session Abuse

Detecting null session abuse requires visibility into both network traffic and endpoint logs. Security operation centers (SOCs) should move beyond passive blocking to active detection of enumeration attempts.

Identifying Abuse Signatures in Network Traffic

Network security platforms, such as Next-Generation Firewalls, can detect the specific protocol handshake of a null session. You should monitor for SMB/CIFS traffic on port 445, where the “Session Setup AndX Request” contains an empty string for either the account name or the password. A sudden spike in IPC$ tree connect requests from a single internal IP address to multiple targets often indicates internal reconnaissance efforts.

Windows Event Log Analysis

On the Windows endpoint side, specific Event IDs are indicative of anonymous activity:

  • Event ID 4624: Look for "Logon Type: 3" (Network) combined with "ANONYMOUS LOGON" in the Subject fields.
  • Event ID 5140 / 5145: These events log access to a network share. A pivotal indicator is access to “\IPC$” where the “SubjectUserName” is “ANONYMOUS LOGON”.

Unit 42 research emphasizes that successful ransomware attacks often begin with this type of internal enumeration. Correlating these logs with subsequent authentication failures (Event ID 4625) provides high-fidelity alerts for active attacks.

 

Remediation: How to Disable SMB Null Sessions

Remediation should be handled via Group Policy to ensure consistency across the domain.

Configuring the “RestrictAnonymous” Registry Key

The core control for null sessions is the “RestrictAnonymous” registry value located at: “HKLM\SYSTEM\CurrentControlSet\Control\Lsa”.

Value Policy Name Result
0 None Rely on default permissions; null sessions are permitted.
1 Do not allow enumeration Prevents listing of accounts and shares but allows some connectivity.
2 No access without explicit anonymous permissions Strictly prevents all anonymous access to the system (recommended).

Table 1: Registry Modifications (RestrictAnonymous Settings)

Group Policy Objects (GPO) for Network Access Control

For a scalable fix, configure the following Group Policy Object (GPO) settings under Computer Configuration > Windows Settings > Security Settings > Local Policies > Security Options:

  1. Network access: Do not allow anonymous enumeration of SAM accounts: Set to Enabled.
  2. Network access: Do not allow anonymous enumeration of SAM accounts and shares: Set to Enabled.
  3. Network access: Let Everyone permissions apply to anonymous users: Set to Disabled.
  4. Network access: Restrict clients allowed to make remote calls to SAM: Configure the security descriptor to only allow “Administrators”.

Implementing these changes effectively closes the reconnaissance loop, forcing attackers to operate blindly.

The Critical Need for SMBv1 Deprecation

Null sessions are most dangerous when combined with SMBv1, which lacks the security features of later versions. Organizations should disable SMBv1 entirely across the fleet and transition to SMBv3.1.1, which includes robust encryption and pre-authentication integrity checks.

Comparison: Null Sessions vs. SMB Guest Access

While both involve unauthenticated access, they serve different purposes. Null sessions connect to the IPC$ share specifically to facilitate RPC communication and enumeration. SMB Guest access, on the other hand, typically refers to accessing a specific file share where the "Guest" account has been granted permissions. Null sessions are an architectural bypass, whereas Guest access is a permissive file-sharing configuration.

 

SMB Null Session FAQs

No. The Guest account is a specific disabled-by-default user account with a RID of 501. A null session is an unauthenticated connection state that uses no credentials, though it may sometimes inherit "Guest" or "Everyone" permissions depending on the system configuration.
It is possible. Older Multi-Function Devices (MFDs) that scan to network folders using SMBv1 or legacy SMB implementations may fail if null sessions are strictly blocked (RestrictAnonymous = 2). It is recommended to test with RestrictAnonymous = 1 first or upgrade the printer firmware.
Generally, no. A null session is primarily an information disclosure vulnerability. It allows an attacker to map the network. However, if the attacker discovers a weak password for a domain account with Local Administrator privileges on a domain-joined device, they can then fully authenticate to achieve RCE on the affected system.
Security professionals use tools such as “enum4linux”, “rpcclient”, and the native Windows “net use” command to identify and exploit null session vulnerabilities during authorized assessments.
SMB null sessions are primarily an on-premises Active Directory and NTLM/Kerberos concern. Cloud-native environments using modern authentication protocols are generally not susceptible to traditional SMB null session enumeration, though misconfigured cloud VMs running Windows Server can still be vulnerable.
Previous What Is a Cyber Attack?
Next What Is a DDoS Attack?