Path: blob/master/modules/auxiliary/scanner/ntp/ntp_unsettrap_dos.rb
19516 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 UNSETTRAP DRDoS Scanner',15'Description' => %q{16This module identifies NTP servers which permit mode 6 UNSETTRAP requests that17can be used to conduct DRDoS attacks. In some configurations, NTP servers will18respond to UNSETTRAP requests with multiple packets, allowing remote attackers19to cause a distributed, reflected denial of service (aka, "DRDoS" or traffic20amplification) via spoofed requests.21},22'Author' => 'Jon Hart <jon_hart[at]rapid7.com>',23'References' => [24['CVE', '2013-5211'], # see also scanner/ntp/ntp_monlist.rb25['URL', 'https://github.com/rapid7/metasploit-framework/pull/3696'],26['URL', 'https://www.rapid7.com/blog/post/2014/08/25/r7-2014-12-more-amplification-vulnerabilities-in-ntp-allow-even-more-drdos-attacks/']27],28'DisclosureDate' => 'Aug 25 2014',29'License' => MSF_LICENSE30)31end3233# Called for each response packet34def scanner_process(data, shost, sport)35@results[shost] ||= []36@results[shost] << Rex::Proto::NTP::NTPControl.new.read(data)37end3839# Called before the scan block40def scanner_prescan(batch)41@results = {}42@probe = Rex::Proto::NTP::NTPControl.new43@probe.version = datastore['VERSION']44@probe.operation = 3145end4647# Called after the scan block48def scanner_postscan(batch)49@results.keys.each do |k|50response_map = { @probe => @results[k] }51# TODO: check to see if any of the responses are actually NTP before reporting52report_service(53:host => k,54:proto => 'udp',55:port => rport,56:name => 'ntp'57)5859peer = "#{k}:#{rport}"60vulnerable, proof = prove_amplification(response_map)61what = 'R7-2014-12 NTP Mode 6 UNSETTRAP DRDoS'62if vulnerable63print_good("#{peer} - Vulnerable to #{what}: #{proof}")64report_vuln({65:host => k,66:port => rport,67:proto => 'udp',68:name => what,69:refs => self.references70})71else72vprint_status("#{peer} - Not vulnerable to #{what}: #{proof}")73end74end75end76end777879