Overview
impacket-smbserver spins up a lightweight SMB server on your attack box. Primary uses:
- Transfer files to/from Windows targets
- Capture NTLM hashes from incoming connections
- Host DLLs or payloads for UNC path injection attacks
No domain or Windows OS required — runs anywhere Python and Impacket are installed.
Basic Usage
Host a directory as an SMB share.
From the Windows target:
With SMB2 Support (-smb2support)
Modern Windows versions block SMBv1 by default. Always use -smb2support.
Without this flag, Windows 10+ and Server 2016+ will refuse the connection.
With Authentication (-username, -password)
Some Windows policies block guest/anonymous SMB access. Add credentials to bypass this.
From the Windows target:
Serving Files to Windows Targets
Direct Copy
Execute In-Memory (PowerShell)
Receiving Files from Windows Targets (Exfiltration)
Capturing NTLM Hashes
Any Windows host that connects to your SMB server sends NTLM authentication. The hashes are printed to stdout — save them for offline cracking.
Trigger a connection from the target:
Captured hash format (NetNTLMv2):
Crack with hashcat:
DLL Hosting / UNC Path Injection
Host a malicious DLL on your SMB server, then trigger a vulnerable application to load it via a UNC path.
Common injection points:
MSSQL Hash Capture via xp_dirtree
Shortcut File (.lnk / .scf) for Hash Capture
Place a malicious .scf file on a writable share the victim browses:
Windows Explorer automatically loads the icon, triggering NTLM auth.
The .scf icon auto-load trick is patched on modern Windows (Windows 10 / Server 2019+ by default; Windows 7/8/Server 2008–2016 after the Aug 2024 patch). On up-to-date hosts, browsing the folder no longer triggers auth — use other coercion file formats (.library-ms, .url, .lnk with a UNC icon) where still applicable.
Common Use Cases in Pentest Workflow
Quick Reference