techniques/null-sessions
TECHNIQUE · discovery · ATT&CK T1087.002
Null sessions
Some Windows and Samba hosts still allow an unauthenticated SMB or RPC session. With no username or password you can list users, groups and the password policy — the groundwork for spraying and roasting.
Needs credsNo
Network positionReach SMB/RPC
NoiseLow
Fixed byRestrictAnonymous
01
Requirements
all must hold REQUIRED SMB or RPC reachable
Port 445, 139 or 135 open to you.
02
Do it
your target is filled in 01
List shares and policy
Try an empty username and password over SMB.
nxc smb $IP -u '' -p '' --shares --pass-pol
02
Enumerate users over RPC
Pull the user list to build a spraying list.
impacket-rpcdump $IP && rpcclient -U '' -N $IP -c enumdomusers
03
Variants
→ Guest session
Where anonymous is blocked, a 'Guest' account with a blank password sometimes isn't.
→ RID cycling
Walk RIDs with lookupsids to recover names even when enumeration is limited.
04
Detect & harden
Detect
- Anonymous SMB session establishment
- IPC$ connections with an empty user name
Harden
- Set RestrictAnonymous / RestrictAnonymousSAM
- Deny the Guest account and blank passwords
A null session rarely wins the engagement on its own, but it’s cheap and quiet, and the password policy plus a clean user list are exactly what you need before spraying a credential — without locking anyone out.