Practice library / Active Directory and Windows attacks
Lab · Medium · 50 minutesFree account
SMB Enumeration
Enumerate SMB shares, null sessions, and users with enum4linux and smbclient.
On this page 10 sections
Before you start
SMB carries Windows file and printer sharing over port 445, and a decade of anonymous shares, null sessions and SMBv1 bugs keep it on every internal-pentest target list. Attackers list shares, users, groups and password policy before they type one credential, because one Users or Backups share often holds plain-text passwords. SMB weaknesses contributed to major breaches, including EternalBlue and WannaCry. The walkthrough below enumerates a target with smbclient, enum4linux and CrackMapExec, then checks for MS17-010.
For the wider method that this fits into, see the Active Directory Enumeration & Attacks workbook.
Lab Objectives
- Understand what SMB is and why it's a prime target
- List available SMB shares without credentials (null session)
- Enumerate users, groups, and domain info with enum4linux
- Use CrackMapExec for rapid SMB reconnaissance
- Check for EternalBlue (MS17-010) vulnerability
SMB (Server Message Block) is the protocol Windows uses to share files, printers, and services over a network. It runs on port 445. Many Windows misconfigurations expose sensitive information with no credentials needed.
Build the target
KaliRange hosts no targets, no virtual machines and no lab files. You run this lab on your own machine, against a target that you build. The 192.168.1.x addresses below are the example addresses of this lab. Replace them with the addresses of your own lab.
Your target is one Windows host, 192.168.1.10, on a network that you own. It must have these parts:
- SMB on ports 139 and 445, in the workgroup
WORKGROUP. - A null session that is allowed:
smbclient -L //192.168.1.10 -Nlists the shares without a password. - The shares
IPC$,C$,UsersandBackups, and one share namedSharethat the guest account can read (Steps 3 and 8). - The users
Administrator,Guest,johnandjane, and a password policy with a minimum length of 0 (Step 4). - The account
adminwith the passwordPassword123. Use your own password and put it in the commands (Steps 5 and 8). - A few text,
.configor.xmlfiles in the shares, and at least one that contains the wordpassword(Step 8). - For Step 7 only: SMBv1 switched on and the MS17-010 update missing. On a patched host, the script reports that the host is not vulnerable.
Build such a host from free, legal parts. Install an evaluation copy of Windows Server from the Microsoft Evaluation Center (180 days) in a virtual machine on your own computer, then create the shares, users and policy by hand. You can also practise the null-session steps on Metasploitable 2, an intentionally vulnerable Ubuntu virtual machine from Rapid7. Its share and user names differ from the ones here, so read the names from your own output. Keep the virtual machine off the internet. Take a snapshot of it before Step 1.
Authorised targets only. Run every command in this lab only against a target that you own or have written permission to test, and nowhere else.
Step 1: What is SMB?
# SMB ports:
# 139/tcp → NetBIOS session (older SMB)
# 445/tcp → SMB over TCP (modern, most common)
# 137/udp → NetBIOS name service
# 138/udp → NetBIOS datagram
# SMB versions:
# SMBv1 → very old, has EternalBlue vulnerability (NEVER use in production)
# SMBv2 → Windows Vista+, much improved
# SMBv3 → Windows 8+, encryption support
# What you can find on SMB:
# - Shared folders (files, backups, configs, credentials)
# - Usernames and group names
# - Domain information
# - Password policiesStep 2: Port Scanning
# Quick check if SMB is open
nmap -p 139,445 192.168.1.0/24
# Detailed SMB scan
nmap -p 445 --script smb-security-mode 192.168.1.10
# Check OS and SMB version
nmap -p 445 --script smb-os-discovery 192.168.1.10Sign in to continue
7 more sections are for signed-in members. It is free: sign in with Google.