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/scanner/ntp/ntp_readvar.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::Auxiliary::Report7include Msf::Exploit::Remote::Udp8include Msf::Auxiliary::UDPScanner9include Msf::Auxiliary::NTP10include Msf::Auxiliary::DRDoS1112def initialize(info = {})13super(update_info(info,14'Name' => 'NTP Clock Variables Disclosure',15'Description' => %q(16This module reads the system internal NTP variables. These variables contain17potentially sensitive information, such as the NTP software version, operating18system version, peers, and more.19),20'Author' =>21[22'Ewerson Guimaraes(Crash) <crash[at]dclabs.com.br>', # original Metasploit module23'Jon Hart <jon_hart[at]rapid7.com>' # UDPScanner version for faster scans24],25'License' => MSF_LICENSE,26'References' =>27[28['CVE', '2013-5211'], # see also scanner/ntp/ntp_monlist.rb29[ 'URL', 'https://www.rapid7.com/db/vulnerabilities/ntp-clock-variables-disclosure/' ]30]31)32)33end3435def scanner_process(data, shost, _sport)36@results[shost] ||= []37@results[shost] << Rex::Proto::NTP::NTPControl.new.read(data)38end3940def scan_host(ip)41if spoofed?42datastore['ScannerRecvWindow'] = 043scanner_spoof_send(@probe, ip, datastore['RPORT'], datastore['SRCIP'], datastore['NUM_REQUESTS'])44else45scanner_send(@probe, ip, datastore['RPORT'])46end47end4849def scanner_prescan(batch)50@results = {}51print_status("Sending NTP v2 READVAR probes to #{batch[0]}->#{batch[-1]} (#{batch.length} hosts)")52@probe = Rex::Proto::NTP::NTPControl.new53@probe.version = datastore['VERSION']54@probe.operation = 255end5657def scanner_postscan(_batch)58@results.keys.each do |k|59# TODO: check to see if any of the responses are actually NTP before reporting60report_service(61host: k,62proto: 'udp',63port: rport,64name: 'ntp',65info: @results[k].map { |r| r.payload.slice(0,r.payload_size) }.join.inspect66)6768peer = "#{k}:#{rport}"69response_map = { @probe => @results[k] }70vulnerable, proof = prove_amplification(response_map)71what = 'NTP Mode 6 READVAR DRDoS'72if vulnerable73print_good("#{peer} - Vulnerable to #{what}: #{proof}")74report_vuln(75host: k,76port: rport,77proto: 'udp',78name: what,79refs: references80)81else82vprint_status("#{peer} - Not vulnerable to #{what}: #{proof}")83end84end85end86end878889