|
| 1 | +# This file is part of the Metasploit Framework and may be subject to |
| 2 | +# redistribution and commercial restrictions. Please see the Metasploit |
| 3 | +# web site for more information on licensing and terms of use. |
| 4 | +# http://metasploit.com/ |
| 5 | + |
| 6 | +require 'msf/core' |
| 7 | + |
| 8 | +class Metasploit3 < Msf::Auxiliary |
| 9 | + |
| 10 | + |
| 11 | + include Msf::Exploit::Remote::Udp |
| 12 | + include Msf::Auxiliary::Report |
| 13 | + include Msf::Auxiliary::Scanner |
| 14 | + |
| 15 | + |
| 16 | + def initialize(info = {}) |
| 17 | + super(update_info(info, |
| 18 | + 'Name' => 'NTP Clock Variables Disclosure', |
| 19 | + 'Description' => %q{ |
| 20 | + This module reads the system internal NTP variables. These variables contain potentially sensitive |
| 21 | + information, such as the NTP software version, operating system version, peers, and more.. |
| 22 | + }, |
| 23 | + 'Author' => 'Ewerson Guimaraes(Crash) <crash[at]dclabs.com.br>', |
| 24 | + 'License' => MSF_LICENSE, |
| 25 | + 'Version' => '', |
| 26 | + 'References' => |
| 27 | + [ |
| 28 | + ['URL','http://www.rapid7.com/vulndb/lookup/ntp-clock-variables-disclosure' ], |
| 29 | + ] |
| 30 | + ) |
| 31 | + ) |
| 32 | + register_options( |
| 33 | + [ |
| 34 | + Opt::RPORT(123) |
| 35 | + ], self.class) |
| 36 | + end |
| 37 | + |
| 38 | + def run_host(ip) |
| 39 | + |
| 40 | + connect_udp |
| 41 | + |
| 42 | + readvar = "\x16\x02\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00" #readvar command |
| 43 | + print_status("Connecting target #{rhost}:#{rport}...") |
| 44 | + |
| 45 | + print_status("Sending command") |
| 46 | + udp_sock.put(readvar) |
| 47 | + reply = udp_sock.recvfrom(65535, 0.1) |
| 48 | + p_reply =( reply[0].split(",")) |
| 49 | + arr_count = 0 |
| 50 | + while ( arr_count < p_reply.size) |
| 51 | + if arr_count == 0 |
| 52 | + print_good (p_reply[arr_count].slice(12,p_reply[arr_count].size)) #12 is the adjustment of packet garbage |
| 53 | + arr_count = arr_count + 1 |
| 54 | + else |
| 55 | + print_good (p_reply[arr_count].strip) |
| 56 | + arr_count = arr_count + 1 |
| 57 | + end |
| 58 | + end |
| 59 | + disconnect_udp |
| 60 | + |
| 61 | + end |
| 62 | + |
| 63 | +end |
0 commit comments