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:

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.


References


See Also


Check also the following modules related to this module:

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.