SMB (Server Message Block) is like Windows' chatty neighbor who shares everything. File shares, printers, authentication - SMB handles it all. And because it's so tightly integrated into Windows networks, it's often misconfigured and leaking information like a broken faucet.
Originally created by IBM in the 1980s, SMB (also called CIFS - Common Internet File System) runs on ports 139 (NetBIOS) and 445 (direct SMB). Finding these ports open on a network is like finding an unlocked door.
SMB Versions Matter
SMB Protocol Basics
SMB provides several services:
- File Sharing: Access to shared folders
- Print Services: Network printer access
- IPC$ (Inter-Process Communication): Named pipes for RPC
- Authentication: NTLM and Kerberos auth
Null Sessions
A null session is an anonymous connection to SMB. Think of it as walking into a building without showing ID - sometimes you can still look around. Many older Windows systems and misconfigured servers allow null sessions.
Null Sessions Are Goldmines
Share Enumeration
Default Shares
- C$, D$, etc.: Administrative shares (require admin)
- ADMIN$: Remote admin (requires admin)
- IPC$: Named pipes for RPC (often accessible)
- NETLOGON: Login scripts (domain controllers)
- SYSVOL: Group Policy (domain controllers)
Look for Custom Shares
Accessing Shares
User & Group Enumeration
RID Cycling
Windows assigns Relative IDs (RIDs) to users. By querying sequential RIDs, you can enumerate all users even when direct enumeration is blocked.
Well-Known RIDs
SMB Vulnerabilities
Checking for Vulnerabilities
Notable SMB Vulnerabilities
- MS17-010 (EternalBlue): Remote code execution, used by WannaCry
- MS08-067: Remote code execution, exploited by Conficker
- SMB Signing Disabled: Allows relay attacks
- SMBv1: Multiple vulnerabilities, should be disabled
- PrintNightmare: Printer spooler service RCE
EternalBlue Still Works
SMB Relay Attacks
If SMB signing is disabled, you can capture authentication attempts and relay them to other systems. It's like intercepting someone's badge swipe and using it at another door.
SMB Relay + IPv6
Tool Summary
| Tool | Best For |
|---|---|
| enum4linux | Comprehensive enumeration in one command |
| smbclient | Listing and accessing shares |
| smbmap | Share permissions and recursive listing |
| rpcclient | RPC-based enumeration (users, groups) |
| crackmapexec | Mass enumeration and exploitation |
| Impacket | Advanced attacks (psexec, relay) |
SMB Enumeration Methodology
SMB Enumeration Process
Knowledge Check
Challenges
Key Takeaways
- SMB runs on ports 139 (NetBIOS) and 445 (direct SMB)
- Null sessions allow anonymous enumeration - always test first
- enum4linux provides comprehensive enumeration in one command
- Custom shares often contain sensitive data with weak permissions
- Check for MS17-010 (EternalBlue) - it's still common
- SMB signing disabled enables relay attacks
- RID cycling bypasses restrictions on user enumeration