Skip to main content
Default Ports: 139 (NetBIOS), 445 (SMB over TCP) SMB is the backbone of file sharing and authentication in Windows networks, which makes it one of the highest-value services to enumerate on almost any internal engagement. A huge amount of Active Directory attack surface, shares, users, password policy, even remote code execution, sits behind this one protocol.

Null / Anonymous Session

No credentials at all. Plenty of SMB servers still allow a null session for basic enumeration, worth checking before anything else.

Authenticated

A valid username and password, or an NTLM hash via pass-the-hash. Opens up share access, RCE, and credential dumping depending on privileges.
For spraying credentials and running bulk enumeration across many hosts at once, NetExec covers that ground in more depth. This page focuses on SMB-specific tools and techniques.

Enumerating Shares

The first real step on any SMB target is finding out what shares exist and what you can actually read or write to. A few tools cover this, each with a slightly different strength.
Always worth trying a null session first, since it costs nothing and plenty of servers still allow it:
Once you know a share name, connect to it directly. recurse ON plus mget * pulls everything down in one go instead of browsing file by file:
When you’ve got a list of possible share names to check against a target, this loops through each one and reports which are actually accessible:

RPCClient

rpcclient gives you an interactive session for querying domain and user information directly over MS-RPC, useful when you want specific details rather than a full automated enumeration pass.
Once connected, these are the queries worth knowing:

Remote Code Execution

With valid credentials, whether a password or an NTLM hash, SMB becomes a direct path to command execution on the target. Impacket’s psexec.py is the standard tool for this.
smbexec.py achieves the same thing through a different technique, worth having as a fallback if psexec gets flagged:

Brute Forcing


Authentication Attacks

Both of these intercept or relay live authentication traffic on the network. They’re far more intrusive than passive enumeration, confirm scope covers active attacks before running either.
Responder listens on the network and catches NTLM hashes from hosts broadcasting authentication requests, often triggered by a mistyped share path or a poisoned LLMNR/NBT-NS response.
Captured hashes land under /usr/share/responder/logs/, ready to crack offline or relay directly instead:
Add -c "COMMAND" to ntlmrelayx to execute a command, like launching a reverse shell, on successful relay instead of just dumping hashes.

Nmap Enumeration


Known RCE Vulnerabilities

A handful of SMB vulnerabilities are common enough, and severe enough, that they’re worth checking for on sight rather than waiting for deeper enumeration.
A positive hit on any of these is a critical finding. Confirm it carefully and report immediately rather than continuing to enumerate, especially on EternalBlue, where exploitation can crash the target.

Metasploit Modules


Quick Reference Tools

Hackviser: SMB

Quick-reference pentesting guide for the SMB service.

HackTricks: SMB

Deeper breakdown of SMB enumeration, exploitation, and relay techniques.
Credential spraying, hash capture, and NTLM relaying are all high-impact actions that can lock out accounts or disrupt production authentication. Confirm scope before running anything beyond read-only enumeration.