2013-03-07 23:53:19 +00:00
|
|
|
##
|
2012-10-18 23:03:28 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# web site for more information on licensing and terms of use.
|
2013-03-07 23:53:19 +00:00
|
|
|
# http://metasploit.com/
|
|
|
|
##
|
2012-10-18 23:03:28 +00:00
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::Udp
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
include Msf::Auxiliary::Scanner
|
|
|
|
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'NTP Clock Variables Disclosure',
|
|
|
|
'Description' => %q{
|
2012-10-31 08:20:00 +00:00
|
|
|
This module reads the system internal NTP variables. These variables contain
|
|
|
|
potentially sensitive information, such as the NTP software version, operating
|
|
|
|
system version, peers, and more.
|
2012-10-18 23:03:28 +00:00
|
|
|
},
|
2012-10-31 08:20:00 +00:00
|
|
|
'Author' => [ 'Ewerson Guimaraes(Crash) <crash[at]dclabs.com.br>' ],
|
2012-10-18 23:03:28 +00:00
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
2012-10-31 08:20:00 +00:00
|
|
|
[ 'URL','http://www.rapid7.com/vulndb/lookup/ntp-clock-variables-disclosure' ],
|
|
|
|
]
|
2012-10-18 23:03:28 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(123)
|
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(ip)
|
|
|
|
|
|
|
|
connect_udp
|
|
|
|
|
|
|
|
readvar = "\x16\x02\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00" #readvar command
|
|
|
|
print_status("Connecting target #{rhost}:#{rport}...")
|
|
|
|
|
|
|
|
print_status("Sending command")
|
|
|
|
udp_sock.put(readvar)
|
|
|
|
reply = udp_sock.recvfrom(65535, 0.1)
|
2012-10-31 08:20:00 +00:00
|
|
|
if not reply or reply[0].empty?
|
|
|
|
print_error("#{rhost}:#{rport} - Couldn't read NTP variables")
|
|
|
|
return
|
|
|
|
end
|
|
|
|
p_reply = reply[0].split(",")
|
2012-10-18 23:03:28 +00:00
|
|
|
arr_count = 0
|
2012-10-31 08:20:00 +00:00
|
|
|
while ( arr_count < p_reply.size)
|
|
|
|
if arr_count == 0
|
|
|
|
print_good("#{rhost}:#{rport} - #{p_reply[arr_count].slice(12,p_reply[arr_count].size)}") #12 is the adjustment of packet garbage
|
|
|
|
arr_count = arr_count + 1
|
|
|
|
else
|
|
|
|
print_good("#{rhost}:#{rport} - #{p_reply[arr_count].strip}")
|
|
|
|
arr_count = arr_count + 1
|
|
|
|
end
|
|
|
|
end
|
2012-10-18 23:03:28 +00:00
|
|
|
disconnect_udp
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2012-10-31 00:25:23 +00:00
|
|
|
end
|