Overview
rpcclient is a command-line tool for executing RPC (Remote Procedure Call) queries against SMB servers using the MS-RPC protocol. It allows manual interaction with an SMB server to enumerate users, groups, shares, domain info, and other details — often accessible even via null session (anonymous connection). It is part of the Samba suite and is one of the primary tools for SMB reconnaissance during penetration tests.
Target / Context
Windows/Samba SMB servers — both domain and workgroup environments. Effective during null session enumeration when anonymous access is permitted.
Installation
Installation Commands:
Included with Samba:
sudo apt install samba-common-bin
Basic Usage
Basic Usage:
Null session (anonymous):
rpcclient -U "" <target>
Skip password prompt
rpcclient -N -U "" <target>
Authenticated:
rpcclient -U "username%password" <target>
Flags & Options
Flags & Options:
| Flag | Description | Example |
|---|---|---|
-U | Username (use "" for null session) | rpcclient -U "" <IP> |
-N | No password prompt | rpcclient -N -U "" <IP> |
-c | Execute a single command and exit | rpcclient -N -U "" <IP> -c “srvinfo” |
-d | Debug level | rpcclient -d 2 -U "" <IP> |
Common Use Cases
Server and Domain Information
Commands:
Server version and OS information
srvinfo
Enumerate deployed domains on the network
enumdomains
Get domain, server, and user info for deployed domains
querydominfo
Share Enumeration
Commands:
List all available shares
netshareenumall
Get details on a specific share
netsharegetinfo <share>
User and Group Enumeration
Commands:
List all domain users (username + RID)
enumdomusers
Get details on a specific user by RID
queryuser <RID>
Get details on a group by RID
querygroup <RID>
List all domain groups
enumdomgroups
List groups a user belongs to
queryusergroups <RID>
RID Brute-Forcing
When you cannot directly enumerate users but can query by RID, iterate through a range to find valid accounts. RIDs for domain users typically start around 500–1100.
Commands:
for i in $(seq 500 1100); do
rpcclient -N -U "" <target> -c "queryuser 0x$(printf '%x\n' $i)" \
| grep "User Name\|user_rid\|group_rid" && echo ""
done
Returns user details only for valid/existing RIDs — all others are silent.
Privilege and Policy Information
Commands:
List available privileges
enumprivs
Get domain password policy info
getdompwinfo
Get password policy for a specific user
getusrdompwinfo <RID>
Related Techniques
- Service Enumeration
Related Playbooks
References / Images
man rpcclient- Impacket alternative:
samrdump.py <IP>(https://github.com/SecureAuthCorp/impacket)