RFC 9109: Network Time Protocol Version 4: Port Randomization
- F. Gont,
- G. Gont,
- M. Lichvar
Abstract
The Network Time Protocol (NTP) can operate in several modes. Some of these
modes are based on the receipt of unsolicited packets and therefore
require the use of a well-known port as the local port. However, in
the case of NTP modes where the use of a well-known port is not required,
employing such a well-known port unnecessarily facilitates the ability of
attackers to perform blind/off-path attacks. This document formally
updates RFC 5905, recommending the use of transport
Status of This Memo
This is an Internet Standards Track document.¶
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 7841.¶
Information about the current status of this document, any
errata, and how to provide feedback on it may be obtained at
https://
Copyright Notice
Copyright (c) 2021 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(https://
1. Introduction
The Network Time Protocol (NTP) is one of the oldest Internet
protocols and is currently specified in [RFC5905]. Since its original
implementation, standardization
NTP can operate in several modes. Some of these modes rely on the ability of nodes to receive unsolicited packets and therefore require the use of the NTP well-known port (123). However, for modes where the use of a well-known port is not required, employing the NTP well-known port unnecessarily facilitates the ability of attackers to perform blind/off-path attacks (since knowledge of the port numbers is typically required for such attacks). A recent study [NIST-NTP] that analyzes the port numbers employed by NTP clients suggests that numerous NTP clients employ the NTP well-known port as their local port, or select predictable ephemeral port numbers, thus unnecessarily facilitating the ability of attackers to perform blind/off-path attacks against NTP.¶
BCP 156 [RFC6056] already recommends the randomization of transport
2. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.¶
3. Considerations about Port Randomization in NTP
The following subsections analyze a number of considerations about
transport
3.1. Mitigation against Off-Path Attacks
There has been a fair share of work in the area of blind/off-path
attacks against transport protocols and upper-layer protocols, such
as [RFC4953] and [RFC5927]. Whether the target of the attack is a
transport
As a result of these considerations, transport
We note that transport
3.2. Effects on Path Selection
Intermediate systems implementing the Equal-Cost Multipath (ECMP)
algorithm may select the outgoing link by computing a hash over a
number of values, including the transport
If the source port is changed with each request, packets in different exchanges will be more likely to take different paths, which could cause the measurements to be less stable and have a negative impact on the stability of the clock.¶
Network paths to/from a given server are less likely to change between requests if port randomization is applied on a per-association basis. This approach minimizes the impact on the stability of NTP measurements, but it may cause different clients in the same network synchronized to the same NTP server to have a significant stable offset between their clocks. This is due to their NTP exchanges consistently taking different paths with different asymmetry in the network delay.¶
Section 4 recommends that NTP implementations randomize the ephemeral port number of client/server associations. The choice of whether to randomize the port number on a per-association or a per-request basis is left to the implementation.¶
3.3. Filtering of NTP Traffic
In a number of scenarios (such as when mitigating DDoS attacks), a
network operator may want to differentiate between NTP requests sent
by clients and NTP responses sent by NTP servers. If an
implementation employs the NTP well-known port for the client port, requests
3.4. Effect on NAPT Devices
Some NAPT devices will reportedly not translate the source port of a packet when a system port number (i.e., a port number in the range 0-1023) [RFC6335] is employed. In networks where such NAPT devices are employed, use of the NTP well-known port for the client port may limit the number of hosts that may successfully employ NTP client implementations at any given time.¶
In the case of NAPT devices that will translate the source port even when a system port is employed, packets reaching the external realm of the NAPT will not employ the NTP well-known port as the source port, as a result of the port translation function being performed by the NAPT device.¶
4. Update to RFC 5905
The following text from Section 9.1 (Peer Process Variables) of [RFC5905]:¶
- dstport:
- UDP port number of the client, ordinarily the NTP port number PORT (123) assigned by the IANA. This becomes the source port number in packets sent from this association.¶
is replaced with:¶
- dstport:
- UDP port number of the client. In the case of broadcast server mode (5) and symmetric modes (1 and 2), it SHOULD contain the NTP port number PORT (123) assigned by IANA. In the client mode (3), it SHOULD contain a randomized port number, as specified in [RFC6056]. The value in this variable becomes the source port number of packets sent from this association. The randomized port number SHOULD NOT be shared with other associations, to avoid revealing the randomized port to other associations.¶
- If a client implementation performs transport
-protocol ephemeral port randomization on a per-request basis, it SHOULD close the corresponding socket/port after each request /response exchange. In order to prevent duplicate or delayed server packets from eliciting ICMP port unreachable error messages [RFC0792] [RFC4443] at the client, the client MAY wait for more responses from the server for a specific period of time (e.g., 3 seconds) before closing the UDP socket/port.¶
NOTES:¶
Randomizing the ephemeral port number on a per-request basis will better mitigate blind/off-path attacks, particularly if the socket/port is closed after each request
/response exchange, as recommended above. The choice of whether to randomize the ephemeral port number on a per-request or a per-association basis is left to the implementation, and it should consider the possible effects on path selection along with its possible impact on time measurement.¶ - On most current operating systems, which implement ephemeral port randomization [RFC6056], an NTP client may normally rely on the operating system to perform ephemeral port randomization. For example, NTP implementations using POSIX sockets may achieve ephemeral port randomization by not binding the socket with the bind() function or binding it to port 0, which has a special meaning of "any port". Using the connect() function for the socket will make the port inaccessible by other systems (that is, only packets from the specified remote socket will be received by the application).¶
5. IANA Considerations
This document has no IANA actions.¶
6. Security Considerations
The security implications of predictable numeric identifiers
[PEARG
This issue has been assigned CVE-2019-11331 [VULN-REPORT] in the U.S. National Vulnerability Database (NVD).¶
7. References
7.1. Normative References
- [RFC2119]
-
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10
.17487 , , <https:///RFC2119 www >..rfc -editor .org /info /rfc2119 - [RFC5905]
-
Mills, D., Martin, J., Ed., Burbank, J., and W. Kasch, "Network Time Protocol Version 4: Protocol and Algorithms Specification", RFC 5905, DOI 10
.17487 , , <https:///RFC5905 www >..rfc -editor .org /info /rfc5905 - [RFC6056]
-
Larsen, M. and F. Gont, "Recommendations for Transport
-Protocol Port Randomization" , BCP 156, RFC 6056, DOI 10.17487 , , <https:///RFC6056 www >..rfc -editor .org /info /rfc6056 - [RFC8174]
-
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10
.17487 , , <https:///RFC8174 www >..rfc -editor .org /info /rfc8174
7.2. Informative References
- [NIST-NTP]
-
Sherman, J. and J. Levine, "Usage Analysis of the NIST Internet Time Service", Journal of Research of the National Institute of Standards and Technology, Volume 121, DOI 10
.6028 , , <https:///jres .121 .003 tf >..nist .gov /general /pdf /2818 .pdf - [NTP-CHLNG]
-
Sommars, S., "Challenges in Time Transfer using the Network Time Protocol (NTP)", Proceedings of the 48th Annual Precise Time and Time Interval Systems and Applications Meeting, pp. 271-290, DOI 10
.33012 , , <http:///2017 .14978 leapsecond >..com /ntp /NTP _Paper _Sommars _PTTI2017 .pdf - [NTP
-DATA -MINIMIZATION] -
Franke, D. and A. Malhotra, "NTP Client Data Minimization", Work in Progress, Internet-Draft, draft
-ietf , , <https://-ntp -data -minimization -04 datatracker >..ietf .org /doc /html /draft -ietf -ntp -data -minimization -04 - [NTP-FRAG]
-
Malhotra, A., Cohen, I., Brakke, E., and S. Goldberg, "Attacking the Network Time Protocol", NDSS '16, DOI 10
.14722 , , <https:///ndss .2016 .23090 www >..cs .bu .edu /~goldbe /papers /NTPattack .pdf - [NTP-security]
-
Malhotra, A., Van Gundy, M., Varia, M., Kennedy, H., Gardner, J., and S. Goldberg, "The Security of NTP's Datagram Protocol", Cryptology ePrint Archive Report 2016/1006, DOI 10
.1007 , , <https:///978 -3 -319 -70972 -7 _23 eprint >..iacr .org /2016 /1006 .pdf - [NTP-VULN]
-
"Network Time Foundation", <http://
support >..ntp .org /bin /view /Main /Security Notice - [PEARG
-NUMERIC -IDS] -
Gont, F. and I. Arce, "On the Generation of Transient Numeric Identifiers", Work in Progress, Internet-Draft, draft
-irtf , , <https://-pearg -numeric -ids -generation -07 datatracker >..ietf .org /doc /html /draft -irtf -pearg -numeric -ids -generation -07 - [RFC0792]
-
Postel, J., "Internet Control Message Protocol", STD 5, RFC 792, DOI 10
.17487 , , <https:///RFC0792 www >..rfc -editor .org /info /rfc792 - [RFC2663]
-
Srisuresh, P. and M. Holdrege, "IP Network Address Translator (NAT) Terminology and Considerations", RFC 2663, DOI 10
.17487 , , <https:///RFC2663 www >..rfc -editor .org /info /rfc2663 - [RFC3715]
-
Aboba, B. and W. Dixon, "IPsec-Network Address Translation (NAT) Compatibility Requirements", RFC 3715, DOI 10
.17487 , , <https:///RFC3715 www >..rfc -editor .org /info /rfc3715 - [RFC4443]
-
Conta, A., Deering, S., and M. Gupta, Ed., "Internet Control Message Protocol (ICMPv6) for the Internet Protocol Version 6 (IPv6) Specification", STD 89, RFC 4443, DOI 10
.17487 , , <https:///RFC4443 www >..rfc -editor .org /info /rfc4443 - [RFC4953]
-
Touch, J., "Defending TCP Against Spoofing Attacks", RFC 4953, DOI 10
.17487 , , <https:///RFC4953 www >..rfc -editor .org /info /rfc4953 - [RFC5927]
-
Gont, F., "ICMP Attacks against TCP", RFC 5927, DOI 10
.17487 , , <https:///RFC5927 www >..rfc -editor .org /info /rfc5927 - [RFC6335]
-
Cotton, M., Eggert, L., Touch, J., Westerlund, M., and S. Cheshire, "Internet Assigned Numbers Authority (IANA) Procedures for the Management of the Service Name and Transport Protocol Port Number Registry", BCP 165, RFC 6335, DOI 10
.17487 , , <https:///RFC6335 www >..rfc -editor .org /info /rfc6335 - [VULN-REPORT]
-
The MITRE Corporation, "CVE-2019-1133", National Vulnerability Database, , <https://
cve >..mitre .org /cgi -bin /cvename .cgi ?name =CVE -2019 -11331
Acknowledgments
The authors would like to thank (in alphabetical order) Ivan Arce, Roman Danyliw, Dhruv Dhody, Lars Eggert, Todd Glassey, Blake Hudson, Benjamin Kaduk, Erik Kline, Watson Ladd, Aanchal Malhotra, Danny Mayer, Gary E. Miller, Bjorn Mork, Hal Murray, Francesca Palombini, Tomoyuki Sahara, Zaheduzzaman Sarker, Dieter Sibold, Steven Sommars, Jean St-Laurent, Kristof Teichel, Brian Trammell, Éric Vyncke, Ulrich Windl, and Dan Wing for providing valuable comments on earlier draft versions of this document.¶
Watson Ladd raised the problem of DDoS mitigation when the NTP well-known port is employed as the client port (discussed in Section 3.3 of this document).¶
The authors would like to thank Harlan Stenn for answering questions
about a popular NTP implementation (see <https://
Fernando Gont would like to thank Nelida Garcia and Jorge Oscar Gont for their love and support.¶