SMB & RPC Enumeration
This cheatsheet covers the enumeration of Server Message Block (SMB) and Remote Procedure Call (RPC) services. In both standalone Linux (Samba) and Windows Active Directory environments, these protocols frequently leak domain information, user lists, password policies, and accessible file shares via Null Sessions (anonymous logins).
High-Level Automated Enumeration
Before manually digging into specific shares, run automated tools to extract as much metadata as possible (OS version, password policies, SIDs, and user groups).
The "-a" flag runs a complete suite of tests: SID cycling, # password policy extraction, OS info, and share enumeration.
retrieves a list of usernames.
retrieves the local machine groups.pulls usernames from the default RID range (500-550,1000-1050)
pull usernames using a custom RID range
run all safe SMB enumeration scripts (OS discovery, shares, vulnerabilities)
quickly check for Null Session access and list shares across a subnet
Important
Always test for a Null Session first. This means attempting to authenticate with a blank username (-U "") and a blank password (-N or -p ""). If the server is misconfigured to allow this, you can dump the entire domain user list without needing valid credentials.
Share Enumeration & Access
Once you know the server exists, map out which file shares are readable or writable.
list (-L) all available shares using a Null Session (-N)
connect to a specific share (e.g., "Development") anonymously
connect with a known username and prompt for password
map shares and display permissions (Read Only, Read/Write) for a Null Session
map shares with specific credentials and recursively list files (-R)
Rabbit Hole
You will almost always see the IPC$ (Inter-Process Communication) share. You can usually connect to it, but you will not find any files there. It is strictly used to facilitate RPC connections (which we enumerate below). Do not waste time trying to get or put files in IPC$.
RPC Enumeration (rpcclient)
Remote Procedure Calls (RPC) often bind to port 135, but can also be accessed via SMB on port 445 through the IPC$ share. If a Null Session is allowed, rpcclient acts as a direct console to query the server's internal SAM database.
Connecting to the RPC Service:
connect using a Null Session (No username, No password)
Once connected to the rpcclient$ > prompt, use the following internal queries:
| Command | Description |
|---|---|
srvinfo |
Displays server OS, version, and domain information. |
netshareenum |
Lists all available SMB shares. |
netshareenumall |
Lists all shares, including hidden/administrative ones (like C$). |
enumdomains |
Enumerates domains deployed in the network. |
enumdomusers |
Critical: Dumps the list of all users on the system/domain. |
enumdomgroups |
Lists all groups (e.g., Domain Admins, Remote Desktop Users). |
dsr_getdcname |
Retrieves the name and details of the Domain Controller. |
queryuser <RID> |
Pulls detailed info for a specific user via their Relative ID (e.g., queryuser 500 for Administrator). |
Efficiency
If enumdomusers works, immediately copy the output, clean up the usernames, and save them to a users.txt file. You will need this wordlist later for AS-REP Roasting, password spraying, or Kerberos brute-forcing.