Skip to content

Commit db243e7

Browse files
author
jvazquez-r7
committed
Land rapid7#1682, sap_router_info_request fix from @nmonkee
2 parents 0390baf + aae1d59 commit db243e7

File tree

1 file changed

+37
-21
lines changed

1 file changed

+37
-21
lines changed

modules/auxiliary/scanner/sap/sap_router_info_request.rb

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,24 @@
22
# This file is part of the Metasploit Framework and may be subject to
33
# redistribution and commercial restrictions. Please see the Metasploit
44
# Framework web site for more information on licensing and terms of use.
5-
# http://metasploit.com/framework/
5+
# http://metasploit.com/framework/
6+
##
7+
8+
##
9+
# This module is based on, inspired by, or is a port of a plugin available in
10+
# the Onapsis Bizploit Opensource ERP Penetration Testing framework -
11+
# http://www.onapsis.com/research-free-solutions.php.
12+
# Mariano Nunez (the author of the Bizploit framework) helped me in my efforts
13+
# in producing the Metasploit modules and was happy to share his knowledge and
14+
# experience - a very cool guy.
15+
#
16+
# The following guys from ERP-SCAN deserve credit for their contributions -
17+
# Alexandr Polyakov, Alexey Sintsov, Alexey Tyurin, Dmitry Chastukhin and
18+
# Dmitry Evdokimov.
19+
#
20+
# I'd also like to thank Chris John Riley, Ian de Villiers and Joris van de Vis
21+
# who have Beta tested the modules and provided excellent feedback. Some people
22+
# just seem to enjoy hacking SAP :)
623
##
724

825
require 'msf/core'
@@ -24,13 +41,7 @@ def initialize
2441
[ 'URL', 'http://help.sap.com/saphelp_nw70ehp3/helpdata/en/48/6c68b01d5a350ce10000000a42189d/content.htm'],
2542
[ 'URL', 'http://www.onapsis.com/research-free-solutions.php' ] # Bizsploit Opensource ERP Pentesting Framework
2643
],
27-
'Author' => [
28-
'nomnkee',
29-
'Mariano Nunez', # Wrote Bizploit, helped on this module, very cool guy
30-
'Chris John Riley', # Testing
31-
'Ian de Villiers', # Testing
32-
'Joris van de Vis' # Testing
33-
],
44+
'Author' => ['nomnkee'],
3445
'License' => BSD_LICENSE
3546
)
3647
register_options(
@@ -103,25 +114,30 @@ def run_host(ip)
103114
case count
104115
when 1
105116
if packet_len > 150
106-
sock.recv(150)
107-
packet_len -= 150
108-
source, packet_len = get_data(46,packet_len)
109-
destination, packet_len = get_data(46,packet_len)
110-
service, packet_len = get_data(30,packet_len)
111-
sock.recv(2)
112-
packet_len -= 2
113-
saptbl << [source, destination, service]
114-
while packet_len > 0
115-
sock.recv(13)
116-
packet_len -= 13
117+
if sock.recv(150) =~ /access denied/
118+
print_error("#{host_port} - Access denied")
119+
sock.recv(packet_len)
120+
packet_len = sock.recv(4).unpack('H*')[0].to_i 16
121+
else
122+
packet_len -= 150
117123
source, packet_len = get_data(46,packet_len)
118124
destination, packet_len = get_data(46,packet_len)
119125
service, packet_len = get_data(30,packet_len)
120-
term = sock.recv(2)
126+
sock.recv(2)
121127
packet_len -= 2
122128
saptbl << [source, destination, service]
129+
while packet_len > 0
130+
sock.recv(13)
131+
packet_len -= 13
132+
source, packet_len = get_data(46,packet_len)
133+
destination, packet_len = get_data(46,packet_len)
134+
service, packet_len = get_data(30,packet_len)
135+
term = sock.recv(2)
136+
packet_len -= 2
137+
saptbl << [source, destination, service]
138+
end
139+
packet_len = sock.recv(4).unpack('H*')[0].to_i 16
123140
end
124-
packet_len = sock.recv(4).unpack('H*')[0].to_i 16
125141
else
126142
print_error("#{host_port} - No connected clients")
127143
sock.recv(packet_len)

0 commit comments

Comments
 (0)