RFC 8915
Network Time Security for the Network Time Protocol
Network Time Security for the Network Time Protocol π
bestie, the title block is giving main character energy π RFC 8915 is an IETF Standards Track document, published in September 2020 under ISSN 2070-1721. The authors are D. Franke (Akamai), D. Sibold and K. Teichel (PTB), M. Dansarie (no affiliation listed in the header), and R. Sundblad (Netnod). The header doesn't list anything this RFC obsoletes or updates π¦
Abstract
okay so this memo defines Network Time Security (NTS) π It's a way to use Transport Layer Security (TLS) and Authenticated Encryption with Associated Data (AEAD) to lock down the client-server mode of the Network Time Protocol (NTP). the vibe is secure time sync, fr fr β°
NTS is split into two loosely coupled sub-protocols, and they're iconic together π The first one, NTS Key Establishment (NTS-KE), handles the initial authentication and key setup over TLS π€ The second one, NTS Extension Fields for NTPv4, does the encryption and authentication while time is actually syncing, using extension fields in the NTP packets. The lowkey genius part is that all the required state lives only on the client, stored in opaque cookies πͺ The server doesn't have to remember anyone π§
Status of This Memo
this is an Internet Standards Track document π
it's a product of the Internet Engineering Task Force (IETF) π It represents the consensus of the IETF community, got public review, and was approved for publication by the Internet Engineering Steering Group (IESG). More info on Internet Standards is in Section 2 of RFC 7841 π
for the current status, any errata, and how to send feedback, check https://www.rfc-editor.org/info/rfc8915 π«Ά
Copyright Notice
Copyright (c) 2020 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://trustee.ietf.org/license-info) as they stand on the publication date. please read them carefully, because they spell out your rights and restrictions π§Ύ Code Components pulled out of this document must include the Simplified BSD License text, as described in Section 4.e of the Trust Legal Provisions, and they come with no warranty, as the Simplified BSD License describes π
Table of Contents
1. Introduction
1.1. Objectives
1.2. Terms and Abbreviations
1.3. Protocol Overview
2. Requirements Language
3. TLS Profile for Network Time Security
4. The NTS Key Establishment Protocol
4.1. NTS-KE Record Types
4.1.1. End of Message
4.1.2. NTS Next Protocol Negotiation
4.1.3. Error
4.1.4. Warning
4.1.5. AEAD Algorithm Negotiation
4.1.6. New Cookie for NTPv4
4.1.7. NTPv4 Server Negotiation
4.1.8. NTPv4 Port Negotiation
4.2. Retry Intervals
4.3. Key Extraction (Generally)
5. NTS Extension Fields for NTPv4
5.1. Key Extraction (for NTPv4)
5.2. Packet Structure Overview
5.3. The Unique Identifier Extension Field
5.4. The NTS Cookie Extension Field
5.5. The NTS Cookie Placeholder Extension Field
5.6. The NTS Authenticator and Encrypted Extension Fields
Extension Field
5.7. Protocol Details
6. Suggested Format for NTS Cookies
7. IANA Considerations
7.1. Service Name and Transport Protocol Port Number Registry
7.2. TLS Application-Layer Protocol Negotiation (ALPN) Protocol
IDs Registry
7.3. TLS Exporter Labels Registry
7.4. NTP Kiss-o'-Death Codes Registry
7.5. NTP Extension Field Types Registry
7.6. Network Time Security Key Establishment Record Types
Registry
7.7. Network Time Security Next Protocols Registry
7.8. Network Time Security Error and Warning Codes Registries
8. Security Considerations
8.1. Protected Modes
8.2. Cookie Encryption Key Compromise
8.3. Sensitivity to DDoS Attacks
8.4. Avoiding DDoS Amplification
8.5. Initial Verification of Server Certificates
8.6. Delay Attacks
8.7. NTS Stripping
9. Privacy Considerations
9.1. Unlinkability
9.2. Confidentiality
10. References
10.1. Normative References
10.2. Informative References
Acknowledgments
Authors' Addresses
1. Introduction β¨
so this memo is all about Network Time Security (NTS), a cryptographic security mechanism for network time sync π The complete spec covers applying NTS to the client-server mode of the Network Time Protocol (NTP) [RFC5905] π«§
1.1. Objectives
these are the goals NTS is going for, and they're so ambitious π―
- Identity: with an X.509 public key infrastructure, implementations can cryptographically prove who they're talking to πͺͺ
- Authentication: implementations can cryptographically verify that time sync packets are authentic. That means they were made by an identified party and weren't changed in transit π΅οΈββοΈ
- Confidentiality: basic time sync data is considered nonconfidential and goes out in the clear πΈ but NTS supports encrypting NTP extension fields, which is the glow-up π
- Replay prevention: client implementations can notice when a time sync packet they got is a replay of an older one π
- Request-response consistency: client implementations can check that a time sync packet from the server was actually sent in reply to a specific request from the client π
- Unlinkability: for mobile clients, NTS won't leak anything beyond what NTP already leaks that would let a passive adversary figure out that two packets sent over different networks came from the same client π¦ this is a privacy queen move π
- Non-amplification: implementations (especially servers) can avoid being used as distributed denial-of-service (DDoS) amplifiers by never answering a request with a packet bigger than the request packet π‘οΈ
- Scalability: server implementations can serve tons of clients without keeping any client-specific state π§
- Performance: NTS must not significantly degrade the quality of the time transfer π the encryption and authentication used when actually transferring time should be lightweight (see Section 5.7 of RFC 7384 [RFC7384]) π
1.2. Terms and Abbreviations
here's the glossary, so we're all on the same page π
AEAD Authenticated Encryption with Associated Data [RFC5116]
ALPN Application-Layer Protocol Negotiation [RFC7301]
C2S Client-to-server
DoS Denial-of-Service
DDoS Distributed Denial-of-Service
EF Extension Field [RFC5905]
HKDF Hashed Message Authentication Code-based Key Derivation
Function [RFC5869]
KoD Kiss-o'-Death [RFC5905]
NTP Network Time Protocol [RFC5905]
NTS Network Time Security
NTS NAK NTS negative-acknowledgment
NTS-KE Network Time Security Key Establishment
S2C Server-to-client
TLS Transport Layer Security [RFC8446]
1.3. Protocol Overview π§
okay so NTP has like a bunch of operating modes for different network setups (see Section 3 of RFC 5905 [RFC5905]) πΈ Its most famous one is client-server mode, but it also has symmetric peer mode, a control mode for monitoring and admin stuff, and broadcast mode. ngl these modes want totally different things for security and performance, and some of them clash. Symmetric and control modes need mutual authentication and mutual replay protection π Control mode might also need confidentiality plus authentication for certain message types. Client-server mode is the one with the strictest resource limits, because a server might have a huge number of clients and can't afford to track state for every single one π But it also has the chillest security needs, since only the client needs replay protection. It's totally fine for a stateless server to process replayed packets π The symmetric and control modes want the opposite, though. Any scheme that gives replay protection inherently means keeping some state so you know which messages you've already seen, and that clashes with what client-server mode needs π
This memo specifies NTS exclusively for the client-server mode of NTP β¨ To do that, NTS is built as a suite of two protocols:
- The "NTS Extension Fields for NTPv4" are a set of NTP extension fields for cryptographically securing NTPv4 using key material that's already been set up. They're perfect for client-server mode because the server can use them without keeping per-client state π¦ All the state lives with the client, which hands it to the server as an encrypted cookie in every request. The NTS Extension Fields are only for client-server mode, though, because only the client gets protected from replay, not the server π«Ά
- The "NTS Key Establishment" protocol (NTS-KE) is how you set up the key material the NTS Extension Fields for NTPv4 use π It runs over TLS to establish keys, hand the client an initial batch of cookies, and negotiate a few extra protocol options. After that, the TLS channel closes and the server keeps no per-client state at all π
Here's the typical flow. The client connects to an NTS-KE server on the NTS TCP port, and the two do a TLS handshake π€ Over that channel they negotiate some extra protocol parameters, and the server sends the client a batch of cookies plus an address and port of an NTP server those cookies work with. Both sides use TLS key export [RFC5705] to pull out the key material for the next phase ποΈ That whole negotiation takes just one round trip, then the server closes the connection and throws away all the associated state. And boom, the NTS-KE phase is done β Ideally the client never has to hit the NTS-KE server again π
Time sync then happens with the NTP server it was pointed to. The client sends the server an NTP client packet with a bunch of extension fields. Those include a cookie (given to it earlier by the key establishment server) and an authentication tag, computed with the key material from the NTS-KE handshake π The NTP server uses the cookie to recover that key material and sends back an authenticated response. The response also comes with a fresh, encrypted cookie, which the client then sends back in the clear on its next request. Constantly refreshing cookies like this is what gets NTS its unlinkability goal π΅οΈββοΈβ¨
Figure 1 gives you the big-picture view of how the client, the NTS-KE server, and the NTP server interact π Heads up: the cookie data format and how secrets get shared between NTS-KE and NTP servers are not part of this spec, they're implementation dependent π A suggested format for NTS cookies is provided in Section 6, though π
+--------------+
| |
+-> | NTP Server 1 |
| | |
Shared cookie | +--------------+
+---------------+ encryption parameters | +--------------+
| | (Implementation dependent) | | |
| NTS-KE Server | <------------------------------+-> | NTP Server 2 |
| | | | |
+---------------+ | +--------------+
^ | .
| | .
| 1. Negotiate parameters, | .
| receive initial cookie | +--------------+
| supply, generate AEAD keys, | | |
| and receive NTP server IP +-> | NTP Server N |
| addresses using "NTS Key | |
| Establishment" protocol. +--------------+
| ^
| |
| +----------+ |
| | | |
+-----------> | Client | <-------------------------+
| | 2. Perform authenticated
+----------+ time synchronization
and generate new
cookies using "NTS
Extension Fields for
NTPv4".
Figure 1: Overview of High-Level Interactions in NTS
2. Requirements Language π
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 π Only the all-caps versions carry that special meaning, so lowercase words are just regular English π«Ά
3. TLS Profile for Network Time Security π
Network Time Security uses TLS for NTS key establishment π
Since the NTS protocol is brand new as of this publication, there are no backward-compatibility reasons to use obsolete, insecure, or otherwise broken TLS features or versions π ββοΈ Implementations MUST conform with RFC 7525 [RFC7525] or with a later revision of BCP 195 β¨
Implementations MUST NOT negotiate TLS versions earlier than 1.3 [RFC8446], and they MAY refuse to negotiate any TLS version that's been superseded by a later supported version π
Use of the Application-Layer Protocol Negotiation Extension [RFC7301] is integral to NTS π¦ Support for it is REQUIRED for interoperability, no exceptions π«Ά
Implementations MUST follow the rules in RFC 5280 [RFC5280] and RFC 6125 [RFC6125] for representing and verifying the application's service identity π When NTS-KE service discovery (out of scope for this document) produces one or more host names, use of the DNS-ID identifier type [RFC6125] is RECOMMENDED πΈ Service discovery mechanisms can give more guidance on certificate validation based on what discovery turned up. Section 8.5 of this memo digs into the specific certificate verification considerations for NTS, so go check that out π
4. The NTS Key Establishment Protocol β¨
okay bestie, let's talk about how NTS key establishment actually works π It runs over TCP port 4460 π. The two endpoints do a TLS handshake that follows Section 3 (the TLS profile we just covered π§). The client offers an application-layer protocol of "ntske/1" through an ALPN extension [RFC7301], and the server accepts it. Right after a successful handshake, the client SHALL send a single request as Application Data inside the TLS-protected channel π. Then the server SHALL send a single response. After they've both sent their request and response, the client and server SHALL send TLS "close_notify" alerts, following Section 6.1 of RFC 8446 [RFC8446] π¦.
The client's request and the server's response each SHALL consist of a sequence of records formatted according to Figure 2. The request and a non-error response each SHALL include exactly one NTS Next Protocol Negotiation record. The sequence SHALL be terminated by a "End of Message" record. The requirement that all NTS-KE messages end with an End of Message record is what makes them self-delimiting, which is so clever π§ β¨
Clients and servers MAY enforce length limits on requests and responses. However, servers MUST accept requests of at least 1024 octets, and clients SHOULD accept responses of at least 65536 octets πΈ
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|C| Record Type | Body Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
. .
. Record Body .
. .
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 2: NTS-KE Record Format
Here's how the fields of an NTS-KE record work π
C(Critical Bit): This decides what happens to unrecognized Record Types. Implementations that receive a record with an unrecognized Record Type MUST ignore the record if the Critical Bit is 0, and MUST treat it as an error if the Critical Bit is 1 (see Section 4.1.3).- Record Type Number: A 15-bit integer in network byte order. The semantics of Record Types 0-7 are specified in this memo. Additional type numbers SHALL be tracked through the IANA "Network Time Security Key Establishment Record Types" registry.
- Body Length: The length of the Record Body field, in octets, as a 16-bit integer in network byte order. Record bodies MAY have any representable length, and they don't need to be aligned to a word boundary.
- Record Body: The syntax and semantics of this field SHALL be determined by the Record Type.
For clarity on bit-endianness: the Critical Bit is the most significant bit of the first octet. In C, if you have a network buffer unsigned char b[] holding an NTS-KE record, the critical bit is b[0] >> 7, and the record type is ((b[0] & 0x7f) << 8) + b[1] π€
Now, the NTS-KE record is kind of similar to an NTP extension field, since both use a Type-Length-Body format. But the length field works differently! An NTP extension field's length covers the entire extension field, including its type and length subfields. The length field of an NTS-KE record only gives the length of the body. Don't mix them up, bestie π
Figure 3 is a quick schematic of the whole key establishment flow. It shows the steps the NTS client and server take, plus the Record Types they swap π¦
+---------------------------------------+
| - Verify client request message. |
| - Extract TLS key material. |
| - Generate KE response message. |
| - Include Record Types: |
| o NTS Next Protocol Negotiation |
| o AEAD Algorithm Negotiation |
| o <NTPv4 Server Negotiation> |
| o <NTPv4 Port Negotiation> |
| o New Cookie for NTPv4 |
| o <New Cookie for NTPv4> |
| o End of Message |
+-----------------+---------------------+
|
|
Server -----------+---------------+-----+----------------------->
^ \
/ \
/ TLS application \
/ data \
/ \
/ V
Client -----+---------------------------------+----------------->
| |
| |
| |
+-----------+----------------------+ +------+-----------------+
|- Generate KE request message. | |- Verify server response|
| - Include Record Types: | | message. |
| o NTS Next Protocol Negotiation | |- Extract cookie(s). |
| o AEAD Algorithm Negotiation | +------------------------+
| o <NTPv4 Server Negotiation> |
| o <NTPv4 Port Negotiation> |
| o End of Message |
+----------------------------------+
Figure 3: NTS Key Establishment Messages
4.1. NTS-KE Record Types
The following NTS-KE Record Types are defined π
4.1.1. End of Message
The End of Message record has a Record Type number of 0 and a zero-length body. It MUST occur exactly once, as the final record of every NTS-KE request and response. The Critical Bit MUST be set π
4.1.2. NTS Next Protocol Negotiation
The NTS Next Protocol Negotiation record has a Record Type number of 1. It MUST occur exactly once in every NTS-KE request and response. Its body is a sequence of 16-bit unsigned integers in network byte order. Each integer is a Protocol ID from the IANA "Network Time Security Next Protocols" registry (Section 7.7). The Critical Bit MUST be set.
The Protocol IDs in the client's NTS Next Protocol Negotiation record are the protocols the client wants to speak with the key material set up in this NTS-KE session. The Protocol IDs in the NTS-KE server's response MUST be a subset of the ones in the request. They're the protocols the NTP server is willing and able to speak with that same key material. The client MAY go ahead with one or more of them. The request MUST list at least one protocol, but the response MAY be empty π
4.1.3. Error
The Error record has a Record Type number of 2. Its body is exactly two octets long, an unsigned 16-bit integer in network byte order, which denotes an error code. The Critical Bit MUST be set.
Clients MUST NOT include Error records in their request. If a client gets a server response that includes an Error record, it MUST discard any key material negotiated during the initial TLS exchange, and it MUST NOT proceed to the Next Protocol. Requirements for retry intervals are described in Section 4.2 β οΈ
The following error codes are defined:
- Error code 0 means "Unrecognized Critical Record". The server MUST respond with this error code if the request included a record that the server did not understand and that had its Critical Bit set. The client SHOULD NOT retry its request without modification.
- Error code 1 means "Bad Request". The server MUST respond with this error if the request is not complete and syntactically well-formed, or, upon the expiration of an implementation-defined timeout, if it has not yet received such a request. The client SHOULD NOT retry its request without modification.
- Error code 2 means "Internal Server Error". The server MUST respond with this error if it is unable to respond properly due to an internal condition. The client MAY retry its request.
4.1.4. Warning
The Warning record has a Record Type number of 3. Its body is exactly two octets long, an unsigned 16-bit integer in network byte order, which denotes a warning code. The Critical Bit MUST be set.
Clients MUST NOT include Warning records in their request. If a client gets a server response that includes a Warning record, it MAY discard any negotiated key material and abort without proceeding to the Next Protocol. Unrecognized warning codes MUST be treated as errors.
This memo defines no warning codes π
4.1.5. AEAD Algorithm Negotiation
The AEAD Algorithm Negotiation record has a Record Type number of 4. Its body is a sequence of unsigned 16-bit integers in network byte order, denoting Numeric Identifiers from the IANA "AEAD Algorithms" registry [IANA-AEAD]. The Critical Bit MAY be set.
If the NTS Next Protocol Negotiation record offers Protocol ID 0 (for NTPv4), then this record MUST be included exactly once. Other protocols MAY require it as well π
In a request, this record shows which AEAD algorithms the client is willing to use to secure the Next Protocol, listed in decreasing order of preference. In a response, it shows which algorithm the server picked. It's empty if the server doesn't support any of the algorithms offered. In requests, the list MUST include at least one algorithm. In responses, it MUST include at most one. Honoring the client's preference order is OPTIONAL: servers may choose any of the client's offered options, even if they can support some other algorithm the client likes more π€·ββοΈ
Server implementations of NTS Extension Fields for NTPv4 (Section 5) MUST support AEAD_AES_SIV_CMAC_256 [RFC5297] (Numeric Identifier 15). That means that if the client includes AEAD_AES_SIV_CMAC_256 in its AEAD Algorithm Negotiation record, and the server accepts Protocol ID 0 (NTPv4) in its NTS Next Protocol Negotiation record, then the server's AEAD Algorithm Negotiation record MUST NOT be empty π
4.1.6. New Cookie for NTPv4
The New Cookie for NTPv4 record has a Record Type number of 5. The contents of its body SHALL be implementation-defined, and clients MUST NOT attempt to interpret them. See Section 6 for a suggested construction π
Clients MUST NOT send records of this type. Servers MUST send at least one record of this type, and SHOULD send eight of them, if the Next Protocol Negotiation response record contains Protocol ID 0 (NTPv4) and the AEAD Algorithm Negotiation response record is not empty. The Critical Bit SHOULD NOT be set π
4.1.7. NTPv4 Server Negotiation π°οΈ
Okay so the NTPv4 Server Negotiation record is Record Type number 6 π Its body is an ASCII-encoded [RFC0020] string, and the contents SHALL be either an IPv4 address, an IPv6 address, or a fully qualified domain name (FQDN) π IPv4 addresses MUST be in dotted decimal notation, no other vibes allowed π IPv6 addresses MUST conform to the "Text Representation of Addresses" as specified in RFC 4291 [RFC4291], and they MUST NOT include zone identifiers [RFC6874]. If a label has at least one non-ASCII character, it's an internationalized domain name, and an A-LABEL MUST be used as defined in Section 2.3.2.1 of RFC 5890 [RFC5890]. If the record has a domain name in it, the recipient MUST treat it as a FQDN, e.g., by making sure it ends with a dot π
When NTPv4 is negotiated as a Next Protocol and the server sends this record, the body tells the client which NTPv4 server to associate with, the one that will accept the supplied cookies β¨ It's a hostname or an IP address. If the server doesn't send one of these, the client SHALL interpret that as a directive to associate with an NTPv4 server at the same IP address as the NTS-KE server π§ Servers MUST NOT send more than one record of this type, so don't be greedy, bestie π
When the client sends this record, it's basically saying "I'd like to hang with this NTP server, please" π₯Ή The NTS-KE server MAY incorporate that request when it decides which NTPv4 Server Negotiation records to reply with, but honoring the client's preference is OPTIONAL π«Ά The client MUST NOT send more than one record of this type.
If the client sent one of these and it's valid and the server can supply cookies for it, the NTS-KE server SHOULD reply with the same record π If the client didn't send any, the NTS-KE server SHOULD respond with either an NTP server address in the same family as the NTS-KE session, or a FQDN that resolves to an address in that family, as long as those alternatives are available π¦
Servers MAY set the Critical Bit on records of this type, but clients SHOULD NOT π
4.1.8. NTPv4 Port Negotiation π
The NTPv4 Port Negotiation record is Record Type number 7 π Its body is a 16-bit unsigned integer in network byte order, and it denotes a UDP port number π
When NTPv4 is negotiated as a Next Protocol and the server sends this record, the body tells the client the port number of the NTPv4 server to associate with, the one that will accept the supplied cookies β¨ If no record of this type shows up, the client SHALL assume a default of 123, which is the registered port number for NTP π
When the client sends this record along with an NTPv4 Server Negotiation record, it means the client wants to hang with the NTP server on that specific port π¦ The NTS-KE server MAY incorporate this request when it decides what NTPv4 Server Negotiation and NTPv4 Port Negotiation records to reply with, but honoring the client's preference is OPTIONAL π«Ά
Servers MAY set the Critical Bit on records of this type, but clients SHOULD NOT π
4.2. Retry Intervals β°
Okay, this part is so important π When the key establishment process gets retried because of protocol, communication, or other errors, there MUST be a way to avoid unnecessarily overloading the NTS-KE server. Sorry, I need to fix that: there is a mechanism REQUIRED for this, and it's not optional π How exactly it works will depend on the application and on what operational experience builds up over time. Until that experience exists, this memo offers the following suggestion πΈ
Clients SHOULD use exponential backoff, with an initial and minimum retry interval of 10 seconds, a maximum retry interval of 5 days, and a base of 1.5 π So the minimum interval in seconds, 't', for the nth retry gets calculated like this:
t = min(10 * 1.5^(n-1), 432000).
Clients MUST NOT reset the retry interval until they've completed a successful key establishment with the NTS-KE server, followed by a successful use of the negotiated Next Protocol with the keys and data established during that transaction π No shortcuts, babe.
4.3. Key Extraction (Generally) π
After a successful run of the NTS-KE protocol, key material SHALL be extracted using the HMAC-based Extract-and-Expand Key Derivation Function (HKDF) [RFC5869], following Section 7.5 of RFC 8446 [RFC8446] π§ How the inputs to the exporter function get built is specific to the negotiated Next Protocol. However, all protocols that use NTS-KE MUST follow these two rules:
- The disambiguating label string [RFC5705] MUST be
"EXPORTER-network-time-security". - The per-association context value [RFC5705] MUST be provided, and it MUST begin with the two-octet Protocol ID that was negotiated as a Next Protocol π«§
5. NTS Extension Fields for NTPv4 π¦
5.1. Key Extraction (for NTPv4) ποΈ
Okay, the main event: after a successful NTS-KE run where Protocol ID 0 (NTPv4) gets selected as a Next Protocol, two AEAD keys SHALL be extracted π One is the client-to-server (C2S) key, and the other is the server-to-client (S2C) key. These keys SHALL be computed with the HKDF defined in Section 7.5 of RFC 8446 [RFC8446], using these inputs:
- The disambiguating label string [RFC5705] SHALL be
"EXPORTER-network-time-security". - The per-association context value [RFC5705] SHALL consist of the following five octets:
- The first two octets SHALL be zero (the Protocol ID for NTPv4).
- The next two octets SHALL be the Numeric Identifier of the negotiated AEAD algorithm in network byte order.
- The final octet SHALL be 0x00 for the C2S key and 0x01 for the S2C key.
Implementations that want to derive additional keys for private or experimental use MUST NOT do that by extending the syntax above for per-association context values π
ββοΈ Instead, they SHOULD use their own disambiguating label string. Also, RFC 5705 [RFC5705] says disambiguating label strings beginning with "EXPERIMENTAL" MAY be used without IANA registration π§ͺ
5.2. Packet Structure Overview π¦
Here's the vibe check on an NTS-protected NTPv4 packet. In general, it has the following pieces:
- The usual 48-octet NTP header, which is authenticated but not encrypted.
- Some extension fields, which are authenticated but not encrypted.
- An extension field that contains AEAD output (i.e., an authentication tag and possible ciphertext). The corresponding plaintext, if it's non-empty, consists of some extension fields that get both encryption and authentication π₯
- Possibly, some additional extension fields that are neither encrypted nor authenticated. In general, the receiver discards these ποΈ
Always included among the authenticated or authenticated-and-encrypted extension fields are a cookie extension field and a unique identifier extension field, as described in Section 5.7 π The cookie extension field lets the server offload storage of session state onto the client, which is so smart π§ The unique identifier extension field protects the client from replay attacks π‘οΈ
5.3. The Unique Identifier Extension Field π
The Unique Identifier extension field gives the client a cryptographically strong way to detect replayed packets π Its Field Type is 0x0104. When this extension field is included in a client packet (mode 3), its body SHALL consist of a string of octets generated by a cryptographically secure random number generator [RFC4086]. The string MUST be at least 32 octets long πͺ When this extension field is included in a server packet (mode 4), its body SHALL contain the same octet string that was provided in the client packet the server is responding to. All server packets generated by NTS-implementing servers in response to client packets containing this extension field MUST also contain this field, with the same content as in the client's request π«Ά Its use in modes other than client-server is not defined.
This extension field MAY also be used standalone, without NTS. In that case, it gives the client a way to detect spoofed packets from off-path attackers π Historically, NTP's origin timestamp field has played both of these roles, but that's suboptimal for cryptographic purposes. It's only 64 bits long, and depending on implementation details, most of those bits may be predictable π¬ In contrast, the Unique Identifier extension field enables a degree of unpredictability and collision resistance that's more consistent with cryptographic best practice β¨
5.4. The NTS Cookie Extension Field πͺ
The NTS Cookie extension field has a Field Type of 0x0204. Its purpose is to carry information that lets the server recompute keys and other session state without having to store any per-client state π§ The contents of its body SHALL be implementation-defined, and clients MUST NOT attempt to interpret them π See Section 6 for a suggested construction. The NTS Cookie extension field MUST NOT be included in NTP packets whose mode is other than 3 (client) or 4 (server) π«
5.5. The NTS Cookie Placeholder Extension Field πͺ
The NTS Cookie Placeholder extension field has a Field Type of 0x0304. When this extension field is included in a client packet (mode 3), it tells the server that the client wants it to send additional cookies in its response π This extension field MUST NOT be included in NTP packets whose mode is other than 3.
Whenever an NTS Cookie Placeholder extension field is present, it MUST be accompanied by an NTS Cookie extension field π― The body length of the NTS Cookie Placeholder extension field MUST be the same as the body length of the NTS Cookie extension field. This length requirement makes sure the response won't be larger than the request, which helps timekeeping precision and prevents DDoS amplification π‘οΈ The contents of the NTS Cookie Placeholder extension field's body SHOULD be all zeros and, aside from checking its length, MUST be ignored by the server π«§
5.6. The NTS Authenticator and Encrypted Extension Fields Extension Field π
okay bestie, this is THE main one β¨ The NTS Authenticator and Encrypted Extension Fields extension field is the central cryptographic element of an NTS-protected NTP packet π
Its Field Type is 0x0404 π¦ and it SHALL be formatted according to Figure 4 and include the following fields:
- Nonce Length: Two octets in network byte order π giving the length of the Nonce field, excluding any padding, read as an unsigned integer.
- Ciphertext Length: Two octets in network byte order πΈ giving the length of the Ciphertext field, excluding any padding, read as an unsigned integer.
- Nonce: A nonce as required by the negotiated AEAD algorithm. The end of the field is zero-padded to a word (four octets) boundary π§
- Ciphertext: The output of the negotiated AEAD algorithm. The structure of this field is determined by the negotiated algorithm, but it typically contains an authentication tag in addition to the actual ciphertext. The end of the field is zero-padded to a word (four octets) boundary π
- Additional Padding: Clients that use a nonce length shorter than the maximum allowed by the negotiated AEAD algorithm may be required to include additional zero-padding. The necessary length of this field is specified below π
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Nonce Length | Ciphertext Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
. .
. Nonce, including up to 3 octets padding .
. .
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
. .
. Ciphertext, including up to 3 octets padding .
. .
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
. .
. Additional Padding .
. .
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 4: NTS Authenticator and Encrypted Extension Fields
Extension Field Format
The Ciphertext field SHALL be formed by providing the following inputs to the negotiated AEAD algorithm π₯
- K: For packets sent from the client to the server, the C2S key SHALL be used. For packets sent from the server to the client, the S2C key SHALL be used π¦
- A: The associated data SHALL consist of the portion of the NTP packet beginning from the start of the NTP header and ending at the end of the last extension field that precedes the NTS Authenticator and Encrypted Extension Fields extension field π
- P: The plaintext SHALL consist of all (if any) NTP extension fields to be encrypted. If multiple extension fields are present, they SHALL be joined by concatenation. Each such field SHALL be formatted in accordance with RFC 7822 [RFC7822], except that, contrary to the RFC 7822 requirement that fields have a minimum length of 16 or 28 octets, encrypted extension fields MAY be arbitrarily short (but still MUST be a multiple of 4 octets in length) π
- N: The nonce SHALL be formed however required by the negotiated AEAD algorithm π
The whole point of the Additional Padding field is to make sure servers can always pick a nonce that's long enough to stay unique, even if the client picks a shorter one π«Ά It also makes sure the overall length of the server's response packet does not exceed the length of the request β¨ For mode 4 (server) packets, no Additional Padding field is ever required πΈ For mode 3 (client) packets, the length of the Additional Padding field SHALL be computed as follows π
Let N_LEN be the padded length of the Nonce field. Let N_MAX be, as specified by RFC 5116 [RFC5116], the maximum permitted nonce length for the negotiated AEAD algorithm. Let N_REQ be the lesser of 16 and N_MAX, rounded up to the nearest multiple of 4. If N_LEN is greater than or equal to N_REQ, then no Additional Padding field is required. Otherwise, the Additional Padding field SHALL be at least N_REQ - N_LEN octets in length. Servers MUST enforce this requirement by discarding any packet that does not conform to it π«
Servers MUST discard any packet that doesn't follow the Additional Padding rule. No exceptions, no vibes-based decisions π
Senders are always free to include more Additional Padding than the paragraph above mandates π Theoretically, it could be necessary to do so in order to bring the extension field up to the minimum length required by RFC 7822 [RFC7822] π€ This should never happen in practice, because any reasonable AEAD algorithm will already have a nonce and an authenticator long enough to bring the extension field to its required length β¨ Still, implementers are advised to explicitly handle this case and make sure the extension field they emit is of legal length π
The NTS Authenticator and Encrypted Extension Fields extension field MUST NOT be included in NTP packets whose mode is other than 3 (client) or 4 (server) π
5.7. Protocol Details
okay bestie, this is where the whole NTS dance actually happens πβ¨ the client gets to bring its A-game, and the server gets to be the strict bouncer π«Ά
A client sending an NTS-protected request SHALL include the following extension fields as displayed in Figure 5:
- Exactly one Unique Identifier extension field that MUST be authenticated, MUST NOT be encrypted, and whose contents MUST be the output of a cryptographically secure random number generator [RFC4086]. π¦
- Exactly one NTS Cookie extension field that MUST be authenticated and MUST NOT be encrypted. The cookie MUST be one which has been previously provided to the client, either from the key establishment server during the NTS-KE handshake or from the NTP server in response to a previous NTS-protected NTP request. π
- Exactly one NTS Authenticator and Encrypted Extension Fields extension field, generated using an AEAD algorithm and C2S key established through NTS-KE. ππ
To protect the client's privacy, the client SHOULD avoid reusing a cookie. If the client does not have any cookies that it has not already sent, it SHOULD initiate a rerun of the NTS-KE protocol. The client MAY reuse cookies in order to prioritize resilience over unlinkability. Which of the two that should be prioritized in any particular case is dependent on the application and the user's preference. Section 9.1 describes the privacy considerations of this in further detail. π the privacy stuff is a whole thing, and it's giving "it depends on the app and what the user wants" πΈ
The client MAY include one or more NTS Cookie Placeholder extension fields that MUST be authenticated and MAY be encrypted. The number of NTS Cookie Placeholder extension fields that the client includes SHOULD be such that if the client includes N placeholders and the server sends back N+1 cookies, the number of unused cookies stored by the client will come to eight. The client SHOULD NOT include more than seven NTS Cookie Placeholder extension fields in a request. When both the client and server adhere to all cookie-management guidance provided in this memo, the number of placeholder extension fields will equal the number of dropped packets since the last successful volley. β¨ math check: N placeholders in, N+1 cookies back, so the cookie jar stays stacked at eight π§
In rare circumstances, it may be necessary to include fewer NTS Cookie Placeholder extensions than recommended above in order to prevent datagram fragmentation. When cookies adhere to the format recommended in Section 6 and the AEAD in use is the mandatory-to-implement AEAD_AES_SIV_CMAC_256, senders can include a cookie and seven placeholders and still have packet size fall comfortably below 1280 octets if no non-NTS-related extensions are used; 1280 octets is the minimum prescribed MTU for IPv6 and is generally safe for avoiding IPv4 fragmentation. Nonetheless, senders SHOULD include fewer cookies and placeholders than otherwise indicated if doing so is necessary to prevent fragmentation. π packet size is the vibe check here, bestie, don't let it get too chunky π
+---------------------------------------+
| - Verify time request message. |
| - Generate time response message. |
| - Included NTPv4 extension fields: |
| o Unique Identifier EF |
| o NTS Authentication and |
| Encrypted Extension Fields EF |
| - NTS Cookie EF |
| - <NTS Cookie EF> |
| - Transmit time request packet. |
+-----------------+---------------------+
|
|
Server -----------+---------------+-----+----------------------->
^ \
/ \
Time request / \ Time response
(mode 3) / \ (mode 4)
/ \
/ V
Client -----+---------------------------------+----------------->
| |
| |
| |
+-----------+-----------------------+ +-----+------------------+
|- Generate time request message. | |- Verify time response |
| - Include NTPv4 Extension fields: | | message. |
| o Unique Identifier EF | |- Extract cookie(s). |
| o NTS Cookie EF | |- Time synchronization |
| o <NTS Cookie Placeholder EF> | | processing. |
| | +------------------------+
|- Generate AEAD tag of NTP message.|
|- Add NTS Authentication and |
| Encrypted Extension Fields EF. |
|- Transmit time request packet. |
+-----------------------------------+
Figure 5: NTS-Protected NTP Time Synchronization Messages
The client MAY include additional (non-NTS-related) extension fields that MAY appear prior to the NTS Authenticator and Encrypted Extension Fields extension fields (therefore authenticated but not encrypted), within it (therefore encrypted and authenticated), or after it (therefore neither encrypted nor authenticated). The server MUST discard any unauthenticated extension fields. Future specifications of extension fields MAY provide exceptions to this rule. π§ the server is SO strict about unauthenticated stuff, no exceptions unless a future spec says so π€
Upon receiving an NTS-protected request, the server SHALL (through some implementation-defined mechanism) use the cookie to recover the AEAD algorithm, C2S key, and S2C key associated with the request, and then use the C2S key to authenticate the packet and decrypt the ciphertext. If the cookie is valid and authentication and decryption succeed, the server SHALL include the following extension fields in its response:
- Exactly one Unique Identifier extension field that MUST be authenticated, MUST NOT be encrypted, and whose contents SHALL echo those provided by the client. πͺ
- Exactly one NTS Authenticator and Encrypted Extension Fields extension field, generated using the AEAD algorithm and S2C key recovered from the cookie provided by the client. π
- One or more NTS Cookie extension fields that MUST be authenticated and encrypted. The number of NTS Cookie extension fields included SHOULD be equal to, and MUST NOT exceed, one plus the number of valid NTS Cookie Placeholder extension fields included in the request. The cookies returned in those fields MUST be valid for use with the NTP server that sent them. They MAY be valid for other NTP servers as well, but there is no way for the server to indicate this. πͺ
We emphasize the contrast that NTS Cookie extension fields MUST NOT be encrypted when sent from client to server but MUST be encrypted when sent from server to client. The former is necessary in order for the server to be able to recover the C2S and S2C keys, while the latter is necessary to satisfy the unlinkability goals discussed in Section 9.1. We emphasize also that "encrypted" means encapsulated within the NTS Authenticator and Encrypted Extensions extension field. While the body of an NTS Cookie extension field will generally consist of some sort of AEAD output (regardless of whether the recommendations of Section 6 are precisely followed), this is not sufficient to make the extension field "encrypted". π«π bestie, the cookie being scrambled-looking is NOT the same as it being encrypted. the encapsulation is what counts π
The server MAY include additional (non-NTS-related) extension fields that MAY appear prior to the NTS Authenticator and Encrypted Extension Fields extension field (therefore authenticated but not encrypted), within it (therefore encrypted and authenticated), or after it (therefore neither encrypted nor authenticated). The client MUST discard any unauthenticated extension fields. Future specifications of extension fields MAY provide exceptions to this rule. π
Upon receiving an NTS-protected response, the client MUST verify that the Unique Identifier matches that of an outstanding request, and that the packet is authentic under the S2C key associated with that request. If either of these checks fails, the packet MUST be discarded without further processing. In particular, the client MUST discard unprotected responses to NTS-protected requests. ποΈ no unprotected replies allowed, periodt π
If the server is unable to validate the cookie or authenticate the request, it SHOULD respond with a Kiss-o'-Death (KoD) packet (see Section 7.4 of RFC 5905 [RFC5905]) with kiss code "NTSN", meaning "NTS NAK" (NTS negative-acknowledgment). It MUST NOT include any NTS Cookie or NTS Authenticator and Encrypted Extension Fields extension fields. π the server basically says "nope, not today" with a KoD packet, and it never gets cookies or auth fields in that one
If the NTP server has previously responded with authentic NTS-protected NTP packets, the client MUST verify that any KoD packets received from the server contain the Unique Identifier extension field and that the Unique Identifier matches that of an outstanding request. If this check fails, the packet MUST be discarded without further processing. If this check passes, the client MUST comply with Section 7.4 of RFC 5905 [RFC5905] where required. π΅οΈββοΈ the client has to double-check the KoD actually belongs to its own request, no random drive-bys
A client MAY automatically rerun the NTS-KE protocol upon forced disassociation from an NTP server. In that case, it MUST avoid quickly looping between the NTS-KE and NTP servers by rate limiting the retries. Requirements for retry intervals in NTS-KE are described in Section 4.2. π rerunning is allowed, but no spam-clicking the retry button, the rate limit is real π ββοΈ
Upon reception of the NTS NAK kiss code, the client SHOULD wait until the next poll for a valid NTS-protected response, and if none is received, initiate a fresh NTS-KE handshake to try to renegotiate new cookies, AEAD keys, and parameters. If the NTS-KE handshake succeeds, the client MUST discard all old cookies and parameters and use the new ones instead. As long as the NTS-KE handshake has not succeeded, the client SHOULD continue polling the NTP server using the cookies and parameters it has. πβ¨ glow-up time: wait for the next poll, and if that still doesn't work, start over with a fresh handshake. once it succeeds, the old stuff is OUT π
To allow for NTP session restart when the NTS-KE server is unavailable and to reduce NTS-KE server load, the client SHOULD keep at least one unused but recent cookie, AEAD keys, negotiated AEAD algorithm, and other necessary parameters in persistent storage. This way, the client is able to resume the NTP session without performing renewed NTS-KE negotiation. πΎπ«Ά keep a spare cookie and your keys saved so you can restart the session even when the KE server is ghosting you
6. Suggested Format for NTS Cookies β¨
This section is non-normative π It's a suggested way for servers to build NTS cookies. All the normative requirements live in Section 4.1.6 and Section 5.4, so go there for the official rules.
Cookies in NTS are basically the TLS session tickets of the NTP world π§ That's why this section looks so much like RFC 5077 [RFC5077], and you should totally read its security considerations too. No skipping!
Servers should pick an AEAD algorithm to encrypt and authenticate cookies. Something like AEAD_AES_SIV_CMAC_256 [RFC5297] is a good vibe because it holds up against accidental nonce reuse π It doesn't have to match the one negotiated with the client, so don't stress about that. Servers should randomly generate and store a secret master AEAD key 'K'. They should also pick a non-secret, unique value 'I' to act as the key identifier for 'K' π
Servers should periodically (e.g., once daily) generate a new pair '(I,K)' and immediately switch to using those values for all newly-generated cookies π After each rotation, servers should securely erase any previously generated keys that are now expired ποΈ Servers should keep accepting any cookie made with keys they haven't erased yet, even if those keys aren't current anymore. Erasing old keys gives you forward secrecy, which limits how much old info can be stolen if a master key ever gets compromised π Keeping a few old keys around lets clients move from one generation to the next without doing a brand-new NTS-KE handshake. Super smooth π¦
Keeping keys in sync between NTS-KE and NTP servers, plus across load-balanced clusters, can make automatic rotation kinda tricky π But it can be done without any central key-management infrastructure by using a ratchet, i.e., making each new key a deterministic, cryptographically pseudorandom function of its predecessor π A recommended concrete implementation of this is to use HKDF [RFC5869] to derive new keys, with the key's predecessor as Input Keying Material and its key identifier as a salt π
To form a cookie, servers should first build a plaintext 'P' made of the following fields:
- The AEAD algorithm negotiated during NTS-KE.
- The S2C key.
- The C2S key.
Then servers should generate a nonce 'N' uniformly at random, and form AEAD output 'C' by encrypting 'P' under key 'K' with nonce 'N' and no associated data π
The cookie should consist of the tuple '(I,N,C)' π
To verify and decrypt a cookie from the client, first parse it into its components 'I', 'N', and 'C'. Use 'I' to look up its decryption key 'K'. If the key whose identifier is 'I' has been erased or never existed, decryption fails, so reply with an NTS NAK π ββοΈ Otherwise, try to decrypt and verify ciphertext 'C' using key 'K' and nonce 'N' with no associated data. If decryption or verification fails, reply with an NTS NAK. If it works, parse out the contents of the resulting plaintext 'P' to get the negotiated AEAD algorithm, S2C key, and C2S key π
7. IANA Considerations π
7.1. Service Name and Transport Protocol Port Number Registry πΈ
IANA has allocated the following entry in the "Service Name and Transport Protocol Port Number Registry" [RFC6335]:
- Service Name:
ntske - Port Number:
4460 - Transport Protocol:
tcp - Description: Network Time Security Key Establishment
- Assignee:
IESG <iesg@ietf.org> - Contact:
IETF Chair <chair@ietf.org> - Registration Date:
2020-04-07 - Reference:
RFC 8915
7.2. TLS Application-Layer Protocol Negotiation (ALPN) Protocol IDs Registry π¦
IANA has allocated the following entry in the "TLS Application-Layer Protocol Negotiation (ALPN) Protocol IDs" registry [RFC7301]:
- Protocol:
Network Time Security Key Establishment, version 1 - Identification Sequence:
0x6E 0x74 0x73 0x6B 0x65 0x2F 0x31("ntske/1") - Reference:
RFC 8915, Section 4
7.3. TLS Exporter Labels Registry π§
IANA has allocated the following entry in the TLS Exporter Labels registry [RFC5705]:
+================================+=======+===========+=========+====+
| Value |DTLS-OK|Recommended|Reference|Note|
+================================+=======+===========+=========+====+
| EXPORTER-network-time-security |Y |Y |RFC 8915,| |
| | | |Section | |
| | | |4.3 | |
+--------------------------------+-------+-----------+---------+----+
Table 1
7.4. NTP Kiss-o'-Death Codes Registry π
IANA has allocated the following entry in the "NTP Kiss-o'-Death Codes" registry [RFC5905]:
+======+===============================+=============+
| Code | Meaning | Reference |
+======+===============================+=============+
| NTSN | Network Time Security (NTS) | RFC 8915, |
| | negative-acknowledgment (NAK) | Section 5.7 |
+------+-------------------------------+-------------+
Table 2
7.5. NTP Extension Field Types Registry π
IANA has allocated the following entries in the "NTP Extension Field Types" registry [RFC5905]:
+============+============================+=======================+
| Field Type | Meaning | Reference |
+============+============================+=======================+
| 0x0104 | Unique Identifier | RFC 8915, Section 5.3 |
+------------+----------------------------+-----------------------+
| 0x0204 | NTS Cookie | RFC 8915, Section 5.4 |
+------------+----------------------------+-----------------------+
| 0x0304 | NTS Cookie Placeholder | RFC 8915, Section 5.5 |
+------------+----------------------------+-----------------------+
| 0x0404 | NTS Authenticator and | RFC 8915, Section 5.6 |
| | Encrypted Extension Fields | |
+------------+----------------------------+-----------------------+
Table 3
7.6. Network Time Security Key Establishment Record Types Registry π
IANA has created a new registry called "Network Time Security Key Establishment Record Types". Entries have the following fields:
- Record Type Number (REQUIRED): An integer in the range 0-32767 inclusive.
- Description (REQUIRED): A short text description of the purpose of the field.
- Reference (REQUIRED): A reference to a document specifying the semantics of the record.
The registration policy varies by Record Type Number, like this:
0-1023: IETF Review1024-16383: Specification Required16384-32767: Private or Experimental Use
The initial contents of this registry are below π
+====================+======================+===============+
| Record Type Number | Description | Reference |
+====================+======================+===============+
| 0 | End of Message | RFC 8915, |
| | | Section 4.1.1 |
+--------------------+----------------------+---------------+
| 1 | NTS Next Protocol | RFC 8915, |
| | Negotiation | Section 4.1.2 |
+--------------------+----------------------+---------------+
| 2 | Error | RFC 8915, |
| | | Section 4.1.3 |
+--------------------+----------------------+---------------+
| 3 | Warning | RFC 8915, |
| | | Section 4.1.4 |
+--------------------+----------------------+---------------+
| 4 | AEAD Algorithm | RFC 8915, |
| | Negotiation | Section 4.1.5 |
+--------------------+----------------------+---------------+
| 5 | New Cookie for NTPv4 | RFC 8915, |
| | | Section 4.1.6 |
+--------------------+----------------------+---------------+
| 6 | NTPv4 Server | RFC 8915, |
| | Negotiation | Section 4.1.7 |
+--------------------+----------------------+---------------+
| 7 | NTPv4 Port | RFC 8915, |
| | Negotiation | Section 4.1.8 |
+--------------------+----------------------+---------------+
| 8-16383 | Unassigned | |
+--------------------+----------------------+---------------+
| 16384-32767 | Reserved for Private | RFC 8915 |
| | or Experimental Use | |
+--------------------+----------------------+---------------+
Table 4
7.7. Network Time Security Next Protocols Registry π
IANA has created a new registry called "Network Time Security Next Protocols". Entries have the following fields:
- Protocol ID (REQUIRED): An integer in the range 0-65535 inclusive, functioning as an identifier.
- Protocol Name (REQUIRED): A short text string naming the protocol being identified.
- Reference (REQUIRED): A reference to a relevant specification document.
The registration policy varies by Protocol ID, like this:
0-1023: IETF Review1024-32767: Specification Required32768-65535: Private or Experimental Use
The initial contents of this registry are below π
+=============+=========================================+===========+
| Protocol ID | Protocol Name | Reference |
+=============+=========================================+===========+
| 0 | Network Time Protocol | RFC 8915 |
| | version 4 (NTPv4) | |
+-------------+-----------------------------------------+-----------+
| 1-32767 | Unassigned | |
+-------------+-----------------------------------------+-----------+
| 32768-65535 | Reserved for Private | RFC 8915 |
| | or Experimental Use | |
+-------------+-----------------------------------------+-----------+
Table 5
7.8. Network Time Security Error and Warning Codes Registries
okay so IANA made two brand new registries, "Network Time Security Error Codes" and "Network Time Security Warning Codes" πβ¨ each entry has three fields: a Number (REQUIRED π’, an integer from 0 to 65535 inclusive), a Description (REQUIRED π¬, a short text about the condition), and a Reference (REQUIRED π, pointing at a relevant spec document).
the registration policy depends on the Number:
- 0-1023: IETF Review π§
- 1024-32767: Specification Required π
- 32768-65535: Private or Experimental Use π§ͺ
the starting contents of the "Network Time Security Error Codes" registry look like this π
+=============+==============================+===============+
| Number | Description | Reference |
+=============+==============================+===============+
| 0 | Unrecognized Critical Record | RFC 8915, |
| | | Section 4.1.3 |
+-------------+------------------------------+---------------+
| 1 | Bad Request | RFC 8915, |
| | | Section 4.1.3 |
+-------------+------------------------------+---------------+
| 2 | Internal Server Error | RFC 8915, |
| | | Section 4.1.3 |
+-------------+------------------------------+---------------+
| 3-32767 | Unassigned | |
+-------------+------------------------------+---------------+
| 32768-65535 | Reserved for Private or | RFC 8915 |
| | Experimental Use | |
+-------------+------------------------------+---------------+
Table 6
and the "Network Time Security Warning Codes" registry starts out empty, apart from the reserved range πΈ so it looks like this:
+=============+======================+===========+
| Number | Description | Reference |
+=============+======================+===========+
| 0-32767 | Unassigned | |
+-------------+----------------------+-----------+
| 32768-65535 | Reserved for Private | RFC 8915 |
| | or Experimental Use | |
+-------------+----------------------+-----------+
Table 7
8. Security Considerations ππ
Okay this section is the serious one, bestie, so please read it properly π«Ά I'm keeping every bit of it.
8.1. Protected Modes
NTP has a LOT of operating modes so it can handle different network topologies and all kinds of requirements π this memo only specifies NTS for NTP modes 3 (client) and 4 (server) (see Section 1.3). the best current practice for authenticating the other NTP modes is the symmetric message authentication code feature, described in RFC 5905 [RFC5905] and RFC 8573 [RFC8573] π
8.2. Cookie Encryption Key Compromise
β οΈ this one is a big deal, bestie
if you're using the suggested format for NTS cookies from Section 6 of this document, an attacker who gets their hands on the secret cookie encryption key 'K' can impersonate the NTP server π± that includes generating brand new cookies. NTP and NTS-KE server operators SHOULD remove compromised keys as soon as the compromise is discovered. then the NTP servers will respond with NTS NAK, which forces key renegotiation π note that this doesn't protect against MITM attacks where the attacker has access to a compromised cookie encryption key, so yeah, that's a whole separate problem π if another cookie scheme is used, there are likely similar considerations for that particular scheme.
8.3. Sensitivity to DDoS Attacks
NTS brings asymmetric cryptography into NTP π§© asymmetric cryptography is necessary for initial server authentication and AEAD key extraction, but asymmetric cryptosystems are generally orders of magnitude slower than their symmetric counterparts π’ that makes it way harder to build systems that can serve requests at the full line speed of the network connection, and that opens up a new possibility for DDoS attacks on NTP services π
the main protection in NTS is that asymmetric cryptosystems are only needed in the initial NTS-KE phase of the protocol β¨ because the protocol design lets you separate the NTS-KE and NTP servers, a successful DDoS attack on an NTS-KE server that's separate from the NTP service it supports won't affect NTP users who already did initial authentication, AEAD key extraction, and cookie exchange π
NTS users should also keep in mind that they are not fully protected against DoS attacks by on-path adversaries π besides dropping packets and attacks like the ones described in Section 8.6, an on-path attacker can send spoofed Kiss-o'-Death replies, which are not authenticated, in response to NTP requests. this could seriously ramp up the load on the NTS-KE server π© implementers have to weigh the user's need for unlinkability against the extra resilience that comes with cookie reuse when the NTS-KE server is unavailable βοΈ
8.4. Avoiding DDoS Amplification
some nonstandard and/or deprecated NTP features let clients send a request that makes the server reply with something way bigger than the request π¦π₯ servers that enable these features can get abused to amplify traffic in DDoS attacks, by sending them requests with a spoofed source IP address. attacks like this have become an endemic nuisance in recent years π
NTS is designed so it doesn't make this problem any worse β¨ it does that by making sure the NTS-related extension fields in server responses are the same size as the NTS-related extension fields the client sent. this is exactly why the client is required to send a separate, appropriately padded-out NTS Cookie Placeholder extension field for every cookie it wants back, rather than just being allowed to specify a desired quantity π
because RFC 7822 [RFC7822] requires extensions to be padded and aligned to four-octet boundaries, the response size can still sometimes exceed the request size by up to three octets π€ this is sufficiently inconsequential that we have declined to address it.
8.5. Initial Verification of Server Certificates
NTS's security goals fall apart if the client doesn't verify that the X.509 certificate chain presented by the NTS-KE server is valid and rooted in a trusted certificate authority π¨ RFC 5280 [RFC5280] and RFC 6125 [RFC6125] specify how that verification is generally done. the catch is that the client might not have a correctly-set system clock yet when it verifies the certificate π°οΈ that makes it tricky to check the certificate is within its validity period, meaning the current time lies between the times in the certificate's notBefore and notAfter fields. it may be operationally necessary in some cases for a client to accept a certificate that looks expired or not yet valid. there's no perfect solution, but there are several mitigations the client can use to make it harder for an adversary to successfully present an expired certificate π‘οΈ
- Check whether the system time is actually unreliable. on systems with the ntp_adjtime() system call, a return code other than TIME_ERROR means some trusted software already set the time, so certificates can be strictly validated β
- Let the system administrator specify that certificates should always be strictly validated. that's a good config for systems with a battery-backed clock, or systems that can reasonably prompt the user to manually set an approximately correct time if it seems needed π
- Once the clock has been synchronized, periodically write the current system time to persistent storage. don't accept any certificate whose notAfter field is earlier than the last recorded time π
- NTP time replies are expected to be consistent with the NTS-KE TLS certificate validity period. so time replies received right after an NTS-KE handshake are expected to lie within the certificate validity period. implementations are recommended to check that this is the case π performing a new NTS-KE handshake just because the certificate used by the NTS-KE server in a previous handshake has expired is normally not necessary π ββοΈ clients that still want to do this must take care not to cause an inadvertent denial-of-service attack on the NTS-KE server, for example by picking a random time in the week before certificate expiry to do the new handshake π²
- Use multiple time sources. being able to pass off an expired certificate is only useful to an adversary who has compromised the corresponding private key π΅οΈ if the adversary has only compromised a minority of servers, NTP's selection algorithm (Section 11.2.1 of RFC 5905 [RFC5905]) will protect the client from accepting bad time from the adversary-controlled servers π
8.6. Delay Attacks
in a packet delay attack, an adversary who can act as a man-in-the-middle delays time synchronization packets between client and server asymmetrically [RFC7384] π€ NTP's formula for computing time offset relies on the assumption that network latency is roughly symmetrical, so this leads the client to compute an inaccurate value [Mizrahi]. the delay attack doesn't reorder or modify the content of the exchanged synchronization packets, so cryptographic means don't provide a feasible way to mitigate it π the good news is the maximum error an adversary can introduce is bounded by half of the round-trip delay π
RFC 5905 [RFC5905] specifies a parameter called MAXDIST, which is the maximum round-trip latency a client will tolerate before deciding the server is unsuitable for synchronization π that's the whole distance, not just the immediate round trip between client and server, but also the distance back to the reference clock as reported in the Root Delay field. the standard value for MAXDIST is one second, although some implementations use larger values π whatever value a client picks, the maximum error that can be introduced by a delay attack is MAXDIST/2 π
usage of multiple time sources, or multiple network paths to a given time source [Shpiner], may also help mitigate delay attacks if the adversary only controls some of the paths π¦
8.7. NTS Stripping π΅οΈββοΈ
Okay, bestie, this one is a sneaky attack and implementers need to be super aware of it. "NTS stripping" is when an attacker tries to trick a client into quietly going back to plain NTP, with no security at all π. Naive clients might do this automatically if the NTS-KE handshake fails, and a man-in-the-middle attacker can make that happen really easily π. Even clients that already have valid cookies can get caught, because an attacker can force a repeat of the NTS-KE handshake by sending faked NTP mode 4 replies carrying the NTS NAK kiss code. Forcing that repeat can also be step one of even nastier attacks π.
So, for all these reasons, implementations SHOULD NOT revert from NTS-protected to unprotected NTP with any server without explicit user action. Don't let your client just slide back to the unsafe version without asking someone first π«Άβ¨.
9. Privacy Considerations π¦
9.1. Unlinkability ποΈ
Unlinkability is all about stopping a device from getting tracked when it switches network addresses, like when it moves from one network to another πΆββοΈ. It stops an attacker from connecting a device's new address to the old one, using recognizable data the device keeps sending as part of an NTS-secured NTP association. That's exactly why clients keep getting fresh cookies: a cookie should never end up being recognizable data in that sense πͺπ.
NTS's unlinkability goal is only to avoid leaking extra data that could link an address. It doesn't fix the old linkability problems that NTP already has π¬. So if a client needs unlinkability, it also has to minimize the information it sends in a client query (mode 3) packet, as described in the document NTP Client Data Minimization [NTP-DATA-MIN] π .
The unlinkability goal only applies to time synchronization traffic, not key establishment traffic. That means it can't be guaranteed for devices that act as both time clients and time servers, since servers can be triggered from outside to send linkable stuff like the TLS certificate π.
Also, devices acting as time servers might still be linkable through their time synchronization traffic, using info in (mode 4) server response packets like the reference ID, reference time, stratum, and poll β¨. Devices that answer NTP control queries could get linked too, based on what those control queries reveal π.
Heads up: the unlinkability goal does NOT stop a client device from being tracked by its own time servers π¨. Your servers can still see you, babe.
9.2. Confidentiality π€«
NTS does not protect the confidentiality of info in NTP's header fields π. When clients use NTP Client Data Minimization [NTP-DATA-MIN], the client packet headers don't have anything the client would want to keep secret: one field is random and all the others are fixed π. Server packet headers are public too. The origin timestamp gets copied from the client's (random) transmit timestamp, and every other field is set the same no matter who's asking πΈ.
Future extension fields could hypothetically carry sensitive info, and if they do, NTS gives you a way to encrypt them ππ.
10. References π
10.1. Normative References
[IANA-AEAD]
IANA, "Authenticated Encryption with Associated Data
(AEAD) Parameters",
<https://www.iana.org/assignments/aead-parameters/>.
[RFC0020] Cerf, V., "ASCII format for network interchange", STD 80,
RFC 20, DOI 10.17487/RFC0020, October 1969,
<https://www.rfc-editor.org/info/rfc20>.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997,
<https://www.rfc-editor.org/info/rfc2119>.
[RFC4291] Hinden, R. and S. Deering, "IP Version 6 Addressing
Architecture", RFC 4291, DOI 10.17487/RFC4291, February
2006, <https://www.rfc-editor.org/info/rfc4291>.
[RFC5116] McGrew, D., "An Interface and Algorithms for Authenticated
Encryption", RFC 5116, DOI 10.17487/RFC5116, January 2008,
<https://www.rfc-editor.org/info/rfc5116>.
[RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S.,
Housley, R., and W. Polk, "Internet X.509 Public Key
Infrastructure Certificate and Certificate Revocation List
(CRL) Profile", RFC 5280, DOI 10.17487/RFC5280, May 2008,
<https://www.rfc-editor.org/info/rfc5280>.
[RFC5297] Harkins, D., "Synthetic Initialization Vector (SIV)
Authenticated Encryption Using the Advanced Encryption
Standard (AES)", RFC 5297, DOI 10.17487/RFC5297, October
2008, <https://www.rfc-editor.org/info/rfc5297>.
[RFC5705] Rescorla, E., "Keying Material Exporters for Transport
Layer Security (TLS)", RFC 5705, DOI 10.17487/RFC5705,
March 2010, <https://www.rfc-editor.org/info/rfc5705>.
[RFC5869] Krawczyk, H. and P. Eronen, "HMAC-based Extract-and-Expand
Key Derivation Function (HKDF)", RFC 5869,
DOI 10.17487/RFC5869, May 2010,
<https://www.rfc-editor.org/info/rfc5869>.
[RFC5890] Klensin, J., "Internationalized Domain Names for
Applications (IDNA): Definitions and Document Framework",
RFC 5890, DOI 10.17487/RFC5890, August 2010,
<https://www.rfc-editor.org/info/rfc5890>.
[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/RFC5905, June 2010,
<https://www.rfc-editor.org/info/rfc5905>.
[RFC6125] Saint-Andre, P. and J. Hodges, "Representation and
Verification of Domain-Based Application Service Identity
within Internet Public Key Infrastructure Using X.509
(PKIX) Certificates in the Context of Transport Layer
Security (TLS)", RFC 6125, DOI 10.17487/RFC6125, March
2011, <https://www.rfc-editor.org/info/rfc6125>.
[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/RFC6335, August 2011,
<https://www.rfc-editor.org/info/rfc6335>.
[RFC6874] Carpenter, B., Cheshire, S., and R. Hinden, "Representing
IPv6 Zone Identifiers in Address Literals and Uniform
Resource Identifiers", RFC 6874, DOI 10.17487/RFC6874,
February 2013, <https://www.rfc-editor.org/info/rfc6874>.
[RFC7301] Friedl, S., Popov, A., Langley, A., and E. Stephan,
"Transport Layer Security (TLS) Application-Layer Protocol
Negotiation Extension", RFC 7301, DOI 10.17487/RFC7301,
July 2014, <https://www.rfc-editor.org/info/rfc7301>.
[RFC7525] Sheffer, Y., Holz, R., and P. Saint-Andre,
"Recommendations for Secure Use of Transport Layer
Security (TLS) and Datagram Transport Layer Security
(DTLS)", BCP 195, RFC 7525, DOI 10.17487/RFC7525, May
2015, <https://www.rfc-editor.org/info/rfc7525>.
[RFC7822] Mizrahi, T. and D. Mayer, "Network Time Protocol Version 4
(NTPv4) Extension Fields", RFC 7822, DOI 10.17487/RFC7822,
March 2016, <https://www.rfc-editor.org/info/rfc7822>.
[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
May 2017, <https://www.rfc-editor.org/info/rfc8174>.
[RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol
Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018,
<https://www.rfc-editor.org/info/rfc8446>.
10.2. Informative References
[Mizrahi] Mizrahi, T., "A game theoretic analysis of delay attacks
against time synchronization protocols", 2012 IEEE
International Symposium on Precision Clock Synchronization
for Measurement, Control and Communication Proceedings,
pp. 1-6, DOI 10.1109/ISPCS.2012.6336612, September 2012,
<https://doi.org/10.1109/ISPCS.2012.6336612>.
[NTP-DATA-MIN]
Franke, D. F. and A. Malhotra, "NTP Client Data
Minimization", Work in Progress, Internet-Draft, draft-
ietf-ntp-data-minimization-04, 25 March 2019,
<https://tools.ietf.org/html/draft-ietf-ntp-data-
minimization-04>.
[RFC4086] Eastlake 3rd, D., Schiller, J., and S. Crocker,
"Randomness Requirements for Security", BCP 106, RFC 4086,
DOI 10.17487/RFC4086, June 2005,
<https://www.rfc-editor.org/info/rfc4086>.
[RFC5077] Salowey, J., Zhou, H., Eronen, P., and H. Tschofenig,
"Transport Layer Security (TLS) Session Resumption without
Server-Side State", RFC 5077, DOI 10.17487/RFC5077,
January 2008, <https://www.rfc-editor.org/info/rfc5077>.
[RFC7384] Mizrahi, T., "Security Requirements of Time Protocols in
Packet Switched Networks", RFC 7384, DOI 10.17487/RFC7384,
October 2014, <https://www.rfc-editor.org/info/rfc7384>.
[RFC8573] Malhotra, A. and S. Goldberg, "Message Authentication Code
for the Network Time Protocol", RFC 8573,
DOI 10.17487/RFC8573, June 2019,
<https://www.rfc-editor.org/info/rfc8573>.
[Shpiner] Shpiner, A., Revah, Y., and T. Mizrahi, "Multi-path Time
Protocols", 2013 IEEE International Symposium on Precision
Clock Synchronization for Measurement, Control and
Communication (ISPCS) Proceedings, pp. 1-6,
DOI 10.1109/ISPCS.2013.6644754, September 2013,
<https://doi.org/10.1109/ISPCS.2013.6644754>.
Acknowledgments π
The authors would like to thank Richard Barnes, Steven Bellovin, Scott Fluhrer, Patrik FΓ€ltstrΓΆm, Sharon Goldberg, Russ Housley, Benjamin Kaduk, Suresh Krishnan, Mirja KΓΌhlewind, Martin Langer, Barry Leiba, Miroslav Lichvar, Aanchal Malhotra, Danny Mayer, Dave Mills, Sandra Murphy, Hal Murray, Karen O'Donoghue, Eric K. Rescorla, Kurt Roeckx, Stephen Roettger, Dan Romascanu, Kyle Rose, Rich Salz, Brian Sniffen, Susan Sons, Douglas Stebila, Harlan Stenn, Joachim StrΓΆmbergsson, Martin Thomson, Γric Vyncke, Richard Welty, Christer Weinigel, and Magnus Westerlund π«Άπ. They're thanked for contributions to this document and for comments on the design of NTS πβ¨.
Authors' Addresses π§
Daniel Fox Franke
Akamai Technologies
145 Broadway
Cambridge, MA 02142
United States of America
Email: dafranke@akamai.com
Dieter Sibold
Physikalisch-Technische Bundesanstalt
Bundesallee 100
D-38116 Braunschweig
Germany
Phone: +49-(0)531-592-8462
Email: dieter.sibold@ptb.de
Kristof Teichel
Physikalisch-Technische Bundesanstalt
Bundesallee 100
D-38116 Braunschweig
Germany
Phone: +49-(0)531-592-4471
Email: kristof.teichel@ptb.de
Marcus Dansarie
Sweden
Email: marcus@dansarie.se
URI: https://orcid.org/0000-0001-9246-0263
Ragnar Sundblad
Netnod
Sweden
Email: ragge@netnod.se
π¦ where this page comes from
- ietf: rfc8915 2020-09
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms