Path: blob/master/modules/auxiliary/scanner/ntp/ntp_req_nonce_dos.rb
19500 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Auxiliary::Report7include Msf::Exploit::Remote::Udp8include Msf::Auxiliary::UDPScanner9include Msf::Auxiliary::NTP10include Msf::Auxiliary::DRDoS1112def initialize13super(14'Name' => 'NTP Mode 6 REQ_NONCE DRDoS Scanner',15'Description' => %q{16This module identifies NTP servers which permit mode 6 REQ_NONCE requests that17can be used to conduct DRDoS attacks. In some configurations, NTP servers will18respond to REQ_NONCE requests with a response larger than the request,19allowing remote attackers to cause a distributed, reflected20denial of service (aka, "DRDoS" or traffic amplification) via spoofed21requests.22},23'Author' => 'Jon Hart <jon_hart[at]rapid7.com>',24'References' => [25['CVE', '2013-5211'], # see also scanner/ntp/ntp_monlist.rb26['URL', 'https://github.com/rapid7/metasploit-framework/pull/3696'],27['URL', 'https://www.rapid7.com/blog/post/2014/08/25/r7-2014-12-more-amplification-vulnerabilities-in-ntp-allow-even-more-drdos-attacks/']28],29'DisclosureDate' => 'Aug 25 2014',30'License' => MSF_LICENSE31)32end3334# Called for each response packet35def scanner_process(data, shost, sport)36@results[shost] ||= []37@results[shost] << Rex::Proto::NTP::NTPControl.new.read(data)38end3940# Called before the scan block41def scanner_prescan(batch)42@results = {}43@probe = Rex::Proto::NTP::NTPControl.new44@probe.version = datastore['VERSION']45@probe.operation = 1246end4748# Called after the scan block49def scanner_postscan(batch)50@results.keys.each do |k|51response_map = { @probe => @results[k] }52# TODO: check to see if any of the responses are actually NTP before reporting53report_service(54:host => k,55:proto => 'udp',56:port => rport,57:name => 'ntp'58)5960peer = "#{k}:#{rport}"61vulnerable, proof = prove_amplification(response_map)62what = 'R7-2014-12 NTP Mode 6 REQ_NONCE DRDoS'63if vulnerable64print_good("#{peer} - Vulnerable to #{what}: #{proof}")65report_vuln({66:host => k,67:port => rport,68:proto => 'udp',69:name => what,70:refs => self.references71})72else73vprint_status("#{peer} - Not vulnerable to #{what}: #{proof}")74end75end76end77end787980