| name | rpcbind-pentesting |
| description | How to enumerate and exploit RPCBind/Portmapper services (port 111) during network penetration testing. Use this skill whenever you're scanning a target and find port 111 open, or when you need to enumerate RPC services, NFS shares, or NIS domains. Trigger this skill for any RPC-related reconnaissance, NFS exploitation, NIS password extraction, or when port 111 appears filtered but you suspect RPC services are running. |
RPCBind/Portmapper Pentesting
What is RPCBind?
RPCBind (also called Portmapper) is a service that maps network service ports to RPC (Remote Procedure Call) program numbers. It's a critical component in Unix-based systems that facilitates information exchange between systems.
Default ports: 111/TCP/UDP (32771 in Oracle Solaris)
Why it matters: Port 111 is frequently scanned by attackers because it reveals:
- The type of Unix OS running
- Available services on the system
- NFS, NIS, and other RPC-based service details
Enumeration Techniques
Basic RPCInfo Enumeration
Start with rpcinfo to list registered RPC services:
rpcinfo <target>
rpcinfo -p <target>
rpcinfo irked.htb
rpcinfo -p 192.168.10.1
Advanced RPCInfo Usage
When TCP/111 is filtered, try UDP to pull the program list:
rpcinfo -T udp -p <target>
showmount -e <target>
Nmap NSE Scripts
Use Nmap's RPC scripts for exhaustive mapping:
nmap --script=rpcinfo,rpc-grind -p111 <target>
nmap --script=rpcinfo,rpc-grind --script-args 'rpc-grind.threads=8' -p111 <target>
nmap -sSUC -p111 <target>
What rpc-grind does: Hammers the portmapper with null calls that walk the nmap-rpc database, extracting supported versions when the remote daemon replies with "can't support version." This often reveals quietly registered services like rusersd, rquotad, or custom daemons.
Shodan Search
port:111 portmap
RPCBind + NFS Exploitation
If you find NFS services registered through RPCBind, you can likely list and download (and possibly upload) files.
showmount -e <target>
mount -t nfs <target>:/<export> /mnt/nfs
nfsclient <target>:/<export> /mnt/nfs
Note: For detailed NFS exploitation techniques, see the NFS pentesting documentation.
NIS (Network Information Service) Exploitation
NIS vulnerabilities involve a two-step process: identify the ypbind service, then uncover the NIS domain name.
Step 1: Install NIS Tools
apt-get install nis
Step 2: Confirm NIS Server Presence
ypwhich -d <domain-name> <server-ip>
Step 3: Extract Sensitive Data
ypcat -d <domain-name> -h <server-ip> passwd.byname
ypcat -d <domain-name> -h <server-ip> hosts.byname
ypcat -d <domain-name> -h <server-ip> group.byname
NIS Map Files Reference
| Master File | Map(s) | Notes |
|---|
| /etc/hosts | hosts.byname, hosts.byaddr | Hostnames and IP details |
| /etc/passwd | passwd.byname, passwd.byuid | NIS user password file |
| /etc/group | group.byname, group.bygid | NIS group file |
| /usr/lib/aliases | mail.aliases | Mail aliases |
After extraction: Crack the password hashes using John the Ripper or Hashcat to reveal system access credentials.
RPC Users Enumeration
If you find the rusersd service listed in RPCInfo output, you can enumerate users on the target system.
rpcinfo -p <target>
Bypassing Filtered Portmapper Port
When port 111 is filtered but NFS ports are open, you can bypass the filter by simulating a portmapper service locally and creating a tunnel.
Technique:
- Simulate a portmapper service on your local machine
- Create a tunnel from your machine to the target
- Use standard tools to exploit the NFS services
This allows exploitation even when port 111 appears filtered.
Practical Examples
Example 1: Basic Enumeration
rpcinfo -p 10.10.10.10
Example 2: NIS Password Extraction
apt-get install nis
ypwhich -d <domain> <server-ip>
ypcat -d <domain> -h <server-ip> passwd.byname > passwd_hashes.txt
john --wordlist=/usr/share/wordlists/rockyou.txt passwd_hashes.txt
Example 3: Nmap RPC Scan
nmap --script=rpcinfo,rpc-grind --script-args 'rpc-grind.threads=8' -p111 192.168.1.100
Common RPC Program Numbers
| Program | Number | Service |
|---|
| portmapper | 100000 | RPCBind |
| rusersd | 100003 | Remote Users |
| nfs | 100005 | Network File System |
| mountd | 100005 | NFS Mount |
| ypserv | 100004 | NIS Server |
| ypbind | 100004 | NIS Client |
Labs to Practice
- Irked HTB Machine: Practice these techniques on the Irked HackTheBox machine
Quick Reference Commands
rpcinfo -p <target>
rpcinfo -T udp -p <target>
nmap --script=rpcinfo,rpc-grind -p111 <target>
showmount -e <target>
ypcat -d <domain> -h <server-ip> passwd.byname
ypwhich -d <domain> <server-ip>
References