Enumerate SMB/RPC shares, files and identities
Needs: Reachable SMB/RPC; anonymous, guest, local or domain context must be explicit; share and filesystem ACLs both matter
List shares without credentials
# Baseline: list shares without credentials
smbclient -N -L //TARGET
# Variant — authenticated share listing and connection
smbclient -L //TARGET -U 'DOMAIN/USER'
smbclient //TARGET/SHARE -U 'DOMAIN/USER'
smbclient -L //TARGET -U 'TARGET/USER'
smbclient -L //TARGET -U 'guest%'
Decisive output: a share list proves that this access context can enumerate names. It does not prove access to share contents.
NT_STATUS_ACCESS_DENIEDmeans this context was denied; repeat after obtaining a legitimate credential.
Inside the share
The first two forms use a domain identity, the third makes a local target account explicit, and the fourth tests a guest account with an empty password. Let the client prompt for non-empty passwords. Inside the share:
# Inside the share
pwd
ls
allinfo FILE
get FILE
mkdir probe-dir
rmdir probe-dir
exit
Use a harmless uniquely named directory only when write permission must be verified. A successful create/remove establishes share-level write access, not code execution.
Recursive retrieval
# Variant — recursive retrieval
smbclient //TARGET/SHARE -U 'DOMAIN/USER' -c 'recurse ON;prompt OFF;mget *'
# Variant — RPC null or authenticated session
rpcclient -U '' -N TARGET
rpcclient -U 'DOMAIN/USER' TARGET
Useful interactive queries
# Useful interactive queries
srvinfo
enumdomains
enumdomusers
enumdomgroups
queryuser RID
netshareenumall
quit
Null-session denial is common on modern systems. Authenticated output must be labelled with the identity that produced it.
Fast permission summary and consolidated candidates
# Variant — fast permission summary and consolidated candidates
nxc smb TARGET -u USER -p PASSWORD --shares
enum4linux-ng -A TARGET
# Variant — protocol, signing and time clues
nmap -p 139,445 --script smb-protocols,smb2-security-mode,smb2-time TARGET
Windows built-ins
# Variant — Windows built-ins
net view \\TARGET /all
Get-ChildItem \\TARGET\SHARE
Get-Content \\TARGET\SHARE\FILE
These use the current Windows logon context unless alternate credentials or mappings are established. An existing connection to the same server under another identity can cause credential-conflict errors.
SMBMap — map rights, then read one useful file
Use from Kali when SMB is reachable. Choose the same domain/local identity that worked with smbclient. Suppress write probes when inventorying reads; this means a writable label is not being tested here.
# SMBMap — map rights, then read one useful file
# Known domain account: enumerate share access without creating a probe file
smbmap -H TARGET -d DOMAIN -u USER -p 'PASSWORD' --no-write-check
# Inspect the selected share to a bounded depth
smbmap -H TARGET -d DOMAIN -u USER -p 'PASSWORD' -r 'SHARE' --depth 2 --no-write-check
# Download the specific file found above
smbmap -H TARGET -d DOMAIN -u USER -p 'PASSWORD' --download 'SHARE\PATH\FILE' --no-write-check
Read: a listed file must still be readable under this identity. A downloaded config/backup → classify its credential material, then test only the relevant account/service. A denied share → try another listed share or a newly obtained identity; do not infer a host-wide denial.
SMBMap — map rights, then read one useful file
Read: a listed file must still be readable under this identity. A downloaded config/backup → classify its credential material, then test only the relevant account/service. A denied share → try another listed share or a newly obtained identity; do not infer a host-wide denial.
# SMBMap — map rights, then read one useful file
# No credentials: anonymous RPC/SMB candidates
enum4linux-ng -A TARGET
# Known identity: domain objects visible to this account
enum4linux-ng -A -w DOMAIN -u USER -p 'PASSWORD' TARGET
Next: validate returned users/groups/shares with rpcclient or smbclient. A collector can return partial data despite a successful login.
Failure cues: distinguish connection failure, authentication failure, share enumeration denial and file authorization denial. A share named
IPC$is not a general file share. Guest acceptance may look like success while returning a restricted namespace. A share marked writable still needs a consumer/trigger before it becomes an execution path.
Next action: inspect readable content, record per-share rights, validate names/domain clues, and re-run authenticated enumeration whenever identity changes. Move file-consumer hypotheses to web/execution/escalation and signing/relay hypotheses to the later credential/AD blocks.
NetBIOS names before SMB enumeration
Use when UDP/137 or SMB suggests Windows names but DNS/domain identity is unclear.
# NetBIOS names before SMB enumeration
# Ask the assigned host for its NetBIOS names
nbtscan TARGET
nmblookup -A TARGET
Read: a machine name and group/domain label are leads. A workgroup label does not prove AD membership. Resolve the returned name and use the SMB/LDAP checks with the accepted identity. No reply can mean filtering or disabled NetBIOS while TCP/445 still works.
SMB/RPC RID lookups when a normal user listing is denied
Use when the accepted identity can translate SIDs but cannot list the directory directly. Keep the queried host/domain and a bounded RID range explicit.
# SMB/RPC RID lookups when a normal user listing is denied
nxc smb TARGET -d DOMAIN -u USER -p 'PASSWORD' --rid-brute 4000
Verify → Prove the specific share/object action; a successful login or administrative indicator does not establish every remote-execution route.
If it fails → Access denied after login usually means authorization/context. Test local/domain qualification and the exact object rather than repeating passwords. More detail ↓
Explanation & examples
Enumerate SMB/RPC shares, files and identities
- USE WHEN
- SMB/RPC endpoints, domain clues or new credentials
- STARTING ACCESS
- A confirmed reachable application; anonymous context or one identified credential
- RESULT
- Domain/user clues, readable files or object-specific writable access
Recognize the clue
Start from confirmed SMB and explicitly compare anonymous versus a known authenticated context, then open a relevant named share.
smbclient -L //TARGET -N
smbclient -L //TARGET -U 'DOMAIN/USER'
Sharename Type
SHARE Disk
NETLOGON DiskMeans: A share name supplies a filesystem investigation target; listing it does not prove read, write or service creation.
Confirm: Connect to the named share under the identity that listed it, then ls/get the exact object. Listing a share does not prove read or write. For a write candidate, verify the path operation and identify a separate execution consumer before treating it as access.
- After validation
- A relevant configuration can be retrieved: inspect its account/secret context.
- Ruled out in this context
- The authenticated account cannot read that object: discard the read path for this identity, not all SMB opportunities.
- Still inconclusive
- Login succeeds but listing fails: check a justified known share path and separate share/NTFS authorization.
Troubleshooting: Access denied after login usually means authorization/context. Test local/domain qualification and the exact object rather than repeating passwords.
Recognize: direct-hosted SMB commonly uses TCP/445; NetBIOS session service commonly uses TCP/139; MS-RPC endpoint mapping commonly uses TCP/135. They are related Windows surfaces but not interchangeable. Goal: distinguish null, guest and authenticated contexts; enumerate shares, files, users, groups, domain/workgroup clues and actual permissions.
Baseline: list shares without credentials
Decisive output: a share list proves that this access context can enumerate names. It does not prove access to share contents.
NT_STATUS_ACCESS_DENIEDmeans this context was denied; repeat after obtaining a legitimate credential.
Variant — authenticated share listing and connection
The first two forms use a domain identity, the third makes a local target account explicit, and the fourth tests a guest account with an empty password. Let the client prompt for non-empty passwords. Inside the share:
Use a harmless uniquely named directory only when write permission must be verified. A successful create/remove establishes share-level write access, not code execution.
Variant — recursive retrieval
Run from a dedicated local evidence directory and review expected volume first. Search downloaded configuration, scripts, backups, keys and unattended-install files locally; never publish recovered data.
Variant — RPC null or authenticated session
Useful interactive queries:
Null-session denial is common on modern systems. Authenticated output must be labelled with the identity that produced it.
Variant — fast permission summary and consolidated candidates
NetExec (nxc) is the current command name on recent Kali releases; older material may use crackmapexec. These tools consolidate candidates. Confirm useful shares and files with smbclient or native access.
Variant — protocol, signing and time clues
Signing and dialect results affect later relay/exploit decisions but are not vulnerabilities by themselves. The older smb-os-discovery script depends on SMBv1 behavior and may not identify modern hosts reliably.
Variant — Windows built-ins
These use the current Windows logon context unless alternate credentials or mappings are established. An existing connection to the same server under another identity can cause credential-conflict errors.
SMBMap — map rights, then read one useful file
Use from Kali when SMB is reachable. Choose the same domain/local identity that worked with smbclient. Suppress write probes when inventorying reads; this means a writable label is not being tested here.
Read: a listed file must still be readable under this identity. A downloaded config/backup → classify its credential material, then test only the relevant account/service. A denied share → try another listed share or a newly obtained identity; do not infer a host-wide denial.
SMBMap upstream. For broader SMB/RPC collection, use the existing enum4linux-ng baseline; authenticate explicitly when credentials exist:
Next: validate returned users/groups/shares with rpcclient or smbclient. A collector can return partial data despite a successful login.
Failure cues: distinguish connection failure, authentication failure, share enumeration denial and file authorization denial. A share named
IPC$is not a general file share. Guest acceptance may look like success while returning a restricted namespace. A share marked writable still needs a consumer/trigger before it becomes an execution path.
Next action: inspect readable content, record per-share rights, validate names/domain clues, and re-run authenticated enumeration whenever identity changes. Move file-consumer hypotheses to web/execution/escalation and signing/relay hypotheses to the later credential/AD blocks.
NetBIOS names before SMB enumeration
Use when UDP/137 or SMB suggests Windows names but DNS/domain identity is unclear.
Read: a machine name and group/domain label are leads. A workgroup label does not prove AD membership. Resolve the returned name and use the SMB/LDAP checks with the accepted identity. No reply can mean filtering or disabled NetBIOS while TCP/445 still works.
Sources: upstream 1.
SMB/RPC RID lookups when a normal user listing is denied
Use when the accepted identity can translate SIDs but cannot list the directory directly. Keep the queried host/domain and a bounded RID range explicit.
Read: classify returned SID types—users, groups and machine accounts are different objects. The upper bound is coverage, not proof that higher RIDs contain nothing. A resolved name is not a password, service authorization or successful logon. Prefer the existing native directory/RPC listing when it is available; do not infer no accounts from a single denied enumeration method.
Sources: upstream 1.
Why it works
Session establishment, share enumeration, filesystem rights and remote execution are separate authorization layers. A credential change can reveal entirely new shares and files.
Worked example · hypothetical
Observation: anonymous share listing is denied but a recovered domain credential works. Test: open one relevant share and retrieve a configuration. Illustrative output: a service account secret appears. Interpretation: record its identity and re-enter credential validation.
New identity, privilege, host or route? Re-enumerate → All topic tasks →