2014-08-09 04:00:43 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2014-08-09 04:00:43 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Auxiliary
|
2014-08-09 04:00:43 +00:00
|
|
|
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
include Msf::Exploit::Remote::Udp
|
|
|
|
include Msf::Auxiliary::UDPScanner
|
|
|
|
include Msf::Auxiliary::NTP
|
2014-08-09 06:15:54 +00:00
|
|
|
include Msf::Auxiliary::DRDoS
|
2014-08-09 04:00:43 +00:00
|
|
|
|
|
|
|
def initialize
|
|
|
|
super(
|
2014-08-25 16:46:47 +00:00
|
|
|
'Name' => 'NTP Mode 6 UNSETTRAP DRDoS Scanner',
|
|
|
|
'Description' => %q{
|
2014-08-09 04:00:43 +00:00
|
|
|
This module identifies NTP servers which permit mode 6 UNSETTRAP requests that
|
|
|
|
can be used to conduct DRDoS attacks. In some configurations, NTP servers will
|
2014-08-25 18:34:45 +00:00
|
|
|
respond to UNSETTRAP requests with multiple packets, allowing remote attackers
|
|
|
|
to cause a distributed, reflected denial of service (aka, "DRDoS" or traffic
|
|
|
|
amplification) via spoofed requests.
|
2014-08-09 04:00:43 +00:00
|
|
|
},
|
2014-08-25 16:46:47 +00:00
|
|
|
'Author' => 'Jon Hart <jon_hart[at]rapid7.com>',
|
|
|
|
'References' =>
|
2014-08-09 04:00:43 +00:00
|
|
|
[
|
2014-08-25 17:58:10 +00:00
|
|
|
['URL', 'https://github.com/rapid7/metasploit-framework/pull/3696'],
|
|
|
|
['URL', 'http://r-7.co/R7-2014-12']
|
2014-08-09 04:00:43 +00:00
|
|
|
],
|
2014-08-25 16:46:47 +00:00
|
|
|
'DisclosureDate' => 'Aug 25 2014',
|
|
|
|
'License' => MSF_LICENSE
|
2014-08-09 04:00:43 +00:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
# Called for each response packet
|
|
|
|
def scanner_process(data, shost, sport)
|
2014-08-09 04:22:11 +00:00
|
|
|
@results[shost] ||= []
|
|
|
|
@results[shost] << Rex::Proto::NTP::NTPControl.new(data)
|
2014-08-09 04:00:43 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# Called before the scan block
|
|
|
|
def scanner_prescan(batch)
|
|
|
|
@results = {}
|
|
|
|
@probe = Rex::Proto::NTP::NTPControl.new
|
2014-08-20 19:21:39 +00:00
|
|
|
@probe.version = datastore['VERSION']
|
2014-08-09 04:00:43 +00:00
|
|
|
@probe.operation = 31
|
|
|
|
end
|
|
|
|
|
|
|
|
# Called after the scan block
|
|
|
|
def scanner_postscan(batch)
|
|
|
|
@results.keys.each do |k|
|
2014-08-09 06:15:54 +00:00
|
|
|
response_map = { @probe => @results[k] }
|
|
|
|
# TODO: check to see if any of the responses are actually NTP before reporting
|
2014-08-09 04:00:43 +00:00
|
|
|
report_service(
|
|
|
|
:host => k,
|
|
|
|
:proto => 'udp',
|
|
|
|
:port => rport,
|
|
|
|
:name => 'ntp'
|
|
|
|
)
|
2014-08-09 06:15:54 +00:00
|
|
|
|
|
|
|
peer = "#{k}:#{rport}"
|
2014-08-26 14:48:44 +00:00
|
|
|
vulnerable, proof = prove_amplification(response_map)
|
2014-08-09 06:15:54 +00:00
|
|
|
what = 'R7-2014-12 NTP Mode 6 UNSETTRAP DRDoS'
|
|
|
|
if vulnerable
|
|
|
|
print_good("#{peer} - Vulnerable to #{what}: #{proof}")
|
|
|
|
report_vuln({
|
|
|
|
:host => k,
|
|
|
|
:port => rport,
|
|
|
|
:proto => 'udp',
|
|
|
|
:name => what,
|
|
|
|
:refs => self.references
|
|
|
|
})
|
|
|
|
else
|
|
|
|
vprint_status("#{peer} - Not vulnerable to #{what}: #{proof}")
|
2014-08-09 04:00:43 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|