SAPRouter Port Scanner - Metasploit
This page contains detailed information about how to use the auxiliary/scanner/sap/sap_router_portscanner metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: SAPRouter Port Scanner
Module: auxiliary/scanner/sap/sap_router_portscanner
Source code: modules/auxiliary/scanner/sap/sap_router_portscanner.rb
Disclosure date: -
Last modification time: 2021-11-05 20:19:52 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): 3299
List of CVEs: -
This module allows for mapping ACLs and identify open/closed ports accessible on hosts through a saprouter.
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
msf > use auxiliary/scanner/sap/sap_router_portscanner
msf auxiliary(sap_router_portscanner) > show targets
... a list of targets ...
msf auxiliary(sap_router_portscanner) > set TARGET target-id
msf auxiliary(sap_router_portscanner) > show options
... show and set options ...
msf auxiliary(sap_router_portscanner) > exploit
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/sap/sap_router_portscanner auxiliary module looks in the msfconsole:
msf6 > use auxiliary/scanner/sap/sap_router_portscanner
msf6 auxiliary(scanner/sap/sap_router_portscanner) > show info
Name: SAPRouter Port Scanner
Module: auxiliary/scanner/sap/sap_router_portscanner
License: Metasploit Framework License (BSD)
Rank: Normal
Provided by:
Bruno Morisson <[email protected]>
nmonkee
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
CONCURRENCY 10 yes The number of concurrent ports to check per host
INSTANCES 00-99 no SAP instance numbers to scan (NN in PORTS definition)
MODE SAP_PROTO yes Connection Mode: SAP_PROTO or TCP (Accepted: SAP_PROTO, TCP)
PORTS 32NN yes Ports to scan (e.g. 3200-3299,5NN13)
RESOLVE local yes Where to resolve TARGETS (Accepted: remote, local)
RHOST yes SAPRouter address
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 3299 yes SAPRouter TCP port (TCP)
TARGETS yes Comma delimited targets. When resolution is local address ranges or CIDR identifiers allowed.
Description:
This module allows for mapping ACLs and identify open/closed ports
accessible on hosts through a saprouter.
References:
http://help.sap.com/saphelp_nw70/helpdata/EN/4f/992dfe446d11d189700000e8322d00/frameset.htm
http://help.sap.com/saphelp_dimp50/helpdata/En/f8/bb960899d743378ccb8372215bb767/content.htm
http://labs.mwrinfosecurity.com/blog/2012/09/13/sap-smashing-internet-windows/
http://conference.hitb.org/hitbsecconf2010ams/materials/D2T2%20-%20Mariano%20Nunez%20Di%20Croce%20-%20SAProuter%20.pdf
http://scn.sap.com/docs/DOC-17124
Module Options
This is a complete list of options available in the scanner/sap/sap_router_portscanner auxiliary module:
msf6 auxiliary(scanner/sap/sap_router_portscanner) > show options
Module options (auxiliary/scanner/sap/sap_router_portscanner):
Name Current Setting Required Description
---- --------------- -------- -----------
CONCURRENCY 10 yes The number of concurrent ports to check per host
INSTANCES 00-99 no SAP instance numbers to scan (NN in PORTS definition)
MODE SAP_PROTO yes Connection Mode: SAP_PROTO or TCP (Accepted: SAP_PROTO, TCP)
PORTS 32NN yes Ports to scan (e.g. 3200-3299,5NN13)
RESOLVE local yes Where to resolve TARGETS (Accepted: remote, local)
RHOST yes SAPRouter address
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 3299 yes SAPRouter TCP port (TCP)
TARGETS yes Comma delimited targets. When resolution is local address ranges or CIDR identifiers allowed.
Advanced Options
Here is a complete list of advanced options supported by the scanner/sap/sap_router_portscanner auxiliary module:
msf6 auxiliary(scanner/sap/sap_router_portscanner) > show advanced
Module advanced options (auxiliary/scanner/sap/sap_router_portscanner):
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)
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/sap/sap_router_portscanner module can do:
msf6 auxiliary(scanner/sap/sap_router_portscanner) > show actions
Auxiliary actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the scanner/sap/sap_router_portscanner auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 auxiliary(scanner/sap/sap_router_portscanner) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
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:
- <IP>:<PORT> - connection timed out
- <IP>:<PORT> - TCP closed
- <IP>:<PORT> - blocked by ACL
- <IP>:<PORT> - invalid route
- <IP>:<PORT> - unreachable
- <IP>:<PORT> - unknown host
- <IP>:<PORT> - unknown host
- <IP>:<PORT> - connection timed out
- <IP>:<PORT> - host unreachable
- <IP>:<PORT> - unknown error message
- <IP>:<PORT> - unknown response
- TARGETS must be a comma separated list of IP addresses or hostnames when RESOLVE is remote
- Error: No instances specified
- PORTS
- <IP>:<PORT> - Unable to connect to SAPRouter <RHOST>:<RPORT> - Connection Refused
- Can't report <RES:0> as host to the database
- Warning: Service info could be inaccurate
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.
<IP>:<PORT> - connection timed out
Here is a relevant code snippet related to the "<IP>:<PORT> - connection timed out" error message:
263:
264: case response
265: when /NI_RTERR/
266: case response
267: when /timed out/
268: vprint_error ("#{ip}:#{port} - connection timed out")
269: when /refused/
270: vprint_error("#{ip}:#{port} - TCP closed")
271: return [ip, port, "closed", sap_port_info(port)]
272: when /denied/
273: vprint_error("#{ip}:#{port} - blocked by ACL")
<IP>:<PORT> - TCP closed
Here is a relevant code snippet related to the "<IP>:<PORT> - TCP closed" error message:
265: when /NI_RTERR/
266: case response
267: when /timed out/
268: vprint_error ("#{ip}:#{port} - connection timed out")
269: when /refused/
270: vprint_error("#{ip}:#{port} - TCP closed")
271: return [ip, port, "closed", sap_port_info(port)]
272: when /denied/
273: vprint_error("#{ip}:#{port} - blocked by ACL")
274: when /invalid/
275: vprint_error("#{ip}:#{port} - invalid route")
<IP>:<PORT> - blocked by ACL
Here is a relevant code snippet related to the "<IP>:<PORT> - blocked by ACL" error message:
268: vprint_error ("#{ip}:#{port} - connection timed out")
269: when /refused/
270: vprint_error("#{ip}:#{port} - TCP closed")
271: return [ip, port, "closed", sap_port_info(port)]
272: when /denied/
273: vprint_error("#{ip}:#{port} - blocked by ACL")
274: when /invalid/
275: vprint_error("#{ip}:#{port} - invalid route")
276: when /reacheable/
277: vprint_error("#{ip}:#{port} - unreachable")
278: when /hostname '#{ip}' unknown/
<IP>:<PORT> - invalid route
Here is a relevant code snippet related to the "<IP>:<PORT> - invalid route" error message:
270: vprint_error("#{ip}:#{port} - TCP closed")
271: return [ip, port, "closed", sap_port_info(port)]
272: when /denied/
273: vprint_error("#{ip}:#{port} - blocked by ACL")
274: when /invalid/
275: vprint_error("#{ip}:#{port} - invalid route")
276: when /reacheable/
277: vprint_error("#{ip}:#{port} - unreachable")
278: when /hostname '#{ip}' unknown/
279: vprint_error("#{ip}:#{port} - unknown host")
280: when /GetHostByName: '#{ip}' not found/
<IP>:<PORT> - unreachable
Here is a relevant code snippet related to the "<IP>:<PORT> - unreachable" error message:
272: when /denied/
273: vprint_error("#{ip}:#{port} - blocked by ACL")
274: when /invalid/
275: vprint_error("#{ip}:#{port} - invalid route")
276: when /reacheable/
277: vprint_error("#{ip}:#{port} - unreachable")
278: when /hostname '#{ip}' unknown/
279: vprint_error("#{ip}:#{port} - unknown host")
280: when /GetHostByName: '#{ip}' not found/
281: vprint_error("#{ip}:#{port} - unknown host")
282: when /connection to .* timed out/
<IP>:<PORT> - unknown host
Here is a relevant code snippet related to the "<IP>:<PORT> - unknown host" error message:
274: when /invalid/
275: vprint_error("#{ip}:#{port} - invalid route")
276: when /reacheable/
277: vprint_error("#{ip}:#{port} - unreachable")
278: when /hostname '#{ip}' unknown/
279: vprint_error("#{ip}:#{port} - unknown host")
280: when /GetHostByName: '#{ip}' not found/
281: vprint_error("#{ip}:#{port} - unknown host")
282: when /connection to .* timed out/
283: vprint_error("#{ip}:#{port} - connection timed out")
284: when /partner .* not reached/
<IP>:<PORT> - unknown host
Here is a relevant code snippet related to the "<IP>:<PORT> - unknown host" error message:
276: when /reacheable/
277: vprint_error("#{ip}:#{port} - unreachable")
278: when /hostname '#{ip}' unknown/
279: vprint_error("#{ip}:#{port} - unknown host")
280: when /GetHostByName: '#{ip}' not found/
281: vprint_error("#{ip}:#{port} - unknown host")
282: when /connection to .* timed out/
283: vprint_error("#{ip}:#{port} - connection timed out")
284: when /partner .* not reached/
285: vprint_error("#{ip}:#{port} - host unreachable")
286: else
<IP>:<PORT> - connection timed out
Here is a relevant code snippet related to the "<IP>:<PORT> - connection timed out" error message:
278: when /hostname '#{ip}' unknown/
279: vprint_error("#{ip}:#{port} - unknown host")
280: when /GetHostByName: '#{ip}' not found/
281: vprint_error("#{ip}:#{port} - unknown host")
282: when /connection to .* timed out/
283: vprint_error("#{ip}:#{port} - connection timed out")
284: when /partner .* not reached/
285: vprint_error("#{ip}:#{port} - host unreachable")
286: else
287: vprint_error("#{ip}:#{port} - unknown error message")
288: end
<IP>:<PORT> - host unreachable
Here is a relevant code snippet related to the "<IP>:<PORT> - host unreachable" error message:
280: when /GetHostByName: '#{ip}' not found/
281: vprint_error("#{ip}:#{port} - unknown host")
282: when /connection to .* timed out/
283: vprint_error("#{ip}:#{port} - connection timed out")
284: when /partner .* not reached/
285: vprint_error("#{ip}:#{port} - host unreachable")
286: else
287: vprint_error("#{ip}:#{port} - unknown error message")
288: end
289: when /NI_PONG/
290: vprint_good("#{ip}:#{port} - TCP OPEN")
<IP>:<PORT> - unknown error message
Here is a relevant code snippet related to the "<IP>:<PORT> - unknown error message" error message:
282: when /connection to .* timed out/
283: vprint_error("#{ip}:#{port} - connection timed out")
284: when /partner .* not reached/
285: vprint_error("#{ip}:#{port} - host unreachable")
286: else
287: vprint_error("#{ip}:#{port} - unknown error message")
288: end
289: when /NI_PONG/
290: vprint_good("#{ip}:#{port} - TCP OPEN")
291: return [ip, port, "open", sap_port_info(port)]
292: else
<IP>:<PORT> - unknown response
Here is a relevant code snippet related to the "<IP>:<PORT> - unknown response" error message:
288: end
289: when /NI_PONG/
290: vprint_good("#{ip}:#{port} - TCP OPEN")
291: return [ip, port, "open", sap_port_info(port)]
292: else
293: vprint_error("#{ip}:#{port} - unknown response")
294: end
295:
296: return nil
297: end
298:
TARGETS must be a comma separated list of IP addresses or hostnames when RESOLVE is remote
Here is a relevant code snippet related to the "TARGETS must be a comma separated list of IP addresses or hostnames when RESOLVE is remote" error message:
310: def run
311:
312: if datastore['RESOLVE'] == 'remote'
313: range = datastore['TARGETS']
314: unless validate(range)
315: print_error("TARGETS must be a comma separated list of IP addresses or hostnames when RESOLVE is remote")
316: return
317: end
318:
319: range.split(/,/).each do |host|
320: run_host(host)
Error: No instances specified
Here is a relevant code snippet related to the "Error: No instances specified" error message:
332: def run_host(ip)
333: ports = datastore['PORTS']
334:
335: # if port definition has NN then we require INSTANCES
336: if ports.include? 'NN' and datastore['INSTANCES'].nil?
337: print_error('Error: No instances specified')
338: return
339: end
340:
341: ports = build_sap_ports(ports)
342:
PORTS
Here is a relevant code snippet related to the "PORTS" error message:
339: end
340:
341: ports = build_sap_ports(ports)
342:
343: if ports.empty?
344: raise Msf::OptionValidateError.new(['PORTS'])
345: end
346:
347: print_status("Scanning #{ip}")
348: thread = []
349: r = []
<IP>:<PORT> - Unable to connect to SAPRouter <RHOST>:<RPORT> - Connection Refused
Here is a relevant code snippet related to the "<IP>:<PORT> - Unable to connect to SAPRouter <RHOST>:<RPORT> - Connection Refused" error message:
371: if res
372: r << res
373: end
374:
375: rescue ::Rex::ConnectionRefused
376: print_error("#{ip}:#{port} - Unable to connect to SAPRouter #{rhost}:#{rport} - Connection Refused")
377:
378: rescue ::Rex::ConnectionError, ::IOError, ::Timeout::Error
379: rescue ::Rex::Post::Meterpreter::RequestError
380: rescue ::Interrupt
381: raise $!
Can't report <RES:0> as host to the database
Here is a relevant code snippet related to the "Can't report <RES:0> as host to the database" error message:
412: begin
413: report_service(:host => res[0], :port => res[1], :state => res[2])
414: rescue ActiveRecord::RecordInvalid
415: # Probably raised because the Address is reserved, for example
416: # when trying to report a service on 127.0.0.1
417: print_warning("Can't report #{res[0]} as host to the database")
418: end
419: end
420: end
421:
422: print_warning("Warning: Service info could be inaccurate")
Warning: Service info could be inaccurate
Here is a relevant code snippet related to the "Warning: Service info could be inaccurate" error message:
416: # when trying to report a service on 127.0.0.1
417: print_warning("Can't report #{res[0]} as host to the database")
418: end
419: end
420: end
421:
422: print_warning("Warning: Service info could be inaccurate")
423: print(tbl.to_s)
424:
425: end
426: end
Go back to menu.
Related Pull Requests
- #8716 Merged Pull Request: Print_Status -> Print_Good (And OCD bits 'n bobs)
- #8338 Merged Pull Request: Fix msf/core and self.class msftidy warnings
- #6918 Merged Pull Request: Update sap_router_portscanner.rb
- #6655 Merged Pull Request: use MetasploitModule as a class name
- #6648 Merged Pull Request: Change metasploit class names
- #2779 Merged Pull Request: Raise Msf::OptionValidateError when the PORTS option is invalid
- #2525 Merged Pull Request: Change module boilerplate
- #2012 Merged Pull Request: Module update sap router portscanner
References
- CVE: Not available
- http://help.sap.com/saphelp_nw70/helpdata/EN/4f/992dfe446d11d189700000e8322d00/frameset.htm
- http://help.sap.com/saphelp_dimp50/helpdata/En/f8/bb960899d743378ccb8372215bb767/content.htm
- http://labs.mwrinfosecurity.com/blog/2012/09/13/sap-smashing-internet-windows/
- http://conference.hitb.org/hitbsecconf2010ams/materials/D2T2%20-%20Mariano%20Nunez%20Di%20Croce%20-%20SAProuter%20.pdf
- http://scn.sap.com/docs/DOC-17124
See Also
Check also the following modules related to this module:
- auxiliary/admin/sap/cve_2020_6207_solman_rce
- auxiliary/admin/sap/cve_2020_6287_ws_add_user
- auxiliary/admin/sap/sap_configservlet_exec_noauth
- auxiliary/admin/sap/sap_igs_xmlchart_xxe
- auxiliary/admin/sap/sap_mgmt_con_osexec
- auxiliary/dos/sap/sap_soap_rfc_eps_delete_file
- auxiliary/scanner/sap/sap_ctc_verb_tampering_user_mgmt
- auxiliary/scanner/sap/sap_hostctrl_getcomputersystem
- auxiliary/scanner/sap/sap_icf_public_info
- auxiliary/scanner/sap/sap_icm_urlscan
- auxiliary/scanner/sap/sap_mgmt_con_abaplog
- auxiliary/scanner/sap/sap_mgmt_con_brute_login
- auxiliary/scanner/sap/sap_mgmt_con_extractusers
- auxiliary/scanner/sap/sap_mgmt_con_getaccesspoints
- auxiliary/scanner/sap/sap_mgmt_con_getenv
- auxiliary/scanner/sap/sap_mgmt_con_getlogfiles
- auxiliary/scanner/sap/sap_mgmt_con_getprocesslist
- auxiliary/scanner/sap/sap_mgmt_con_getprocessparameter
- auxiliary/scanner/sap/sap_mgmt_con_instanceproperties
- auxiliary/scanner/sap/sap_mgmt_con_listconfigfiles
- auxiliary/scanner/sap/sap_mgmt_con_listlogfiles
- auxiliary/scanner/sap/sap_mgmt_con_startprofile
- auxiliary/scanner/sap/sap_mgmt_con_version
- auxiliary/scanner/sap/sap_router_info_request
- auxiliary/scanner/sap/sap_service_discovery
- auxiliary/scanner/sap/sap_smb_relay
- auxiliary/scanner/sap/sap_soap_bapi_user_create1
- auxiliary/scanner/sap/sap_soap_rfc_brute_login
- auxiliary/scanner/sap/sap_soap_rfc_dbmcli_sxpg_call_system_command_exec
- auxiliary/scanner/sap/sap_soap_rfc_dbmcli_sxpg_command_exec
- auxiliary/scanner/sap/sap_soap_rfc_eps_get_directory_listing
- auxiliary/scanner/sap/sap_soap_rfc_pfl_check_os_file_existence
- auxiliary/scanner/sap/sap_soap_rfc_ping
- auxiliary/scanner/sap/sap_soap_rfc_read_table
- auxiliary/scanner/sap/sap_soap_rfc_rzl_read_dir
- auxiliary/scanner/sap/sap_soap_rfc_susr_rfc_user_interface
- auxiliary/scanner/sap/sap_soap_rfc_sxpg_call_system_exec
- auxiliary/scanner/sap/sap_soap_rfc_sxpg_command_exec
- auxiliary/scanner/sap/sap_soap_rfc_system_info
- auxiliary/scanner/sap/sap_soap_th_saprel_disclosure
- auxiliary/scanner/sap/sap_web_gui_brute_login
- exploit/multi/sap/cve_2020_6207_solman_rs
- exploit/multi/sap/sap_mgmt_con_osexec_payload
- exploit/multi/sap/sap_soap_rfc_sxpg_call_system_exec
- exploit/multi/sap/sap_soap_rfc_sxpg_command_exec
- post/multi/sap/smdagent_get_properties
- auxiliary/bnat/bnat_router
- auxiliary/scanner/discovery/ipv6_neighbor_router_advertisement
- exploit/unix/http/ctek_skyrouter
- exploit/windows/misc/avaya_winpmd_unihostrouter
- auxiliary/gather/browser_info
- auxiliary/gather/huawei_wifi_info
- auxiliary/gather/xymon_info
- auxiliary/gather/zookeeper_info_disclosure
- auxiliary/scanner/afp/afp_server_info
- auxiliary/scanner/http/infovista_enum
- auxiliary/scanner/http/ntlm_info_enumeration
- auxiliary/scanner/http/wp_mobile_pack_info_disclosure
- auxiliary/scanner/kademlia/server_info
- auxiliary/scanner/misc/ib_service_mgr_info
- auxiliary/scanner/printer/printer_version_info
- auxiliary/scanner/quake/server_info
- auxiliary/scanner/steam/server_info
- exploit/linux/http/dlink_dspw215_info_cgi_bof
- exploit/linux/misc/asus_infosvr_auth_bypass_exec
- exploit/linux/samba/setinfopolicy_heap
- exploit/multi/http/zpanel_information_disclosure_rce
- exploit/multi/local/magnicomp_sysinfo_mcsiwrapper_priv_esc
- exploit/windows/fileformat/adobe_collectemailinfo
- exploit/windows/games/mohaa_getinfo
- post/android/gather/sub_info
- post/hardware/automotive/getvinfo
Authors
- Bruno Morisson <bm[at]integrity.pt>
- nmonkee
Version
This page has been produced using Metasploit Framework version 6.1.27-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.