Score:1

How to test whether NTP server is secured or not

us flag

We are trying few of the configurations of NTP in ntp.conf file and want to be sure whether the NTP server is secured or not.

Following the recommendation provided here: https://support.ntp.org/Support/AccessRestrictions#Section_6.5.1.2.1.

we added :

IPV4: restrict -4 default limited kod nomodify notrap nopeer noquery

IPv6: restrict -6 default limited kod nomodify notrap nopeer noquery

Now the question is : Based on the line written in documentation:

Since you are willing to allow others to get the time from your ntpd, will you allow them to see your server status information (even though this can reveal information about your OS and ntpd version)?

How can we be sure whether the server is sending its status or some other OS info or not ?

Further, what's the difference if we don't add 'noquery' option in restriction and how can we test with and without 'noquery' option i.e. whether adding such option has some reflection or not ? (We want to test from security point of view)

Can we use wireshark to retrieve status or OS info to test out our conf options ?

Score:3
cn flag

The reference ntpd implementation exposes many of its implementation variables via the programs ntpq (and ntpdc which is something only its author appreciates). These make use of a control protocol in special NTP packets. It is possible the control channel can change ntpd configuration, although this is rarely used in the modern era where you can automate deploying configuration files to any number of hosts.

Risks of maintaining ntpd are primarily preventing IP amplification to spoofed addresses, and protecting your time sync configuration against change from unauthorized IP addresses on the networks.

As always, keeping patched mitigates some flaws. An amplification attack via the "monlist" function resulted in CVE-2013-5211. This should have been an update years ago, but check that all of your hosts are on a supported distro, and receive attention from a maintainer.

All the attention to monlist resulted in some tools to easily scan for it. For example, nmap script ntp-monlist.

The full list of functions is the commands documented for ntpq. Those lines in the wiki's choose-your-own-configuration differ by noquery, which denies all ntpq queries entirely. Keeping time service running. For example, that nmap script would not return anything. Contrast to nomodfy is an access rule controlling only the commands that change the configuration. Clearly nomodify should be heavily restricted, possibly to only localhost.

Compare to example configurations elsewhere, such as from your favorite disto's package. RHEL 7's ntp.conf suggests this as a starting point for access control:

# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default nomodify notrap nopeer noquery
    
# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
    
restrict 127.0.0.1 
restrict ::1
    
# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
    
# Disable the monitoring facility to prevent amplification attacks using ntpdc  
# monlist command when default restrict does not include the noquery flag. See
# CVE-2013-5211 for more details.
# Note: Monitoring will not be disabled with the limited restriction flag.
disable monitor

Note monlist mitigation even though ntpd is patched by now. Further, the default for remote hosts cannot query or modify. With light modification, this could make for a NTP host ready to serve the public internet.

Naturally once you know what ntp.conf you want, deploy that. Automate the configuration of NTP servers, get a reasonable config in the template images of all hosts.

All this monlist discussion doesn't cover your original question about OS and platform identification via ntp. Per ntpq docs, that build information may appear in system variables via the readvar control command. As in, to a remote server: ntpq -c readvar time.example.net. Although there are some implementation details to decode here, like which association ID is the NTP host in question.

Personally, I am not very concerned about exposing build information about ntpd. Someone learns my ntpd is up to date, and some of the state machine, not much they can do with that. An attacker would spray forged NTP packets to every host they can, in the hopes of amplification.

Anon avatar
us flag
Thanks for this detailed answer. This is exactly what I was looking for.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.