SMB Enumeration (original) (raw)

Last Updated : 8 Jun, 2026

SMB (Server Message Block) Enumeration is the process of collecting information from a target system via the SMB protocol. It is commonly used in penetration testing and security assessments to identify shared resources, users, system details and potential misconfigurations that may expose vulnerabilities.

SMB Enumeration Stages

1. Hostname Enumeration

Identifies the computer name of the target system.

2. List Shares

Displays shared resources available through SMB.

3. Checking Null Session

Checks whether the SMB service allows anonymous login without username and password.

4. List Users

Retrieves information about user accounts on the target system.

5. Vulnerability Scanning

Identifies security weaknesses in SMB services.

6. Overall Scanning

Combines all enumeration results to create a complete picture of the target.

SMB Enumeration for Hostname

There are plenty of tools that can enumerate Hostname, here to demonstrate we are using nmblookup and nbtscan. Nmblookup tool makes use of queries of the NetBIOS names and maps them to their related IP addresses in a network.

1. nmblookup

nmblookup is used to query NetBIOS names and resolve them to IP addresses. It helps identify the hostname of a target system via NetBIOS.

**Command:

nmblookup -A

**Output:

nmblookup

2. nbtscan

nbtscan scans a target IP or range to retrieve NetBIOS name information, including hostname and MAC address.

**Command:

nbtscan

**Output:

nbtscan

In this part, we are going to enumerate shares of the host or target system. We can perform this enumeration with many tools, for this article we are going to use smbmap, smbclient, Nmap and Metasploit for different ways of performing this share enumeration.

1. smbmap

smbmap is a tool used to enumerate SMB shares on a target host and display their associated permissions, such as read or write access. It is useful for quickly identifying accessible shares and understanding potential access levels.

**Command:

smbmap -H

**Output:

smbmap

**Using Credentials:

smbmap can also be used with valid credentials to gain deeper insight into share permissions based on user privileges.

**Command:

smbmap -H -u -p

2. smbclient

smbclient is a Samba client tool used to test connectivity to SMB shares on a target system. It is commonly used to list available shared resources and verify access to Windows or Samba shares.

**Command:

smbclient -L

**Output:

smbclient

3. Nmap (SMB Share Enumeration)

Nmap provides the smb-enum-shares NSE script, which is used to enumerate SMB shares on a target system. It scans SMB ports and attempts to retrieve available share information.

**Command:

nmap --script smb-enum-shares -p 139,445

**Output:

nmap

4. Metasploit (smb_enumshares)

Metasploit includes the smb_enumshares auxiliary module, which is used to enumerate SMB shares on a target system, if present.

**Commands:

msf6 > use auxiliary/scanner/smb/smb_enumshares msf6 auxiliary(scanner/smb/smb_enumshares) > set RHOSTS msf6 auxiliary(scanner/smb/smb_enumshares) > set SMBUser msf6 auxiliary(scanner/smb/smb_enumshares) > set SMBPass msf6 auxiliary(scanner/smb/smb_enumshares) > exploit

SMB Enumeration for Vulnerability Scanning

In this stage, we use Nmap's script for scanning for vulnerabilities that could possibly be found on the server. We can use various tools for this stage but here we are going to look at Nmap's NSE script.

1. Nmap SMB Vulnerability Scanning

Nmap provides a collection of NSE (Nmap Scripting Engine) scripts that can be used to detect known SMB vulnerabilities. The smb-vuln* family of scripts checks for common issues such as MS08-067, regsvc-dos and other SMB-related exploits.

**Command:

sudo nmap --script smb-vuln* -p 139,445

**Command:

sudo nmap --script smb-vuln* -p 139,445

**Output:

nmap scan for SMB Vulnerability scanning

2. SMB Enumeration using Enum4linux

Enum4linux is a powerful enumeration tool used to extract information from Windows and Samba systems. It can retrieve user lists, shares, policies and other SMB-related data from a target host.

**Command:

enum4linux -U

**Output:

Enum4Linux