SunRPC Portmap Program Enumerator - Metasploit
This page contains detailed information about how to use the auxiliary/scanner/misc/sunrpc_portmapper metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: SunRPC Portmap Program Enumerator
Module: auxiliary/scanner/misc/sunrpc_portmapper
Source code: modules/auxiliary/scanner/misc/sunrpc_portmapper.rb
Disclosure date: -
Last modification time: 2022-01-23 15:28:32 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): 111
List of CVEs: -
This module calls the target portmap service and enumerates all program entries and their running port numbers.
Module Ranking and Traits
Module Ranking:
- normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.
Basic Usage
This module is a scanner module, and is capable of testing against multiple hosts.
msf > use auxiliary/scanner/misc/sunrpc_portmapper
msf auxiliary(sunrpc_portmapper) > show options
... show and set options ...
msf auxiliary(sunrpc_portmapper) > set RHOSTS ip-range
msf auxiliary(sunrpc_portmapper) > exploit
Other examples of setting the RHOSTS option:
Example 1:
msf auxiliary(sunrpc_portmapper) > set RHOSTS 192.168.1.3-192.168.1.200
Example 2:
msf auxiliary(sunrpc_portmapper) > set RHOSTS 192.168.1.1/24
Example 3:
msf auxiliary(sunrpc_portmapper) > set RHOSTS file:/tmp/ip_list.txt
Required Options
- RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
Knowledge Base
Vulnerable Application
RPC Portmapper, or more recently renamed to rpcbind, is fairly common and this scanner searches for its existance. The idea behind rpcbind was to create a 'directory' that could be asked where a service is running (port). Having this single port/service be queryable meant, the services being managed by rpcbind could actually be running on any port or protocol, and rpdbind would be in charge of letting clients know where they were. This is more or less an outdated model/service, and NFS is arguably the most popular service still utilizing rpcbind. The following was done on Kali linux:
- Install rpcbind:
apt-get install rpcbind
- Now now have
rpcbind
, but this gives us minimal services running on it. You may want to install additional:- NIS:
apt-get install nis
- Start the service:
ypserv
- Start the service:
- NFS:
apt-get install nfs-kernel-server
- NIS:
- Just to be safe, restart rpcbind:
service rpcbind restart
Verification Steps
- Install and configure rpcbind
- Start msfconsole
- Do:
use auxiliary/scanner/misc/sunrpc_portmapper
- Do:
run
Scenarios
A run against the configuration from these docs
msf > use auxiliary/scanner/misc/sunrpc_portmapper
msf auxiliary(sunrpc_portmapper) > set rhosts 127.0.0.1
rhosts => 127.0.0.1
msf auxiliary(sunrpc_portmapper) > run
[+] 127.0.0.1:111 - SunRPC Programs for 127.0.0.1
=============================
Name Number Version Port Protocol
---- ------ ------- ---- --------
mountd 100005 1 60153 udp
mountd 100005 1 39027 tcp
mountd 100005 2 47725 udp
mountd 100005 2 53055 tcp
mountd 100005 3 49015 udp
mountd 100005 3 47033 tcp
nfs 100003 3 2049 tcp
nfs 100003 4 2049 tcp
nfs 100003 3 2049 udp
nfs 100003 4 2049 udp
nfs_acl 100227 3 2049 tcp
nfs_acl 100227 3 2049 udp
nlockmgr 100021 1 40970 udp
nlockmgr 100021 3 40970 udp
nlockmgr 100021 4 40970 udp
nlockmgr 100021 1 42279 tcp
nlockmgr 100021 3 42279 tcp
nlockmgr 100021 4 42279 tcp
rpcbind 100000 4 111 tcp
rpcbind 100000 3 111 tcp
rpcbind 100000 2 111 tcp
rpcbind 100000 4 111 udp
rpcbind 100000 3 111 udp
rpcbind 100000 2 111 udp
ypserv 100004 2 707 udp
ypserv 100004 1 707 udp
ypserv 100004 2 708 tcp
ypserv 100004 1 708 tcp
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
Confirming
Since rpc port mapper has been around since 1995, there are many tools which can also query it. The following are other industry tools which can also be used.
nmap
nmap -p 111 --script=rpcinfo 127.0.0.1
Starting Nmap 7.40 ( https://nmap.org ) at 2017-02-13 22:57 EST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000043s latency).
PORT STATE SERVICE
111/tcp open rpcbind
| rpcinfo:
| program version port/proto service
| 100000 2,3,4 111/tcp rpcbind
| 100000 2,3,4 111/udp rpcbind
| 100003 3,4 2049/tcp nfs
| 100003 3,4 2049/udp nfs
| 100004 1,2 707/udp ypserv
| 100004 1,2 708/tcp ypserv
| 100005 1,2,3 47033/tcp mountd
| 100005 1,2,3 49015/udp mountd
| 100021 1,3,4 40970/udp nlockmgr
| 100021 1,3,4 42279/tcp nlockmgr
| 100227 3 2049/tcp nfs_acl
|_ 100227 3 2049/udp nfs_acl
rpcinfo
This is the standard package included with rpcbind to query the rpc interface.
rpcinfo -p 127.0.0.1
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100005 1 udp 60153 mountd
100005 1 tcp 39027 mountd
100005 2 udp 47725 mountd
100005 2 tcp 53055 mountd
100005 3 udp 49015 mountd
100005 3 tcp 47033 mountd
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100227 3 tcp 2049
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100227 3 udp 2049
100021 1 udp 40970 nlockmgr
100021 3 udp 40970 nlockmgr
100021 4 udp 40970 nlockmgr
100021 1 tcp 42279 nlockmgr
100021 3 tcp 42279 nlockmgr
100021 4 tcp 42279 nlockmgr
100004 2 udp 707 ypserv
100004 1 udp 707 ypserv
100004 2 tcp 708 ypserv
100004 1 tcp 708 ypserv
Go back to menu.
Msfconsole Usage
Here is how the scanner/misc/sunrpc_portmapper auxiliary module looks in the msfconsole:
msf6 > use auxiliary/scanner/misc/sunrpc_portmapper
msf6 auxiliary(scanner/misc/sunrpc_portmapper) > show info
Name: SunRPC Portmap Program Enumerator
Module: auxiliary/scanner/misc/sunrpc_portmapper
License: Metasploit Framework License (BSD)
Rank: Normal
Provided by:
tebo <[email protected]>
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
PROTOCOL tcp yes Protocol to use (Accepted: tcp, udp)
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 111 yes The target port (TCP)
THREADS 1 yes The number of concurrent threads (max one per host)
Description:
This module calls the target portmap service and enumerates all
program entries and their running port numbers.
References:
http://www.ietf.org/rfc/rfc1057.txt
Module Options
This is a complete list of options available in the scanner/misc/sunrpc_portmapper auxiliary module:
msf6 auxiliary(scanner/misc/sunrpc_portmapper) > show options
Module options (auxiliary/scanner/misc/sunrpc_portmapper):
Name Current Setting Required Description
---- --------------- -------- -----------
PROTOCOL tcp yes Protocol to use (Accepted: tcp, udp)
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 111 yes The target port (TCP)
THREADS 1 yes The number of concurrent threads (max one per host)
Advanced Options
Here is a complete list of advanced options supported by the scanner/misc/sunrpc_portmapper auxiliary module:
msf6 auxiliary(scanner/misc/sunrpc_portmapper) > show advanced
Module advanced options (auxiliary/scanner/misc/sunrpc_portmapper):
Name Current Setting Required Description
---- --------------- -------- -----------
CHOST no The local client address
CPORT no The local client port
ConnectTimeout 10 yes Maximum number of seconds to establish a TCP connection
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
SSL false no Negotiate SSL/TLS for outgoing connections
SSLCipher no String for SSL cipher - "DHE-RSA-AES256-SHA" or "ADH"
SSLVerifyMode PEER no SSL verification method (Accepted: CLIENT_ONCE, FAIL_IF_NO_PEER_CERT, NONE, PEER)
SSLVersion Auto yes Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (Accepted: Auto, TLS, SSL23, SSL3, TLS1, TLS1.1, TLS1.2)
ShowProgress true yes Display progress messages during a scan
ShowProgressPercent 10 yes The interval in percent that progress should be shown
TIMEOUT 10 yes Number of seconds to wait for responses to RPC calls
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Auxiliary Actions
This is a list of all auxiliary actions that the scanner/misc/sunrpc_portmapper module can do:
msf6 auxiliary(scanner/misc/sunrpc_portmapper) > show actions
Auxiliary actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the scanner/misc/sunrpc_portmapper auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 auxiliary(scanner/misc/sunrpc_portmapper) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
ONCRPC::tcp_request_fragmentation false no Enable fragmentation of TCP ONC/RPC requests
TCP::max_send_size 0 no Maxiumum tcp segment size. (0 = disable)
TCP::send_delay 0 no Delays inserted before every send. (0 = disable)
Go back to menu.
Error Messages
This module may fail with the following error messages:
Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.
<PEER>: unknown protocol number for <THING>
Here is a relevant code snippet related to the "<PEER>: unknown protocol number for <THING>" error message:
65: if prot_num == 0x06
66: proto = 'tcp'
67: elsif prot_num == 0x11
68: proto = 'udp'
69: else
70: print_error("#{peer}: unknown protocol number for #{thing}")
71: next
72: end
73:
74: resolved = progresolv(prog)
75: table << [ resolved, prog, vers, port, proto ]
Go back to menu.
Related Pull Requests
- #12776 Merged Pull Request: add PROTOCOL option for sunrpc_portmapper
- #8710 Merged Pull Request: Rex::Encoder::XDR conflicts with the XDR gem
- #8338 Merged Pull Request: Fix msf/core and self.class msftidy warnings
- #7200 Merged Pull Request: Rex::Ui::Text cleanup
- #6655 Merged Pull Request: use MetasploitModule as a class name
- #6648 Merged Pull Request: Change metasploit class names
- #6526 Merged Pull Request: Peers for the peer god
- #2525 Merged Pull Request: Change module boilerplate
- #2424 Merged Pull Request: Fix bug on missing hosts for SunRPC Portmap
- #1228 Merged Pull Request: MSFTIDY cleanup #1 - auxiliary
References
See Also
Check also the following modules related to this module:
- auxiliary/admin/upnp/soap_portmapping
- auxiliary/scanner/portmap/portmap_amp
- auxiliary/scanner/misc/cctv_dvr_login
- auxiliary/scanner/misc/cisco_smart_install
- auxiliary/scanner/misc/clamav_control
- auxiliary/scanner/misc/dahua_dvr_auth_bypass
- auxiliary/scanner/misc/dvr_config_disclosure
- auxiliary/scanner/misc/easycafe_server_fileaccess
- auxiliary/scanner/misc/freeswitch_event_socket_login
- auxiliary/scanner/misc/ibm_mq_channel_brute
- auxiliary/scanner/misc/ibm_mq_enum
- auxiliary/scanner/misc/ibm_mq_login
- auxiliary/scanner/misc/ib_service_mgr_info
- auxiliary/scanner/misc/java_jmx_server
- auxiliary/scanner/misc/java_rmi_server
- auxiliary/scanner/misc/oki_scanner
- auxiliary/scanner/misc/poisonivy_control_scanner
- auxiliary/scanner/misc/raysharp_dvr_passwords
- auxiliary/scanner/misc/rosewill_rxs3211_passwords
- auxiliary/scanner/misc/sercomm_backdoor_scanner
- auxiliary/scanner/misc/zenworks_preboot_fileaccess
- auxiliary/admin/sunrpc/solaris_kcms_readfile
- exploit/netware/sunrpc/pkernel_callit
- exploit/solaris/sunrpc/sadmind_adm_build_path
- exploit/solaris/sunrpc/sadmind_exec
- exploit/solaris/sunrpc/ypupdated_exec
- exploit/windows/brightstor/mediasrv_sunrpc
- auxiliary/admin/misc/sercomm_dump_config
- auxiliary/admin/misc/wol
- auxiliary/dos/misc/dopewars
- auxiliary/dos/misc/ibm_sametime_webplayer_dos
- auxiliary/dos/misc/ibm_tsm_dos
- auxiliary/dos/misc/memcached
Authors
- <tebo[at]attackresearch.com>
Version
This page has been produced using Metasploit Framework version 6.2.7-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.