RPCClient
RPCClient Guide
RPCClient is a powerful command-line tool that's part of the Samba suite, designed for interacting with Microsoft RPC (Remote Procedure Call) services. It provides a versatile interface for enumerating and working with Windows-based systems, particularly Active Directory environments and SMB/CIFS services.
Introduction to RPCClient
RPCClient leverages Microsoft's Remote Procedure Call (RPC) protocol to communicate with Windows services. The tool is particularly useful for:
Enumerating domain users and groups
Gathering information about servers and domains
Querying user information
Exploring available shares
Testing authentication credentials
Performing password resets (with appropriate privileges)
Basic Connection Syntax
The basic syntax for connecting to a system with RPCClient is:
rpcclient -U [username] [target]For a null session (anonymous) connection:
rpcclient -U "" -N [target]Command options:
-U [username]: Specify the username-P [password]: Specify the password (not recommended - insecure)-N: No password (for null sessions)-W [domain]: Specify the domain-c [command]: Run a single command and exit-I [IP address]: Connect to specific IP address-p [port]: Connect to specific port-d [debug level]: Set debug level
Key RPC Commands
Once connected, these essential commands can help enumerate the target system:
Server Information
Example output:
This output provides:
Server name
Operating system version
Server platform information
Server type flags
Domain Information
Example output:
For more detailed domain information:
Example output:
Share Enumeration
List all available shares:
Example output:
For detailed information about a specific share:
User Enumeration
List all domain users:
Example output:
User Information
Query detailed information about a specific user using their Relative ID (RID):
Example output:
Group Enumeration
List all domain groups:
Example output:
Query group members:
Example output:
Then resolve these RIDs to usernames:
Password Policy Information
Retrieve domain password policy:
Example output:
Query the password policy for a specific user:
Advanced Usage
Running Commands in Batch Mode
Instead of entering an interactive session, you can execute commands directly from the command line:
Using a script to run multiple commands:
User Manipulation (with Admin Rights)
Create a new user (if you have appropriate privileges):
Set a user's password:
Add a user to a group:
Looking Up SIDs
Convert between names and SIDs:
Example output:
Convert SID back to name:
Printer Information
If print services are available, you can enumerate printers:
Get details about a specific printer:
Automating RPCClient Tasks
Extracting All Domain Users
Enumerating Domain Information
Mapping Group Membership
Troubleshooting RPCClient
Common Issues and Solutions
Connection Failures
If you're having trouble connecting:
Possible solutions:
Verify that SMB service is running on the target
Check firewall settings
Ensure the target allows the authentication method you're using
Authentication Issues
Possible solutions:
Verify username and password
Check domain name if using domain authentication
Confirm account is not locked out or disabled
Access Denied Errors
Possible solutions:
The authenticated user doesn't have sufficient privileges
Remote registry access might be disabled
Check local security policies on the target
Missing RPC Endpoints
Possible solutions:
The requested RPC service might not be running
Firewall might be blocking specific RPC endpoints
Service might have been disabled
Security Considerations
When using RPCClient for penetration testing or security assessments:
Log your activities: Keep detailed records of all commands and output
Minimize authentication attempts: Avoid account lockouts
Consider detection impact: RPC enumeration may trigger security alerts
Handle discovered credentials securely: Protect any sensitive information
Clean up: If you create test accounts, ensure they are removed after testing
Defensive Measures Against RPC Enumeration
As a penetration tester, it's valuable to understand defensive measures:
Disable null sessions: Prevent anonymous enumeration
Restrict RPC access: Use firewalls to limit RPC connections
Implement least privilege: Minimize what authenticated users can enumerate
Enable detailed logging: Monitor for suspicious RPC activity
Use network segmentation: Limit which systems can make RPC calls to sensitive servers
Command Reference
srvinfo
Displays server information
enumdomains
Lists all domains
querydominfo
Shows detailed domain information
netshareenumall
Lists all available shares
netsharegetinfo <share>
Shows detailed share information
enumdomusers
Lists all domain users
queryuser <RID>
Shows detailed user information
enumdomgroups
Lists all domain groups
querygroupmem <RID>
Lists members of a group
getdompwinfo
Shows domain password policy
lookupnames <name>
Converts name to SID
lookupsids <SID>
Converts SID to name
createdomuser <username>
Creates a new domain user
deletedomuser <username>
Deletes a domain user
setuserinfo2 <user> 23 <password>
Sets a user's password
addgroupmem <group_rid> <user_rid>
Adds user to a group
enumprinters
Lists available printers
By mastering RPCClient, penetration testers can effectively enumerate and interact with Windows systems, gathering valuable information for security assessments and vulnerability identification.
Last updated