rpcclient

Field Detail
Summary Enumerate users/groups/shares/policy over MSRPC
Category MSRPC enumeration
Phase enumeration
Interface CLI (interactive)
Platform Linux
Licence Open source (GPL, part of Samba)
Docs https://www.samba.org/samba/docs/current/man-html/rpcclient.1.html
Related SMB and Active Directory enumeration, enum4linux, LDAP enumeration, polenum, smbclient

Samba's MSRPC client — talks to the Windows RPC interfaces over SMB (#tcp/139 / #tcp/445) to enumerate users, groups, shares, domain info and password policy, and (with rights) to make changes. Often works against a null session, making it a staple of early AD enumeration. It's what enum4linux drives under the hood; using it directly gives you precision.

⚠️ Warning — Scope Enumeration is active and logged; the "create/modify" commands change AD state — authorised engagements only.

Connect

rpcclient -U "" -N 10.10.10.5                  # null session (no user, no password prompt)
rpcclient -U "guest%" 10.10.10.5               # guest, empty password
rpcclient -U 'CORP\test%test123' 10.10.10.5    # authenticated
rpcclient -U 'test' --pw-nt-hash <NThash> 10.10.10.5   # pass-the-hash
rpcclient -U "" -N 10.10.10.5 -c "enumdomusers"        # run one command non-interactively

Commands worth knowing (run inside the prompt, or via -c)

Command What it does
srvinfo Server type / OS version
enumdomusers Domain users (name + RID)
enumdomgroups Domain groups
enumalsgroups builtin Built-in local groups (e.g. Administrators)
queryuser <rid> Full detail on one user (last logon, flags, etc.)
querygroup <rid> / querygroupmem <rid> Group info / members
querydominfo Domain, server, total users
getdompwinfo Password policy (min length, complexity)
getusrdompwinfo <rid> Per-user policy
netshareenumall All shares (incl. hidden)
netsharegetinfo <share> Permissions on a share
lookupnames <name> Name → SID
lookupsids <SID> SID → name (RID cycling)
lsaquery Domain SID + name
lsaenumsid SIDs known to the LSA
enumprivs Privileges available

RID cycling (find users when direct enum is blocked)

# Get the domain SID, then walk RIDs to resolve account names
rpcclient -U "" -N 10.10.10.5 -c "lsaquery"              # -> S-1-5-21-...
for i in $(seq 500 1100); do \
  rpcclient -U "" -N 10.10.10.5 -c "lookupsids S-1-5-21-XXXX-XXXX-XXXX-$i"; done

RID 500 = built-in Administrator; 501 = Guest; domain users typically start at 1000+.

Change operations (with sufficient rights)

setuserinfo2 <user> 23 'NewPass123!'     # reset a user's password (needs permission)
createdomuser <name>                     # create a user
deletedomuser <name>                     # delete a user

Worked example

rpcclient -U "" -N 10.10.10.5 -c "enumdomusers;getdompwinfo"

Open a null session and, in one call, list every domain user and dump the password policy. The user list seeds a spray list; the policy (lockout threshold + observation window) tells you how aggressively you can spray without locking accounts.

Kill-chain usage

Enumeration

rpcclient -U "" -N 10.10.10.5 -c "enumdomusers;getdompwinfo"

Where it fits

A precise, low-level companion to enum4linux in the SMB/MSRPC enumeration phase. Its getdompwinfo overlaps with polenum; its user/group output feeds LDAP enumeration and credential attacks. Readable shares it reveals get explored with smbclient / smbmap. See SMB and Active Directory enumeration for the full picture.