2014-08-09 04:00:43 +00:00
|
|
|
##
|
|
|
|
# This module requires Metasploit: http//metasploit.com/download
|
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
|
|
|
|
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 REQ_NONCE DRDoS Scanner',
|
|
|
|
'Description' => %q{
|
2014-08-09 04:00:43 +00:00
|
|
|
This module identifies NTP servers which permit mode 6 REQ_NONCE requests that
|
|
|
|
can be used to conduct DRDoS attacks. In some configurations, NTP servers will
|
|
|
|
respond to REQ_NONCE requests with a response larger than the request,
|
|
|
|
allowing remote attackers to cause a denial of services (traffic
|
|
|
|
amplification) via spoofed requests.
|
|
|
|
},
|
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 IP in the batch
|
|
|
|
def scan_host(ip)
|
|
|
|
scanner_send(@probe, ip, datastore['RPORT'])
|
|
|
|
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 = 12
|
|
|
|
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 04:22:11 +00:00
|
|
|
|
2014-08-09 06:15:54 +00:00
|
|
|
peer = "#{k}:#{rport}"
|
|
|
|
vulnerable, proof = prove_drdos(response_map)
|
|
|
|
what = 'R7-2014-12 NTP Mode 6 REQ_NONCE 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
|