NAT-PMP External Port Scanner - Metasploit


This page contains detailed information about how to use the auxiliary/scanner/natpmp/natpmp_portscan metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: NAT-PMP External Port Scanner
Module: auxiliary/scanner/natpmp/natpmp_portscan
Source code: modules/auxiliary/scanner/natpmp/natpmp_portscan.rb
Disclosure date: -
Last modification time: 2017-07-24 06:26:21 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): 5351
List of CVEs: -

Scan NAT devices for their external listening ports using NAT-PMP

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/natpmp/natpmp_portscan
msf auxiliary(natpmp_portscan) > show options
    ... show and set options ...
msf auxiliary(natpmp_portscan) > set RHOSTS ip-range
msf auxiliary(natpmp_portscan) > exploit

Other examples of setting the RHOSTS option:

Example 1:

msf auxiliary(natpmp_portscan) > set RHOSTS 192.168.1.3-192.168.1.200 

Example 2:

msf auxiliary(natpmp_portscan) > set RHOSTS 192.168.1.1/24

Example 3:

msf auxiliary(natpmp_portscan) > set RHOSTS file:/tmp/ip_list.txt

Required Options


  • RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'

Go back to menu.

Msfconsole Usage


Here is how the scanner/natpmp/natpmp_portscan auxiliary module looks in the msfconsole:

msf6 > use auxiliary/scanner/natpmp/natpmp_portscan

msf6 auxiliary(scanner/natpmp/natpmp_portscan) > show info

       Name: NAT-PMP External Port Scanner
     Module: auxiliary/scanner/natpmp/natpmp_portscan
    License: Metasploit Framework License (BSD)
       Rank: Normal

Provided by:
  Jon Hart <[email protected]>

Check supported:
  No

Basic options:
  Name      Current Setting  Required  Description
  ----      ---------------  --------  -----------
  CHOST                      no        The local client address
  LIFETIME  3600000          yes       Time in ms to keep this port forwarded (set to 0 to destroy a mapping)
  PORTS     1-1000           yes       Ports to scan (e.g. 22-25,80,110-900)
  PROTOCOL  TCP              yes       Protocol to forward (Accepted: TCP, UDP)
  RHOSTS                     yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
  RPORT     5351             yes       The target port
  THREADS   1                yes       The number of concurrent threads (max one per host)

Description:
  Scan NAT devices for their external listening ports using NAT-PMP

Module Options


This is a complete list of options available in the scanner/natpmp/natpmp_portscan auxiliary module:

msf6 auxiliary(scanner/natpmp/natpmp_portscan) > show options

Module options (auxiliary/scanner/natpmp/natpmp_portscan):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   CHOST                      no        The local client address
   LIFETIME  3600000          yes       Time in ms to keep this port forwarded (set to 0 to destroy a mapping)
   PORTS     1-1000           yes       Ports to scan (e.g. 22-25,80,110-900)
   PROTOCOL  TCP              yes       Protocol to forward (Accepted: TCP, UDP)
   RHOSTS                     yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
   RPORT     5351             yes       The target port
   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/natpmp/natpmp_portscan auxiliary module:

msf6 auxiliary(scanner/natpmp/natpmp_portscan) > show advanced

Module advanced options (auxiliary/scanner/natpmp/natpmp_portscan):

   Name                 Current Setting  Required  Description
   ----                 ---------------  --------  -----------
   ShowProgress         true             yes       Display progress messages during a scan
   ShowProgressPercent  10               yes       The interval in percent that progress should be shown
   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/natpmp/natpmp_portscan module can do:

msf6 auxiliary(scanner/natpmp/natpmp_portscan) > show actions

Auxiliary actions:

   Name  Description
   ----  -----------

Evasion Options


Here is the full list of possible evasion options supported by the scanner/natpmp/natpmp_portscan auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 auxiliary(scanner/natpmp/natpmp_portscan) > show evasion

Module evasion options:

   Name  Current Setting  Required  Description
   ----  ---------------  --------  -----------

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.

Unknown error: <E.CLASS> <E.BACKTRACE>


Here is a relevant code snippet related to the "Unknown error: <E.CLASS> <E.BACKTRACE>" error message:

55:	    rescue ::Interrupt
56:	      raise $!
57:	    rescue ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionRefused
58:	      nil
59:	    rescue ::Exception => e
60:	      print_error("Unknown error: #{e.class} #{e.backtrace}")
61:	    end
62:	  end
63:	
64:	  def handle_reply(host, external_addr, pkt)
65:	    return if not pkt[1]

<PEER> <EXTERNAL_ADDR> - <INT>/<PROTOCOL> <STATE> because of successful mapping with matched ports


Here is a relevant code snippet related to the "<PEER> <EXTERNAL_ADDR> - <INT>/<PROTOCOL> <STATE> because of successful mapping with matched ports" error message:

87:	            :state => state
88:	          )
89:	        end
90:	      else
91:	        state = Msf::ServiceState::Closed
92:	        vprint_error("#{peer} #{external_addr} - #{int}/#{protocol} #{state} because of successful mapping with matched ports")
93:	      end
94:	    else
95:	      state = Msf::ServiceState::Closed
96:	      vprint_error("#{peer} #{external_addr} - #{int}/#{protocol} #{state} because of code #{result} response")
97:	    end

<PEER> <EXTERNAL_ADDR> - <INT>/<PROTOCOL> <STATE> because of code <RESULT> response


Here is a relevant code snippet related to the "<PEER> <EXTERNAL_ADDR> - <INT>/<PROTOCOL> <STATE> because of code <RESULT> response" error message:

91:	        state = Msf::ServiceState::Closed
92:	        vprint_error("#{peer} #{external_addr} - #{int}/#{protocol} #{state} because of successful mapping with matched ports")
93:	      end
94:	    else
95:	      state = Msf::ServiceState::Closed
96:	      vprint_error("#{peer} #{external_addr} - #{int}/#{protocol} #{state} because of code #{result} response")
97:	    end
98:	
99:	    report_service(
100:	      :host 	=> host,
101:	      :port 	=> pkt[2],

Go back to menu.


Go back to menu.

See Also


Check also the following modules related to this module:

Authors


Jon Hart <jhart[at]spoofed.org>

Version


This page has been produced using Metasploit Framework version 6.1.24-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.