idnits 2.17.1 draft-ietf-ntp-using-nts-for-ntp-28.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- == There are 1 instance of lines with non-RFC2606-compliant FQDNs in the document. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (March 25, 2020) is 1493 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: '0' on line 408 -- Looks like a reference, but probably isn't: '1' on line 408 -- Possible downref: Non-RFC (?) normative reference: ref. 'IANA-AEAD' ** Downref: Normative reference to an Informational RFC: RFC 5297 ** Downref: Normative reference to an Informational RFC: RFC 5869 ** Obsolete normative reference: RFC 6125 (Obsoleted by RFC 9525) ** Obsolete normative reference: RFC 7525 (Obsoleted by RFC 9325) -- Obsolete informational reference (is this intentional?): RFC 5077 (Obsoleted by RFC 8446) Summary: 4 errors (**), 0 flaws (~~), 2 warnings (==), 5 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 NTP Working Group D. Franke 3 Internet-Draft Akamai 4 Intended status: Standards Track D. Sibold 5 Expires: September 26, 2020 K. Teichel 6 PTB 7 M. Dansarie 9 R. Sundblad 10 Netnod 11 March 25, 2020 13 Network Time Security for the Network Time Protocol 14 draft-ietf-ntp-using-nts-for-ntp-28 16 Abstract 18 This memo specifies Network Time Security (NTS), a mechanism for 19 using Transport Layer Security (TLS) and Authenticated Encryption 20 with Associated Data (AEAD) to provide cryptographic security for the 21 client-server mode of the Network Time Protocol (NTP). 23 NTS is structured as a suite of two loosely coupled sub-protocols. 24 The first (NTS-KE) handles initial authentication and key 25 establishment over TLS. The second handles encryption and 26 authentication during NTP time synchronization via extension fields 27 in the NTP packets, and holds all required state only on the client 28 via opaque cookies. 30 Status of This Memo 32 This Internet-Draft is submitted in full conformance with the 33 provisions of BCP 78 and BCP 79. 35 Internet-Drafts are working documents of the Internet Engineering 36 Task Force (IETF). Note that other groups may also distribute 37 working documents as Internet-Drafts. The list of current Internet- 38 Drafts is at https://datatracker.ietf.org/drafts/current/. 40 Internet-Drafts are draft documents valid for a maximum of six months 41 and may be updated, replaced, or obsoleted by other documents at any 42 time. It is inappropriate to use Internet-Drafts as reference 43 material or to cite them other than as "work in progress." 45 This Internet-Draft will expire on September 26, 2020. 47 Copyright Notice 49 Copyright (c) 2020 IETF Trust and the persons identified as the 50 document authors. All rights reserved. 52 This document is subject to BCP 78 and the IETF Trust's Legal 53 Provisions Relating to IETF Documents 54 (https://trustee.ietf.org/license-info) in effect on the date of 55 publication of this document. Please review these documents 56 carefully, as they describe your rights and restrictions with respect 57 to this document. Code Components extracted from this document must 58 include Simplified BSD License text as described in Section 4.e of 59 the Trust Legal Provisions and are provided without warranty as 60 described in the Simplified BSD License. 62 Table of Contents 64 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 65 1.1. Objectives . . . . . . . . . . . . . . . . . . . . . . . 4 66 1.2. Protocol Overview . . . . . . . . . . . . . . . . . . . . 5 67 2. Requirements Language . . . . . . . . . . . . . . . . . . . . 7 68 3. TLS profile for Network Time Security . . . . . . . . . . . . 7 69 4. The NTS Key Establishment Protocol . . . . . . . . . . . . . 8 70 4.1. NTS-KE Record Types . . . . . . . . . . . . . . . . . . . 10 71 4.1.1. End of Message . . . . . . . . . . . . . . . . . . . 11 72 4.1.2. NTS Next Protocol Negotiation . . . . . . . . . . . . 11 73 4.1.3. Error . . . . . . . . . . . . . . . . . . . . . . . . 11 74 4.1.4. Warning . . . . . . . . . . . . . . . . . . . . . . . 12 75 4.1.5. AEAD Algorithm Negotiation . . . . . . . . . . . . . 12 76 4.1.6. New Cookie for NTPv4 . . . . . . . . . . . . . . . . 13 77 4.1.7. NTPv4 Server Negotiation . . . . . . . . . . . . . . 13 78 4.1.8. NTPv4 Port Negotiation . . . . . . . . . . . . . . . 14 79 4.2. Retry Intervals . . . . . . . . . . . . . . . . . . . . . 14 80 4.3. Key Extraction (generally) . . . . . . . . . . . . . . . 15 81 5. NTS Extension Fields for NTPv4 . . . . . . . . . . . . . . . 15 82 5.1. Key Extraction (for NTPv4) . . . . . . . . . . . . . . . 15 83 5.2. Packet Structure Overview . . . . . . . . . . . . . . . . 16 84 5.3. The Unique Identifier Extension Field . . . . . . . . . . 16 85 5.4. The NTS Cookie Extension Field . . . . . . . . . . . . . 17 86 5.5. The NTS Cookie Placeholder Extension Field . . . . . . . 17 87 5.6. The NTS Authenticator and Encrypted Extension Fields 88 Extension Field . . . . . . . . . . . . . . . . . . . . . 17 89 5.7. Protocol Details . . . . . . . . . . . . . . . . . . . . 20 90 6. Suggested Format for NTS Cookies . . . . . . . . . . . . . . 24 91 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 25 92 7.1. Service Name and Transport Protocol Port Number Registry 25 93 7.2. TLS Application-Layer Protocol Negotiation (ALPN) 94 Protocol IDs Registry . . . . . . . . . . . . . . . . . . 26 96 7.3. TLS Exporter Labels Registry . . . . . . . . . . . . . . 26 97 7.4. NTP Kiss-o'-Death Codes Registry . . . . . . . . . . . . 26 98 7.5. NTP Extension Field Types Registry . . . . . . . . . . . 26 99 7.6. Network Time Security Key Establishment Record Types 100 Registry . . . . . . . . . . . . . . . . . . . . . . . . 27 101 7.7. Network Time Security Next Protocols Registry . . . . . . 28 102 7.8. Network Time Security Error and Warning Codes Registries 29 103 8. Implementation Status - RFC EDITOR: REMOVE BEFORE PUBLICATION 30 104 8.1. Implementation 1 . . . . . . . . . . . . . . . . . . . . 30 105 8.1.1. Coverage . . . . . . . . . . . . . . . . . . . . . . 30 106 8.1.2. Licensing . . . . . . . . . . . . . . . . . . . . . . 31 107 8.1.3. Contact Information . . . . . . . . . . . . . . . . . 31 108 8.1.4. Last Update . . . . . . . . . . . . . . . . . . . . . 31 109 8.2. Implementation 2 . . . . . . . . . . . . . . . . . . . . 31 110 8.2.1. Coverage . . . . . . . . . . . . . . . . . . . . . . 31 111 8.2.2. Licensing . . . . . . . . . . . . . . . . . . . . . . 31 112 8.2.3. Contact Information . . . . . . . . . . . . . . . . . 31 113 8.2.4. Last Update . . . . . . . . . . . . . . . . . . . . . 31 114 8.3. Implementation 3 . . . . . . . . . . . . . . . . . . . . 32 115 8.3.1. Coverage . . . . . . . . . . . . . . . . . . . . . . 32 116 8.3.2. Licensing . . . . . . . . . . . . . . . . . . . . . . 32 117 8.3.3. Contact Information . . . . . . . . . . . . . . . . . 32 118 8.3.4. Last Update . . . . . . . . . . . . . . . . . . . . . 32 119 8.4. Implementation 4 . . . . . . . . . . . . . . . . . . . . 32 120 8.4.1. Coverage . . . . . . . . . . . . . . . . . . . . . . 32 121 8.4.2. Licensing . . . . . . . . . . . . . . . . . . . . . . 33 122 8.4.3. Contact Information . . . . . . . . . . . . . . . . . 33 123 8.4.4. Last Update . . . . . . . . . . . . . . . . . . . . . 33 124 8.5. Implementation 5 . . . . . . . . . . . . . . . . . . . . 33 125 8.5.1. Coverage . . . . . . . . . . . . . . . . . . . . . . 33 126 8.5.2. Licensing . . . . . . . . . . . . . . . . . . . . . . 33 127 8.5.3. Contact Information . . . . . . . . . . . . . . . . . 33 128 8.5.4. Last Update . . . . . . . . . . . . . . . . . . . . . 33 129 8.6. Implementation 6 . . . . . . . . . . . . . . . . . . . . 33 130 8.6.1. Coverage . . . . . . . . . . . . . . . . . . . . . . 34 131 8.6.2. Licensing . . . . . . . . . . . . . . . . . . . . . . 34 132 8.6.3. Contact Information . . . . . . . . . . . . . . . . . 34 133 8.6.4. Last Update . . . . . . . . . . . . . . . . . . . . . 34 134 8.7. Interoperability . . . . . . . . . . . . . . . . . . . . 34 135 9. Security Considerations . . . . . . . . . . . . . . . . . . . 34 136 9.1. Protected Modes . . . . . . . . . . . . . . . . . . . . . 34 137 9.2. Cookie Encryption Key Compromise . . . . . . . . . . . . 35 138 9.3. Sensitivity to DDoS Attacks . . . . . . . . . . . . . . . 35 139 9.4. Avoiding DDoS Amplification . . . . . . . . . . . . . . . 35 140 9.5. Initial Verification of Server Certificates . . . . . . . 36 141 9.6. Delay Attacks . . . . . . . . . . . . . . . . . . . . . . 37 142 9.7. NTS Stripping . . . . . . . . . . . . . . . . . . . . . . 38 143 10. Privacy Considerations . . . . . . . . . . . . . . . . . . . 38 144 10.1. Unlinkability . . . . . . . . . . . . . . . . . . . . . 38 145 10.2. Confidentiality . . . . . . . . . . . . . . . . . . . . 39 146 11. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 39 147 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 39 148 12.1. Normative References . . . . . . . . . . . . . . . . . . 39 149 12.2. Informative References . . . . . . . . . . . . . . . . . 41 150 Appendix A. Terms and Abbreviations . . . . . . . . . . . . . . 42 151 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 43 153 1. Introduction 155 This memo specifies Network Time Security (NTS), a cryptographic 156 security mechanism for network time synchronization. A complete 157 specification is provided for application of NTS to the client-server 158 mode of the Network Time Protocol (NTP) [RFC5905]. 160 1.1. Objectives 162 The objectives of NTS are as follows: 164 o Identity: Through the use of a X.509 public key infrastructure, 165 implementations can cryptographically establish the identity of 166 the parties they are communicating with. 168 o Authentication: Implementations can cryptographically verify that 169 any time synchronization packets are authentic, i.e., that they 170 were produced by an identified party and have not been modified in 171 transit. 173 o Confidentiality: Although basic time synchronization data is 174 considered non-confidential and sent in the clear, NTS includes 175 support for encrypting NTP extension fields. 177 o Replay prevention: Client implementations can detect when a 178 received time synchronization packet is a replay of a previous 179 packet. 181 o Request-response consistency: Client implementations can verify 182 that a time synchronization packet received from a server was sent 183 in response to a particular request from the client. 185 o Unlinkability: For mobile clients, NTS will not leak any 186 information additional to NTP which would permit a passive 187 adversary to determine that two packets sent over different 188 networks came from the same client. 190 o Non-amplification: Implementations (especially server 191 implementations) can avoid acting as distributed denial-of-service 192 (DDoS) amplifiers by never responding to a request with a packet 193 larger than the request packet. 195 o Scalability: Server implementations can serve large numbers of 196 clients without having to retain any client-specific state. 198 o Performance: NTS must not significantly degrade the quality of the 199 time transfer. The encryption and authentication used when 200 actually transferring time should be lightweight (see RFC 7384, 201 Section 5.7 [RFC7384]). 203 1.2. Protocol Overview 205 The Network Time Protocol includes many different operating modes to 206 support various network topologies (see RFC 5905, Section 3 207 [RFC5905]). In addition to its best-known and most-widely-used 208 client-server mode, it also includes modes for synchronization 209 between symmetric peers, a control mode for server monitoring and 210 administration, and a broadcast mode. These various modes have 211 differing and partly contradictory requirements for security and 212 performance. Symmetric and control modes demand mutual 213 authentication and mutual replay protection. Additionally, for 214 certain message types control mode may require confidentiality as 215 well as authentication. Client-server mode places more stringent 216 requirements on resource utilization than other modes, because 217 servers may have vast number of clients and be unable to afford to 218 maintain per-client state. However, client-server mode also has more 219 relaxed security needs, because only the client requires replay 220 protection: it is harmless for stateless servers to process replayed 221 packets. The security demands of symmetric and control modes, on the 222 other hand, are in conflict with the resource-utilization demands of 223 client-server mode: any scheme which provides replay protection 224 inherently involves maintaining some state to keep track of what 225 messages have already been seen. 227 This memo specifies NTS exclusively for the client-server mode of 228 NTP. To this end, NTS is structured as a suite of two protocols: 230 The "NTS Extensions for NTPv4" define a collection of NTP 231 extension fields for cryptographically securing NTPv4 using 232 previously-established key material. They are suitable for 233 securing client-server mode because the server can implement them 234 without retaining per-client state. All state is kept by the 235 client and provided to the server in the form of an encrypted 236 cookie supplied with each request. On the other hand, the NTS 237 Extension Fields are suitable *only* for client-server mode 238 because only the client, and not the server, is protected from 239 replay. 241 The "NTS Key Establishment" protocol (NTS-KE) is a mechanism for 242 establishing key material for use with the NTS Extension Fields 243 for NTPv4. It uses TLS to establish keys, provide the client with 244 an initial supply of cookies, and negotiate some additional 245 protocol options. After this, the TLS channel is closed with no 246 per-client state remaining on the server side. 248 The typical protocol flow is as follows: The client connects to an 249 NTS-KE server on the NTS TCP port and the two parties perform a TLS 250 handshake. Via the TLS channel, the parties negotiate some 251 additional protocol parameters and the server sends the client a 252 supply of cookies along with an address and port of an NTP server for 253 which the cookies are valid. The parties use TLS key export 254 [RFC5705] to extract key material which will be used in the next 255 phase of the protocol. This negotiation takes only a single round 256 trip, after which the server closes the connection and discards all 257 associated state. At this point the NTS-KE phase of the protocol is 258 complete. Ideally, the client never needs to connect to the NTS-KE 259 server again. 261 Time synchronization proceeds with the indicated NTP server. The 262 client sends the server an NTP client packet which includes several 263 extension fields. Included among these fields are a cookie 264 (previously provided by the key establishment server) and an 265 authentication tag, computed using key material extracted from the 266 NTS-KE handshake. The NTP server uses the cookie to recover this key 267 material and send back an authenticated response. The response 268 includes a fresh, encrypted cookie which the client then sends back 269 in the clear in a subsequent request. (This constant refreshing of 270 cookies is necessary in order to achieve NTS's unlinkability goal.) 272 Figure 1 provides an overview of the high-level interaction between 273 the client, the NTS-KE server, and the NTP server. Note that the 274 cookies' data format and the exchange of secrets between NTS-KE and 275 NTP servers are not part of this specification and are implementation 276 dependent. However, a suggested format for NTS cookies is provided 277 in Section 6. 279 +--------------+ 280 | | 281 +-> | NTP Server 1 | 282 | | | 283 Shared cookie | +--------------+ 284 +---------------+ encryption parameters | +--------------+ 285 | | (Implementation dependent) | | | 286 | NTS-KE Server | <------------------------------+-> | NTP Server 2 | 287 | | | | | 288 +---------------+ | +--------------+ 289 ^ | . 290 | | . 291 | 1. Negotiate parameters, | . 292 | receive initial cookie | +--------------+ 293 | supply, generate AEAD keys, | | | 294 | and receive NTP server IP +-> | NTP Server N | 295 | addresses using "NTS Key | | 296 | Establishment" protocol. +--------------+ 297 | ^ 298 | | 299 | +----------+ | 300 | | | | 301 +-----------> | Client | <-------------------------+ 302 | | 2. Perform authenticated 303 +----------+ time synchronization 304 and generate new 305 cookies using "NTS 306 Extension Fields for 307 NTPv4". 309 Figure 1: Overview of High-Level Interactions in NTS 311 2. Requirements Language 313 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 314 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 315 "OPTIONAL" in this document are to be interpreted as described in 316 BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all 317 capitals, as shown here. 319 3. TLS profile for Network Time Security 321 Network Time Security makes use of TLS for NTS key establishment. 323 Since the NTS protocol is new as of this publication, no backward- 324 compatibility concerns exist to justify using obsolete, insecure, or 325 otherwise broken TLS features or versions. Implementations MUST 326 conform with RFC 7525 [RFC7525] or with a later revision of BCP 195. 328 Implementations MUST NOT negotiate TLS versions earlier than 1.3 329 [RFC8446] and MAY refuse to negotiate any TLS version which has been 330 superseded by a later supported version. 332 Use of the Application-Layer Protocol Negotiation Extension [RFC7301] 333 is integral to NTS and support for it is REQUIRED for 334 interoperability. 336 Implementations MUST follow the rules in RFC 5280 [RFC5280] and RFC 337 6125 [RFC6125] for the representation and verification of the 338 application's service identity. When NTS-KE service discovery (out 339 of scope for this document) produces one or more host names, use of 340 the DNS-ID identifier type [RFC6125] is RECOMMENDED; specifications 341 for service discovery mechanisms can provide additional guidance for 342 certificate validation based on the results of discovery. 343 Section 9.5 of this memo discusses particular considerations for 344 certificate verification in the context of NTS. 346 4. The NTS Key Establishment Protocol 348 The NTS key establishment protocol is conducted via TCP port 349 [[TBD1]]. The two endpoints carry out a TLS handshake in conformance 350 with Section 3, with the client offering (via an ALPN [RFC7301] 351 extension), and the server accepting, an application-layer protocol 352 of "ntske/1". Immediately following a successful handshake, the 353 client SHALL send a single request as Application Data encapsulated 354 in the TLS-protected channel. Then, the server SHALL send a single 355 response. After sending their respective request and response, the 356 client and server SHALL send TLS "close_notify" alerts in accordance 357 with RFC 8446, Section 6.1 [RFC8446]. 359 The client's request and the server's response each SHALL consist of 360 a sequence of records formatted according to Figure 2. The request 361 and a non-error response each SHALL include exactly one NTS Next 362 Protocol Negotiation record. The sequence SHALL be terminated by a 363 "End of Message" record. The requirement that all NTS-KE messages be 364 terminated by an End of Message record makes them self-delimiting. 366 Clients and servers MAY enforce length limits on requests and 367 responses, however, servers MUST accept requests of at least 1024 368 octets and clients SHOULD accept responses of at least 65536 octets. 370 0 1 2 3 371 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 372 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 373 |C| Record Type | Body Length | 374 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 375 | | 376 . . 377 . Record Body . 378 . . 379 | | 380 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 382 Figure 2: NTS-KE Record Format 384 The fields of an NTS-KE record are defined as follows: 386 C (Critical Bit): Determines the disposition of unrecognized 387 Record Types. Implementations which receive a record with an 388 unrecognized Record Type MUST ignore the record if the Critical 389 Bit is 0 and MUST treat it as an error if the Critical Bit is 1 390 (see Section 4.1.3). 392 Record Type Number: A 15-bit integer in network byte order. The 393 semantics of record types 0-7 are specified in this memo. 394 Additional type numbers SHALL be tracked through the IANA Network 395 Time Security Key Establishment Record Types registry. 397 Body Length: The length of the Record Body field, in octets, as a 398 16-bit integer in network byte order. Record bodies MAY have any 399 representable length and need not be aligned to a word boundary. 401 Record Body: The syntax and semantics of this field SHALL be 402 determined by the Record Type. 404 For clarity regarding bit-endianness: the Critical Bit is the most- 405 significant bit of the first octet. In the C programming language, 406 given a network buffer `unsigned char b[]` containing an NTS-KE 407 record, the critical bit is `b[0] >> 7` while the record type is 408 `((b[0] & 0x7f) << 8) + b[1]`. 410 Note that, although the Type-Length-Body format of an NTS-KE record 411 is similar to that of an NTP extension field, the semantics of the 412 length field differ. While the length subfield of an NTP extension 413 field gives the length of the entire extension field including the 414 type and length subfields, the length field of an NTS-KE record gives 415 just the length of the body. 417 Figure 3 provides a schematic overview of the key establishment. It 418 displays the protocol steps to be performed by the NTS client and 419 server and record types to be exchanged. 421 +---------------------------------------+ 422 | - Verify client request message. | 423 | - Extract TLS key material. | 424 | - Generate KE response message. | 425 | - Include Record Types: | 426 | o NTS Next Protocol Negotiation | 427 | o AEAD Algorithm Negotiation | 428 | o | 429 | o | 430 | o New Cookie for NTPv4 | 431 | o | 432 | o End of Message | 433 +-----------------+---------------------+ 434 | 435 | 436 Server -----------+---------------+-----+-----------------------> 437 ^ \ 438 / \ 439 / TLS application \ 440 / data \ 441 / \ 442 / V 443 Client -----+---------------------------------+-----------------> 444 | | 445 | | 446 | | 447 +-----------+----------------------+ +------+-----------------+ 448 |- Generate KE request message. | |- Verify server response| 449 | - Include Record Types: | | message. | 450 | o NTS Next Protocol Negotiation | |- Extract cookie(s). | 451 | o AEAD Algorithm Negotiation | +------------------------+ 452 | o | 453 | o | 454 | o End of Message | 455 +----------------------------------+ 457 Figure 3: NTS Key Establishment Messages 459 4.1. NTS-KE Record Types 461 The following NTS-KE Record Types are defined: 463 4.1.1. End of Message 465 The End of Message record has a Record Type number of 0 and a zero- 466 length body. It MUST occur exactly once as the final record of every 467 NTS-KE request and response. The Critical Bit MUST be set. 469 4.1.2. NTS Next Protocol Negotiation 471 The NTS Next Protocol Negotiation record has a Record Type number of 472 1. It MUST occur exactly once in every NTS-KE request and response. 473 Its body consists of a sequence of 16-bit unsigned integers in 474 network byte order. Each integer represents a Protocol ID from the 475 IANA Network Time Security Next Protocols registry. The Critical Bit 476 MUST be set. 478 The Protocol IDs listed in the client's NTS Next Protocol Negotiation 479 record denote those protocols which the client wishes to speak using 480 the key material established through this NTS-KE session. Protocol 481 IDs listed in the NTS-KE server's response MUST comprise a subset of 482 those listed in the request and denote those protocols which the NTP 483 server is willing and able to speak using the key material 484 established through this NTS-KE session. The client MAY proceed with 485 one or more of them. The request MUST list at least one protocol, 486 but the response MAY be empty. 488 4.1.3. Error 490 The Error record has a Record Type number of 2. Its body is exactly 491 two octets long, consisting of an unsigned 16-bit integer in network 492 byte order, denoting an error code. The Critical Bit MUST be set. 494 Clients MUST NOT include Error records in their request. If clients 495 receive a server response which includes an Error record, they MUST 496 discard any key material negotiated during the initial TLS exchange 497 and MUST NOT proceed to the Next Protocol. Requirements for retry 498 intervals are described in Section 4.2. 500 The following error codes are defined: 502 Error code 0 means "Unrecognized Critical Record". The server 503 MUST respond with this error code if the request included a record 504 which the server did not understand and which had its Critical Bit 505 set. The client SHOULD NOT retry its request without 506 modification. 508 Error code 1 means "Bad Request". The server MUST respond with 509 this error if the request is not complete and syntactically well- 510 formed, or, upon the expiration of an implementation-defined 511 timeout, it has not yet received such a request. The client 512 SHOULD NOT retry its request without modification. 514 Error code 2 means "Internal Server Error". The server MUST 515 respond with this error if it is unable to respond properly due to 516 an internal condition. The client MAY retry its request. 518 4.1.4. Warning 520 The Warning record has a Record Type number of 3. Its body is 521 exactly two octets long, consisting of an unsigned 16-bit integer in 522 network byte order, denoting a warning code. The Critical Bit MUST 523 be set. 525 Clients MUST NOT include Warning records in their request. If 526 clients receive a server response which includes a Warning record, 527 they MAY discard any negotiated key material and abort without 528 proceeding to the Next Protocol. Unrecognized warning codes MUST be 529 treated as errors. 531 This memo defines no warning codes. 533 4.1.5. AEAD Algorithm Negotiation 535 The AEAD Algorithm Negotiation record has a Record Type number of 4. 536 Its body consists of a sequence of unsigned 16-bit integers in 537 network byte order, denoting Numeric Identifiers from the IANA AEAD 538 Algorithms registry [IANA-AEAD]. The Critical Bit MAY be set. 540 If the NTS Next Protocol Negotiation record offers Protocol ID 0 (for 541 NTPv4), then this record MUST be included exactly once. Other 542 protocols MAY require it as well. 544 When included in a request, this record denotes which AEAD algorithms 545 the client is willing to use to secure the Next Protocol, in 546 decreasing preference order. When included in a response, this 547 record denotes which algorithm the server chooses to use. It is 548 empty if the server supports none of the algorithms offered. In 549 requests, the list MUST include at least one algorithm. In 550 responses, it MUST include at most one. Honoring the client's 551 preference order is OPTIONAL: servers may select among any of the 552 client's offered choices, even if they are able to support some other 553 algorithm which the client prefers more. 555 Server implementations of NTS extension fields for NTPv4 (Section 5) 556 MUST support AEAD_AES_SIV_CMAC_256 [RFC5297] (Numeric Identifier 15). 557 That is, if the client includes AEAD_AES_SIV_CMAC_256 in its AEAD 558 Algorithm Negotiation record and the server accepts Protocol ID 0 559 (NTPv4) in its NTS Next Protocol Negotiation record, then the 560 server's AEAD Algorithm Negotiation record MUST NOT be empty. 562 4.1.6. New Cookie for NTPv4 564 The New Cookie for NTPv4 record has a Record Type number of 5. The 565 contents of its body SHALL be implementation-defined and clients MUST 566 NOT attempt to interpret them. See Section 6 for a suggested 567 construction. 569 Clients MUST NOT send records of this type. Servers MUST send at 570 least one record of this type, and SHOULD send eight of them, if the 571 Next Protocol Negotiation response record contains Protocol ID 0 572 (NTPv4) and the AEAD Algorithm Negotiation response record is not 573 empty. The Critical Bit SHOULD NOT be set. 575 4.1.7. NTPv4 Server Negotiation 577 The NTPv4 Server Negotiation record has a Record Type number of 6. 578 Its body consists of an ASCII-encoded [RFC0020] string. The contents 579 of the string SHALL be either an IPv4 address, an IPv6 address, or a 580 fully qualified domain name (FQDN). IPv4 addresses MUST be in dotted 581 decimal notation. IPv6 addresses MUST conform to the "Text 582 Representation of Addresses" as specified in RFC 4291 [RFC4291] and 583 MUST NOT include zone identifiers [RFC6874]. If a label contains at 584 least one non-ASCII character, it is an internationalized domain name 585 and an A-LABEL MUST be used as defined in Section 2.3.2.1 of RFC 5890 586 [RFC5890]. If the record contains a domain name, the recipient MUST 587 treat it as a FQDN, e.g. by making sure it ends with a dot. 589 When NTPv4 is negotiated as a Next Protocol and this record is sent 590 by the server, the body specifies the hostname or IP address of the 591 NTPv4 server with which the client should associate and which will 592 accept the supplied cookies. If no record of this type is sent, the 593 client SHALL interpret this as a directive to associate with an NTPv4 594 server at the same IP address as the NTS-KE server. Servers MUST NOT 595 send more than one record of this type. 597 When this record is sent by the client, it indicates that the client 598 wishes to associate with the specified NTP server. The NTS-KE server 599 MAY incorporate this request when deciding what NTPv4 Server 600 Negotiation records to respond with, but honoring the client's 601 preference is OPTIONAL. The client MUST NOT send more than one 602 record of this type. 604 If the client has sent a record of this type, the NTS-KE server 605 SHOULD reply with the same record if it is valid and the server is 606 able to supply cookies for it. If the client has not sent any record 607 of this type, the NTS-KE server SHOULD respond with either an NTP 608 server address in the same family as the NTS-KE session or a FQDN 609 that can be resolved to an address in that family, if such 610 alternatives are available. 612 Servers MAY set the Critical Bit on records of this type; clients 613 SHOULD NOT. 615 4.1.8. NTPv4 Port Negotiation 617 The NTPv4 Port Negotiation record has a Record Type number of 7. Its 618 body consists of a 16-bit unsigned integer in network byte order, 619 denoting a UDP port number. 621 When NTPv4 is negotiated as a Next Protocol and this record is sent 622 by the server, the body specifies the port number of the NTPv4 server 623 with which the client should associate and which will accept the 624 supplied cookies. If no record of this type is sent, the client 625 SHALL assume a default of 123 (the registered port number for NTP). 627 When this record is sent by the client in conjunction with a NTPv4 628 Server Negotiation record, it indicates that the client wishes to 629 associate with the NTP server at the specified port. The NTS-KE 630 server MAY incorporate this request when deciding what NTPv4 Server 631 Negotiation and NTPv4 Port Negotiation records to respond with, but 632 honoring the client's preference is OPTIONAL. 634 Servers MAY set the Critical Bit on records of this type; clients 635 SHOULD NOT. 637 4.2. Retry Intervals 639 A mechanism for not unnecessarily overloading the NTS-KE server is 640 REQUIRED when retrying the key establishment process due to protocol, 641 communication, or other errors. The exact workings of this will be 642 dependent on the application and operational experience gathered over 643 time. Until such experience is available, this memo provides the 644 following suggestion. 646 Clients SHOULD use exponential backoff, with an initial and minimum 647 retry interval of 10 seconds, a maximum retry interval of 5 days, and 648 a base of 1.5. Thus, the minimum interval in seconds, `t`, for the 649 nth retry is calculated with 651 t = min(10 * 1.5^(n-1), 432000). 653 Clients MUST NOT reset the retry interval until they have performed a 654 successful key establishment with the NTS-KE server, followed by a 655 successful use of the negotiated next protocol with the keys and data 656 established during that transaction. 658 4.3. Key Extraction (generally) 660 Following a successful run of the NTS-KE protocol, key material SHALL 661 be extracted using the HMAC-based Extract-and-Expand Key Derivation 662 Function (HKDF) [RFC5869] in accordance with RFC 8446, Section 7.5 663 [RFC8446]. Inputs to the exporter function are to be constructed in 664 a manner specific to the negotiated Next Protocol. However, all 665 protocols which utilize NTS-KE MUST conform to the following two 666 rules: 668 The disambiguating label string [RFC5705] MUST be "EXPORTER- 669 network-time-security". 671 The per-association context value [RFC5705] MUST be provided and 672 MUST begin with the two-octet Protocol ID which was negotiated as 673 a Next Protocol. 675 5. NTS Extension Fields for NTPv4 677 5.1. Key Extraction (for NTPv4) 679 Following a successful run of the NTS-KE protocol wherein Protocol ID 680 0 (NTPv4) is selected as a Next Protocol, two AEAD keys SHALL be 681 extracted: a client-to-server (C2S) key and a server-to-client (S2C) 682 key. These keys SHALL be computed with the HKDF defined in RFC 8446, 683 Section 7.5 [RFC8446] using the following inputs. 685 The disambiguating label string [RFC5705] SHALL be "EXPORTER- 686 network-time-security". 688 The per-association context value [RFC5705] SHALL consist of the 689 following five octets: 691 The first two octets SHALL be zero (the Protocol ID for NTPv4). 693 The next two octets SHALL be the Numeric Identifier of the 694 negotiated AEAD Algorithm in network byte order. 696 The final octet SHALL be 0x00 for the C2S key and 0x01 for the 697 S2C key. 699 Implementations wishing to derive additional keys for private or 700 experimental use MUST NOT do so by extending the above-specified 701 syntax for per-association context values. Instead, they SHOULD use 702 their own disambiguating label string. Note that RFC 5705 [RFC5705] 703 provides that disambiguating label strings beginning with 704 "EXPERIMENTAL" MAY be used without IANA registration. 706 5.2. Packet Structure Overview 708 In general, an NTS-protected NTPv4 packet consists of: 710 The usual 48-octet NTP header which is authenticated but not 711 encrypted. 713 Some extension fields which are authenticated but not encrypted. 715 An extension field which contains AEAD output (i.e., an 716 authentication tag and possible ciphertext). The corresponding 717 plaintext, if non-empty, consists of some extension fields which 718 benefit from both encryption and authentication. 720 Possibly, some additional extension fields which are neither 721 encrypted nor authenticated. In general, these are discarded by 722 the receiver. 724 Always included among the authenticated or authenticated-and- 725 encrypted extension fields are a cookie extension field and a unique 726 identifier extension field, as described in Section 5.7. The purpose 727 of the cookie extension field is to enable the server to offload 728 storage of session state onto the client. The purpose of the unique 729 identifier extension field is to protect the client from replay 730 attacks. 732 5.3. The Unique Identifier Extension Field 734 The Unique Identifier extension field provides the client with a 735 cryptographically strong means of detecting replayed packets. It has 736 a Field Type of [[TBD2]]. When the extension field is included in a 737 client packet (mode 3), its body SHALL consist of a string of octets 738 generated by a cryptographically secure random number generator 739 [RFC4086]. The string MUST be at least 32 octets long. When the 740 extension field is included in a server packet (mode 4), its body 741 SHALL contain the same octet string as was provided in the client 742 packet to which the server is responding. All server packets 743 generated by NTS-implementing servers in response to client packets 744 containing this extension field MUST also contain this field with the 745 same content as in the client's request. The field's use in modes 746 other than client-server is not defined. 748 This extension field MAY also be used standalone, without NTS, in 749 which case it provides the client with a means of detecting spoofed 750 packets from off-path attackers. Historically, NTP's origin 751 timestamp field has played both these roles, but for cryptographic 752 purposes this is suboptimal because it is only 64 bits long and, 753 depending on implementation details, most of those bits may be 754 predictable. In contrast, the Unique Identifier extension field 755 enables a degree of unpredictability and collision resistance more 756 consistent with cryptographic best practice. 758 5.4. The NTS Cookie Extension Field 760 The NTS Cookie extension field has a Field Type of [[TBD3]]. Its 761 purpose is to carry information which enables the server to recompute 762 keys and other session state without having to store any per-client 763 state. The contents of its body SHALL be implementation-defined and 764 clients MUST NOT attempt to interpret them. See Section 6 for a 765 suggested construction. The NTS Cookie extension field MUST NOT be 766 included in NTP packets whose mode is other than 3 (client) or 4 767 (server). 769 5.5. The NTS Cookie Placeholder Extension Field 771 The NTS Cookie Placeholder extension field has a Field Type of 772 [[TBD4]]. When this extension field is included in a client packet 773 (mode 3), it communicates to the server that the client wishes it to 774 send additional cookies in its response. This extension field MUST 775 NOT be included in NTP packets whose mode is other than 3. 777 Whenever an NTS Cookie Placeholder extension field is present, it 778 MUST be accompanied by an NTS Cookie extension field. The body 779 length of the NTS Cookie Placeholder extension field MUST be the same 780 as the body length of the NTS Cookie extension field. This length 781 requirement serves to ensure that the response will not be larger 782 than the request, in order to improve timekeeping precision and 783 prevent DDoS amplification. The contents of the NTS Cookie 784 Placeholder extension field's body SHOULD be all zeros and, aside 785 from checking its length, MUST be ignored by the server. 787 5.6. The NTS Authenticator and Encrypted Extension Fields Extension 788 Field 790 The NTS Authenticator and Encrypted Extension Fields extension field 791 is the central cryptographic element of an NTS-protected NTP packet. 792 Its Field Type is [[TBD5]]. It SHALL be formatted according to 793 Figure 4 and include the following fields: 795 Nonce Length: Two octets in network byte order, giving the length 796 of the Nonce field, excluding any padding, interpreted as an 797 unsigned integer. 799 Ciphertext Length: Two octets in network byte order, giving the 800 length of the Ciphertext field, excluding any padding, interpreted 801 as an unsigned integer. 803 Nonce: A nonce as required by the negotiated AEAD Algorithm. The 804 end of the field is zero-padded to a word (four octets) boundary. 806 Ciphertext: The output of the negotiated AEAD Algorithm. The 807 structure of this field is determined by the negotiated algorithm, 808 but it typically contains an authentication tag in addition to the 809 actual ciphertext. The end of the field is zero-padded to a word 810 (four octets) boundary. 812 Additional Padding: Clients which use a nonce length shorter than 813 the maximum allowed by the negotiated AEAD algorithm may be 814 required to include additional zero-padding. The necessary length 815 of this field is specified below. 817 0 1 2 3 818 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 819 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 820 | Nonce Length | Ciphertext Length | 821 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 822 | | 823 . . 824 . Nonce, including up to 3 octets padding . 825 . . 826 | | 827 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 828 | | 829 . . 830 . Ciphertext, including up to 3 octets padding . 831 . . 832 | | 833 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 834 | | 835 . . 836 . Additional Padding . 837 . . 838 | | 839 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 841 Figure 4: NTS Authenticator and Encrypted Extension Fields Extension 842 Field Format 844 The Ciphertext field SHALL be formed by providing the following 845 inputs to the negotiated AEAD Algorithm: 847 K: For packets sent from the client to the server, the C2S key 848 SHALL be used. For packets sent from the server to the client, 849 the S2C key SHALL be used. 851 A: The associated data SHALL consist of the portion of the NTP 852 packet beginning from the start of the NTP header and ending at 853 the end of the last extension field which precedes the NTS 854 Authenticator and Encrypted Extension Fields extension field. 856 P: The plaintext SHALL consist of all (if any) NTP extension 857 fields to be encrypted; if multiple extension fields are present 858 they SHALL be joined by concatenation. Each such field SHALL be 859 formatted in accordance with RFC 7822 [RFC7822], except that, 860 contrary to the RFC 7822 requirement that fields have a minimum 861 length of 16 or 28 octets, encrypted extension fields MAY be 862 arbitrarily short (but still MUST be a multiple of 4 octets in 863 length). 865 N: The nonce SHALL be formed however required by the negotiated 866 AEAD algorithm. 868 The purpose of the Additional Padding field is to ensure that servers 869 can always choose a nonce whose length is adequate to ensure its 870 uniqueness, even if the client chooses a shorter one, and still 871 ensure that the overall length of the server's response packet does 872 not exceed the length of the request. For mode 4 (server) packets, 873 no Additional Padding field is ever required. For mode 3 (client) 874 packets, the length of the Additional Padding field SHALL be computed 875 as follows. Let `N_LEN` be the padded length of the Nonce field. 876 Let `N_MAX` be, as specified by RFC 5116 [RFC5116], the maximum 877 permitted nonce length for the negotiated AEAD algorithm. Let 878 `N_REQ` be the lesser of 16 and N_MAX, rounded up to the nearest 879 multiple of 4. If N_LEN is greater than or equal to N_REQ, then no 880 Additional Padding field is required. Otherwise, the Additional 881 Padding field SHALL be at least N_REQ - N_LEN octets in length. 882 Servers MUST enforce this requirement by discarding any packet which 883 does not conform to it. 885 Senders are always free to include more Additional Padding than 886 mandated by the above paragraph. Theoretically, it could be 887 necessary to do so in order to bring the extension field to the 888 minimum length required by RFC 7822 [RFC7822]. This should never 889 happen in practice because any reasonable AEAD algorithm will have a 890 nonce and an authenticator long enough to bring the extension field 891 to its required length already. Nonetheless, implementers are 892 advised to explicitly handle this case and ensure that the extension 893 field they emit is of legal length. 895 The NTS Authenticator and Encrypted Extension Fields extension field 896 MUST NOT be included in NTP packets whose mode is other than 3 897 (client) or 4 (server). 899 5.7. Protocol Details 901 A client sending an NTS-protected request SHALL include the following 902 extension fields as displayed in Figure 5: 904 Exactly one Unique Identifier extension field which MUST be 905 authenticated, MUST NOT be encrypted, and whose contents MUST be 906 the output of a cryptographically secure random number generator. 907 [RFC4086] 909 Exactly one NTS Cookie extension field which MUST be authenticated 910 and MUST NOT be encrypted. The cookie MUST be one which has been 911 previously provided to the client, either from the key 912 establishment server during the NTS-KE handshake or from the NTP 913 server in response to a previous NTS-protected NTP request. 915 Exactly one NTS Authenticator and Encrypted Extension Fields 916 extension field, generated using an AEAD Algorithm and C2S key 917 established through NTS-KE. 919 To protect the client's privacy, the client SHOULD avoid reusing a 920 cookie. If the client does not have any cookies that it has not 921 already sent, it SHOULD initiate a re-run of the NTS-KE protocol. 922 The client MAY reuse cookies in order to prioritize resilience over 923 unlinkability. Which of the two that should be prioritized in any 924 particular case is dependent on the application and the user's 925 preference. Section 10.1 describes the privacy considerations of 926 this in further detail. 928 The client MAY include one or more NTS Cookie Placeholder extension 929 fields which MUST be authenticated and MAY be encrypted. The number 930 of NTS Cookie Placeholder extension fields that the client includes 931 SHOULD be such that if the client includes N placeholders and the 932 server sends back N+1 cookies, the number of unused cookies stored by 933 the client will come to eight. The client SHOULD NOT include more 934 than seven NTS Cookie Placeholder extension fields in a request. 935 When both the client and server adhere to all cookie-management 936 guidance provided in this memo, the number of placeholder extension 937 fields will equal the number of dropped packets since the last 938 successful volley. 940 In rare circumstances, it may be necessary to include fewer NTS 941 Cookie Placeholder extensions than recommended above in order to 942 prevent datagram fragmentation. When cookies adhere the format 943 recommended in Section 6 and the AEAD in use is the mandatory-to- 944 implement AEAD_AES_SIV_CMAC_256, senders can include a cookie and 945 seven placeholders and still have packet size fall comfortably below 946 1280 octets if no non-NTS-related extensions are used; 1280 octets is 947 the minimum prescribed MTU for IPv6 and is generally safe for 948 avoiding IPv4 fragmentation. Nonetheless, senders SHOULD include 949 fewer cookies and placeholders than otherwise indicated if doing so 950 is necessary to prevent fragmentation. 952 +---------------------------------------+ 953 | - Verify time request message | 954 | - Generate time response message | 955 | - Included NTPv4 extension fields | 956 | o Unique Identifier EF | 957 | o NTS Authentication and | 958 | Encrypted Extension Fields EF | 959 | - NTS Cookie EF | 960 | - | 961 | - Transmit time request packet | 962 +-----------------+---------------------+ 963 | 964 | 965 Server -----------+---------------+-----+-----------------------> 966 ^ \ 967 / \ 968 Time request / \ Time response 969 (mode 3) / \ (mode 4) 970 / \ 971 / V 972 Client -----+---------------------------------+-----------------> 973 | | 974 | | 975 | | 976 +-----------+----------------------+ +------+-----------------+ 977 |- Generate time request message | |- Verify time response | 978 | - Include NTPv4 Extension fields | | message | 979 | o Unique Identifier EF | |- Extract cookie(s) | 980 | o NTS Cookie EF | |- Time synchronization | 981 | o | | processing | 982 | | +------------------------+ 983 |- Generate AEAD tag of NTP message| 984 |- Add NTS Authentication and | 985 | Encrypted Extension Fields EF | 986 |- Transmit time request packet | 987 +----------------------------------+ 989 Figure 5: NTS-protected NTP Time Synchronization Messages 991 The client MAY include additional (non-NTS-related) extension fields 992 which MAY appear prior to the NTS Authenticator and Encrypted 993 Extension Fields extension fields (therefore authenticated but not 994 encrypted), within it (therefore encrypted and authenticated), or 995 after it (therefore neither encrypted nor authenticated). The server 996 MUST discard any unauthenticated extension fields. Future 997 specifications of extension fields MAY provide exceptions to this 998 rule. 1000 Upon receiving an NTS-protected request, the server SHALL (through 1001 some implementation-defined mechanism) use the cookie to recover the 1002 AEAD Algorithm, C2S key, and S2C key associated with the request, and 1003 then use the C2S key to authenticate the packet and decrypt the 1004 ciphertext. If the cookie is valid and authentication and decryption 1005 succeed, the server SHALL include the following extension fields in 1006 its response: 1008 Exactly one Unique Identifier extension field which MUST be 1009 authenticated, MUST NOT be encrypted, and whose contents SHALL 1010 echo those provided by the client. 1012 Exactly one NTS Authenticator and Encrypted Extension Fields 1013 extension field, generated using the AEAD algorithm and S2C key 1014 recovered from the cookie provided by the client. 1016 One or more NTS Cookie extension fields which MUST be 1017 authenticated and encrypted. The number of NTS Cookie extension 1018 fields included SHOULD be equal to, and MUST NOT exceed, one plus 1019 the number of valid NTS Cookie Placeholder extension fields 1020 included in the request. The cookies returned in those fields 1021 MUST be valid for use with the NTP server that sent them. They 1022 MAY be valid for other NTP servers as well, but there is no way 1023 for the server to indicate this. 1025 We emphasize the contrast that NTS Cookie extension fields MUST NOT 1026 be encrypted when sent from client to server, but MUST be encrypted 1027 when sent from server to client. The former is necessary in order 1028 for the server to be able to recover the C2S and S2C keys, while the 1029 latter is necessary to satisfy the unlinkability goals discussed in 1030 Section 10.1. We emphasize also that "encrypted" means encapsulated 1031 within the NTS Authenticator and Encrypted Extensions extension 1032 field. While the body of an NTS Cookie extension field will 1033 generally consist of some sort of AEAD output (regardless of whether 1034 the recommendations of Section 6 are precisely followed), this is not 1035 sufficient to make the extension field "encrypted". 1037 The server MAY include additional (non-NTS-related) extension fields 1038 which MAY appear prior to the NTS Authenticator and Encrypted 1039 Extension Fields extension field (therefore authenticated but not 1040 encrypted), within it (therefore encrypted and authenticated), or 1041 after it (therefore neither encrypted nor authenticated). The client 1042 MUST discard any unauthenticated extension fields. Future 1043 specifications of extension fields MAY provide exceptions to this 1044 rule. 1046 Upon receiving an NTS-protected response, the client MUST verify that 1047 the Unique Identifier matches that of an outstanding request, and 1048 that the packet is authentic under the S2C key associated with that 1049 request. If either of these checks fails, the packet MUST be 1050 discarded without further processing. In particular, the client MUST 1051 discard unprotected responses to NTS-protected requests. 1053 If the server is unable to validate the cookie or authenticate the 1054 request, it SHOULD respond with a Kiss-o'-Death (KoD) packet (see RFC 1055 5905, Section 7.4 [RFC5905]) with kiss code "NTSN", meaning "NTS NAK" 1056 (NTS negative-acknowledgment). It MUST NOT include any NTS Cookie or 1057 NTS Authenticator and Encrypted Extension Fields extension fields. 1059 If the NTP server has previously responded with authentic NTS- 1060 protected NTP packets, the client MUST verify that any KoD packets 1061 received from the server contain the Unique Identifier extension 1062 field and that the Unique Identifier matches that of an outstanding 1063 request. If this check fails, the packet MUST be discarded without 1064 further processing. If this check passes, the client MUST comply 1065 with RFC 5905, Section 7.4 [RFC5905] where required. 1067 A client MAY automatically re-run the NTS-KE protocol upon forced 1068 disassociation from an NTP server. In that case, it MUST avoid 1069 quickly looping between the NTS-KE and NTP servers by rate limiting 1070 the retries. Requirements for retry intervals in NTS-KE are 1071 described in Section 4.2. 1073 Upon reception of the NTS NAK kiss code, the client SHOULD wait until 1074 the next poll for a valid NTS-protected response and if none is 1075 received, initiate a fresh NTS-KE handshake to try to renegotiate new 1076 cookies, AEAD keys, and parameters. If the NTS-KE handshake 1077 succeeds, the client MUST discard all old cookies and parameters and 1078 use the new ones instead. As long as the NTS-KE handshake has not 1079 succeeded, the client SHOULD continue polling the NTP server using 1080 the cookies and parameters it has. 1082 To allow for NTP session restart when the NTS-KE server is 1083 unavailable and to reduce NTS-KE server load, the client SHOULD keep 1084 at least one unused but recent cookie, AEAD keys, negotiated AEAD 1085 algorithm, and other necessary parameters on persistent storage. 1087 This way, the client is able to resume the NTP session without 1088 performing renewed NTS-KE negotiation. 1090 6. Suggested Format for NTS Cookies 1092 This section is non-normative. It gives a suggested way for servers 1093 to construct NTS cookies. All normative requirements are stated in 1094 Section 4.1.6 and Section 5.4. 1096 The role of cookies in NTS is closely analogous to that of session 1097 cookies in TLS. Accordingly, the thematic resemblance of this 1098 section to RFC 5077 [RFC5077] is deliberate and the reader should 1099 likewise take heed of its security considerations. 1101 Servers should select an AEAD algorithm which they will use to 1102 encrypt and authenticate cookies. The chosen algorithm should be one 1103 such as AEAD_AES_SIV_CMAC_256 [RFC5297] which resists accidental 1104 nonce reuse. It need not be the same as the one that was negotiated 1105 with the client. Servers should randomly generate and store a secret 1106 master AEAD key `K`. Servers should additionally choose a non-secret, 1107 unique value `I` as key-identifier for `K`. 1109 Servers should periodically (e.g., once daily) generate a new pair 1110 `(I,K)` and immediately switch to using these values for all newly- 1111 generated cookies. Following each such key rotation, servers should 1112 securely erase any previously generated keys that should now be 1113 expired. Servers should continue to accept any cookie generated 1114 using keys that they have not yet erased, even if those keys are no 1115 longer current. Erasing old keys provides for forward secrecy, 1116 limiting the scope of what old information can be stolen if a master 1117 key is somehow compromised. Holding on to a limited number of old 1118 keys allows clients to seamlessly transition from one generation to 1119 the next without having to perform a new NTS-KE handshake. 1121 The need to keep keys synchronized between NTS-KE and NTP servers as 1122 well as across load-balanced clusters can make automatic key rotation 1123 challenging. However, the task can be accomplished without the need 1124 for central key-management infrastructure by using a ratchet, i.e., 1125 making each new key a deterministic, cryptographically pseudo-random 1126 function of its predecessor. A recommended concrete implementation 1127 of this approach is to use HKDF [RFC5869] to derive new keys, using 1128 the key's predecessor as Input Keying Material and its key identifier 1129 as a salt. 1131 To form a cookie, servers should first form a plaintext `P` 1132 consisting of the following fields: 1134 The AEAD algorithm negotiated during NTS-KE. 1136 The S2C key. 1138 The C2S key. 1140 Servers should then generate a nonce `N` uniformly at random, and 1141 form AEAD output `C` by encrypting `P` under key `K` with nonce `N` 1142 and no associated data. 1144 The cookie should consist of the tuple `(I,N,C)`. 1146 To verify and decrypt a cookie provided by the client, first parse it 1147 into its components `I`, `N`, and `C`. Use `I` to look up its 1148 decryption key `K`. If the key whose identifier is `I` has been 1149 erased or never existed, decryption fails; reply with an NTS NAK. 1150 Otherwise, attempt to decrypt and verify ciphertext `C` using key `K` 1151 and nonce `N` with no associated data. If decryption or verification 1152 fails, reply with an NTS NAK. Otherwise, parse out the contents of 1153 the resulting plaintext `P` to obtain the negotiated AEAD algorithm, 1154 S2C key, and C2S key. 1156 7. IANA Considerations 1158 7.1. Service Name and Transport Protocol Port Number Registry 1160 IANA is requested to allocate the following entry in the Service Name 1161 and Transport Protocol Port Number Registry [RFC6335]: 1163 Service Name: ntske 1165 Transport Protocol: tcp 1167 Assignee: IESG 1169 Contact: IETF Chair 1171 Description: Network Time Security Key Establishment 1173 Reference: [[this memo]] 1175 Port Number: [[TBD1]], selected by IANA from the User Port range 1177 [[RFC EDITOR: Replace all instances of [[TBD1]] in this document with 1178 the IANA port assignment.]] 1180 7.2. TLS Application-Layer Protocol Negotiation (ALPN) Protocol IDs 1181 Registry 1183 IANA is requested to allocate the following entry in the TLS 1184 Application-Layer Protocol Negotiation (ALPN) Protocol IDs registry 1185 [RFC7301]: 1187 Protocol: Network Time Security Key Establishment, version 1 1189 Identification Sequence: 1190 0x6E 0x74 0x73 0x6B 0x65 0x2F 0x31 ("ntske/1") 1192 Reference: [[this memo]], Section 4 1194 7.3. TLS Exporter Labels Registry 1196 IANA is requested to allocate the following entry in the TLS Exporter 1197 Labels Registry [RFC5705]: 1199 +-------------------+---------+-------------+----------------+------+ 1200 | Value | DTLS-OK | Recommended | Reference | Note | 1201 +-------------------+---------+-------------+----------------+------+ 1202 | EXPORTER-network- | Y | Y | [[this memo]], | | 1203 | time-security | | | Section 4.3 | | 1204 +-------------------+---------+-------------+----------------+------+ 1206 7.4. NTP Kiss-o'-Death Codes Registry 1208 IANA is requested to allocate the following entry in the registry of 1209 NTP Kiss-o'-Death Codes [RFC5905]: 1211 +------+---------------------------------------+--------------------+ 1212 | Code | Meaning | Reference | 1213 +------+---------------------------------------+--------------------+ 1214 | NTSN | Network Time Security (NTS) negative- | [[this memo]], | 1215 | | acknowledgment (NAK) | Section 5.7 | 1216 +------+---------------------------------------+--------------------+ 1218 7.5. NTP Extension Field Types Registry 1220 IANA is requested to allocate the following entries in the NTP 1221 Extension Field Types registry [RFC5905]: 1223 +----------+-----------------------------+--------------------------+ 1224 | Field | Meaning | Reference | 1225 | Type | | | 1226 +----------+-----------------------------+--------------------------+ 1227 | [[TBD2]] | Unique Identifier | [[this memo]], | 1228 | | | Section 5.3 | 1229 | [[TBD3]] | NTS Cookie | [[this memo]], | 1230 | | | Section 5.4 | 1231 | [[TBD4]] | NTS Cookie Placeholder | [[this memo]], | 1232 | | | Section 5.5 | 1233 | [[TBD5]] | NTS Authenticator and | [[this memo]], | 1234 | | Encrypted Extension Fields | Section 5.6 | 1235 +----------+-----------------------------+--------------------------+ 1237 [[RFC EDITOR: REMOVE BEFORE PUBLICATION - The NTP WG suggests that 1238 the following values be used: 1240 Unique Identifier 0x0104 1241 NTS Cookie 0x0204 1242 Cookie Placeholder 0x0304 1243 NTS Authenticator 0x0404]] 1245 [[RFC EDITOR: Replace all instances of [[TBD2]], [[TBD3]], [[TBD4]], 1246 and [[TBD5]] in this document with the respective IANA assignments.]] 1248 7.6. Network Time Security Key Establishment Record Types Registry 1250 IANA is requested to create a new registry entitled "Network Time 1251 Security Key Establishment Record Types". Entries SHALL have the 1252 following fields: 1254 Record Type Number (REQUIRED): An integer in the range 0-32767 1255 inclusive. 1257 Description (REQUIRED): A short text description of the purpose of 1258 the field. 1260 Reference (REQUIRED): A reference to a document specifying the 1261 semantics of the record. 1263 The policy for allocation of new entries in this registry SHALL vary 1264 by the Record Type Number, as follows: 1266 0-1023: IETF Review 1268 1024-16383: Specification Required 1270 16384-32767: Private and Experimental Use 1272 The initial contents of this registry SHALL be as follows: 1274 +-------------+-------------------------+---------------------------+ 1275 | Record Type | Description | Reference | 1276 | Number | | | 1277 +-------------+-------------------------+---------------------------+ 1278 | 0 | End of Message | [[this memo]], | 1279 | | | Section 4.1.1 | 1280 | 1 | NTS Next Protocol | [[this memo]], | 1281 | | Negotiation | Section 4.1.2 | 1282 | 2 | Error | [[this memo]], | 1283 | | | Section 4.1.3 | 1284 | 3 | Warning | [[this memo]], | 1285 | | | Section 4.1.4 | 1286 | 4 | AEAD Algorithm | [[this memo]], | 1287 | | Negotiation | Section 4.1.5 | 1288 | 5 | New Cookie for NTPv4 | [[this memo]], | 1289 | | | Section 4.1.6 | 1290 | 6 | NTPv4 Server | [[this memo]], | 1291 | | Negotiation | Section 4.1.7 | 1292 | 7 | NTPv4 Port Negotiation | [[this memo]], | 1293 | | | Section 4.1.8 | 1294 | 16384-32767 | Reserved for Private & | [[this memo]] | 1295 | | Experimental Use | | 1296 +-------------+-------------------------+---------------------------+ 1298 7.7. Network Time Security Next Protocols Registry 1300 IANA is requested to create a new registry entitled "Network Time 1301 Security Next Protocols". Entries SHALL have the following fields: 1303 Protocol ID (REQUIRED): An integer in the range 0-65535 inclusive, 1304 functioning as an identifier. 1306 Protocol Name (REQUIRED): A short text string naming the protocol 1307 being identified. 1309 Reference (REQUIRED): A reference to a relevant specification 1310 document. 1312 The policy for allocation of new entries in these registries SHALL 1313 vary by their Protocol ID, as follows: 1315 0-1023: IETF Review 1317 1024-32767: Specification Required 1319 32768-65535: Private and Experimental Use 1321 The initial contents of this registry SHALL be as follows: 1323 +-------------+-------------------------------+---------------------+ 1324 | Protocol ID | Protocol Name | Reference | 1325 +-------------+-------------------------------+---------------------+ 1326 | 0 | Network Time Protocol version | [[this memo]] | 1327 | | 4 (NTPv4) | | 1328 | 32768-65535 | Reserved for Private or | Reserved by [[this | 1329 | | Experimental Use | memo]] | 1330 +-------------+-------------------------------+---------------------+ 1332 7.8. Network Time Security Error and Warning Codes Registries 1334 IANA is requested to create two new registries entitled "Network Time 1335 Security Error Codes" and "Network Time Security Warning Codes". 1336 Entries in each SHALL have the following fields: 1338 Number (REQUIRED): An integer in the range 0-65535 inclusive 1340 Description (REQUIRED): A short text description of the condition. 1342 Reference (REQUIRED): A reference to a relevant specification 1343 document. 1345 The policy for allocation of new entries in these registries SHALL 1346 vary by their Number, as follows: 1348 0-1023: IETF Review 1350 1024-32767: Specification Required 1352 32768-65535: Private and Experimental Use 1354 The initial contents of the Network Time Security Error Codes 1355 Registry SHALL be as follows: 1357 +-------------+------------------------------+----------------------+ 1358 | Number | Description | Reference | 1359 +-------------+------------------------------+----------------------+ 1360 | 0 | Unrecognized Critical | [[this memo]], | 1361 | | Extension | Section 4.1.3 | 1362 | 1 | Bad Request | [[this memo]], | 1363 | | | Section 4.1.3 | 1364 | 2 | Internal Server Error | [[this memo]], | 1365 | | | Section 4.1.3 | 1366 | 32768-65535 | Reserved for Private or | Reserved by [[this | 1367 | | Experimental Use | memo]] | 1368 +-------------+------------------------------+----------------------+ 1369 The Network Time Security Warning Codes Registry SHALL initially be 1370 empty except for the reserved range, i.e.: 1372 +-------------+-------------------------------+---------------------+ 1373 | Number | Description | Reference | 1374 +-------------+-------------------------------+---------------------+ 1375 | 32768-65535 | Reserved for Private or | Reserved by [[this | 1376 | | Experimental Use | memo]] | 1377 +-------------+-------------------------------+---------------------+ 1379 8. Implementation Status - RFC EDITOR: REMOVE BEFORE PUBLICATION 1381 This section records the status of known implementations of the 1382 protocol defined by this specification at the time of posting of this 1383 Internet-Draft, and is based on a proposal described in RFC 7942. 1384 The description of implementations in this section is intended to 1385 assist the IETF in its decision processes in progressing drafts to 1386 RFCs. Please note that the listing of any individual implementation 1387 here does not imply endorsement by the IETF. Furthermore, no effort 1388 has been spent to verify the information presented here that was 1389 supplied by IETF contributors. This is not intended as, and must not 1390 be construed to be, a catalog of available implementations or their 1391 features. Readers are advised to note that other implementations may 1392 exist. 1394 According to RFC 7942, "this will allow reviewers and working groups 1395 to assign due consideration to documents that have the benefit of 1396 running code, which may serve as evidence of valuable experimentation 1397 and feedback that have made the implemented protocols more mature. 1398 It is up to the individual working groups to use this information as 1399 they see fit". 1401 8.1. Implementation 1 1403 Organization: Ostfalia University of Applied Science 1405 Implementor: Martin Langer 1407 Maturity: Proof-of-Concept Prototype 1409 This implementation was used to verify consistency and to ensure 1410 completeness of this specification. 1412 8.1.1. Coverage 1414 This implementation covers the complete specification. 1416 8.1.2. Licensing 1418 The code is released under a Apache License 2.0 license. 1420 The source code is available at: https://gitlab.com/MLanger/nts/ 1422 8.1.3. Contact Information 1424 Contact Martin Langer: mart.langer@ostfalia.de 1426 8.1.4. Last Update 1428 The implementation was updated 25. February 2019. 1430 8.2. Implementation 2 1432 Organization: Netnod 1434 Implementor: Christer Weinigel 1436 Maturity: Proof-of-Concept Prototype 1438 This implementation was used to verify consistency and to ensure 1439 completeness of this specification. 1441 8.2.1. Coverage 1443 This implementation covers the complete specification. 1445 8.2.2. Licensing 1447 The source code is available at: https://github.com/Netnod/nts-poc- 1448 python. 1450 See LICENSE file for details on licensing (BSD 2). 1452 8.2.3. Contact Information 1454 Contact Christer Weinigel: christer@weinigel.se 1456 8.2.4. Last Update 1458 The implementation was updated 31. January 2019. 1460 8.3. Implementation 3 1462 Organization: Red Hat 1464 Implementor: Miroslav Lichvar 1466 Maturity: Prototype 1468 This implementation was used to verify consistency and to ensure 1469 completeness of this specification. 1471 8.3.1. Coverage 1473 This implementation covers the complete specification. 1475 8.3.2. Licensing 1477 Licensing is GPLv2. 1479 The source code is available at: https://github.com/mlichvar/chrony- 1480 nts 1482 8.3.3. Contact Information 1484 Contact Miroslav Lichvar: mlichvar@redhat.com 1486 8.3.4. Last Update 1488 The implementation was updated 28. March 2019. 1490 8.4. Implementation 4 1492 Organization: NTPsec 1494 Implementor: Hal Murray and NTPsec team 1496 Maturity:Looking for testers. Servers running at 1497 ntp1.glypnod.com:123 and ntp2.glypnod.com:123 1499 This implementation was used to verify consistency and to ensure 1500 completeness of this specification. 1502 8.4.1. Coverage 1504 This implementation covers the complete specification. 1506 8.4.2. Licensing 1508 The source code is available at: https://gitlab.com/NTPsec/ntpsec. 1509 Licensing details in LICENSE. 1511 8.4.3. Contact Information 1513 Contact Hal Murray: hmurray@megapathdsl.net, devel@ntpsec.org 1515 8.4.4. Last Update 1517 The implementation was updated 2019-Apr-10. 1519 8.5. Implementation 5 1521 Organization: Cloudflare 1523 Implementor: Watson Ladd 1525 Maturity: 1527 This implementation was used to verify consistency and to ensure 1528 completeness of this specification. 1530 8.5.1. Coverage 1532 This implementation covers the server side of the NTS specification. 1534 8.5.2. Licensing 1536 The source code is available at: https://github.com/wbl/nts-rust 1538 Licensing is ISC (details see LICENSE.txt file). 1540 8.5.3. Contact Information 1542 Contact Watson Ladd: watson@cloudflare.com 1544 8.5.4. Last Update 1546 The implementation was updated 21. March 2019. 1548 8.6. Implementation 6 1550 Organization: Hacklunch, independent 1552 Implementor: Michael Cardell Widerkrantz, Daniel Lublin, Martin 1553 Samuelsson et. al. 1555 Maturity: interoperable client, immature server 1557 8.6.1. Coverage 1559 NTS-KE client and server. 1561 8.6.2. Licensing 1563 Licensing is ISC (details in LICENSE file). 1565 Source code is available at: https://gitlab.com/hacklunch/ntsclient 1567 8.6.3. Contact Information 1569 Contact Michael Cardell Widerkrantz: mc@netnod.se 1571 8.6.4. Last Update 1573 The implementation was updated 6. February 2020. 1575 8.7. Interoperability 1577 The Interoperability tests distinguished between NTS key 1578 establishment protocol and NTS time exchange messages. For the 1579 implementations 1, 2, 3, and 4 pairwise interoperability of the NTS 1580 key establishment protocol and exchange of NTS protected NTP messages 1581 have been verified successfully. The implementation 2 was able to 1582 successfully perform the key establishment protocol against the 1583 server side of the implementation 5. 1585 These tests successfully demonstrate that there are at least four 1586 running implementations of this draft which are able to interoperate. 1588 9. Security Considerations 1590 9.1. Protected Modes 1592 NTP provides many different operating modes in order to support 1593 different network topologies and to adapt to various requirements. 1594 This memo only specifies NTS for NTP modes 3 (client) and 4 (server) 1595 (see Section 1.2). The best current practice for authenticating the 1596 other NTP modes is using the symmetric message authentication code 1597 feature as described in RFC 5905 [RFC5905] and RFC 8573 [RFC8573]. 1599 9.2. Cookie Encryption Key Compromise 1601 If the suggested format for NTS cookies in Section 6 of this draft is 1602 used, an attacker who has gained access to the secret cookie 1603 encryption key `K` can impersonate the NTP server, including 1604 generating new cookies. NTP and NTS-KE server operators SHOULD 1605 remove compromised keys as soon as the compromise is discovered. 1606 This will cause the NTP servers to respond with NTS NAK, thus forcing 1607 key renegotiation. Note that this measure does not protect against 1608 MITM attacks where the attacker has access to a compromised cookie 1609 encryption key. If another cookie scheme is used, there are likely 1610 similar considerations for that particular scheme. 1612 9.3. Sensitivity to DDoS Attacks 1614 The introduction of NTS brings with it the introduction of asymmetric 1615 cryptography to NTP. Asymmetric cryptography is necessary for 1616 initial server authentication and AEAD key extraction. Asymmetric 1617 cryptosystems are generally orders of magnitude slower than their 1618 symmetric counterparts. This makes it much harder to build systems 1619 that can serve requests at a rate corresponding to the full line 1620 speed of the network connection. This, in turn, opens up a new 1621 possibility for DDoS attacks on NTP services. 1623 The main protection against these attacks in NTS lies in that the use 1624 of asymmetric cryptosystems is only necessary in the initial NTS-KE 1625 phase of the protocol. Since the protocol design enables separation 1626 of the NTS-KE and NTP servers, a successful DDoS attack on an NTS-KE 1627 server separated from the NTP service it supports will not affect NTP 1628 users that have already performed initial authentication, AEAD key 1629 extraction, and cookie exchange. 1631 NTS users should also consider that they are not fully protected 1632 against DoS attacks by on-path adversaries. In addition to dropping 1633 packets and attacks such as those described in Section 9.6, an on- 1634 path attacker can send spoofed kiss-o'-death replies, which are not 1635 authenticated, in response to NTP requests. This could result in 1636 significantly increased load on the NTS-KE server. Implementers have 1637 to weigh the user's need for unlinkability against the added 1638 resilience that comes with cookie reuse in cases of NTS-KE server 1639 unavailability. 1641 9.4. Avoiding DDoS Amplification 1643 Certain non-standard and/or deprecated features of the Network Time 1644 Protocol enable clients to send a request to a server which causes 1645 the server to send a response much larger than the request. Servers 1646 which enable these features can be abused in order to amplify traffic 1647 volume in DDoS attacks by sending them a request with a spoofed 1648 source IP. In recent years, attacks of this nature have become an 1649 endemic nuisance. 1651 NTS is designed to avoid contributing any further to this problem by 1652 ensuring that NTS-related extension fields included in server 1653 responses will be the same size as the NTS-related extension fields 1654 sent by the client. In particular, this is why the client is 1655 required to send a separate and appropriately padded-out NTS Cookie 1656 Placeholder extension field for every cookie it wants to get back, 1657 rather than being permitted simply to specify a desired quantity. 1659 Due to the RFC 7822 [RFC7822] requirement that extensions be padded 1660 and aligned to four-octet boundaries, response size may still in some 1661 cases exceed request size by up to three octets. This is 1662 sufficiently inconsequential that we have declined to address it. 1664 9.5. Initial Verification of Server Certificates 1666 NTS's security goals are undermined if the client fails to verify 1667 that the X.509 certificate chain presented by the NTS-KE server is 1668 valid and rooted in a trusted certificate authority. RFC 5280 1669 [RFC5280] and RFC 6125 [RFC6125] specify how such verification is to 1670 be performed in general. However, the expectation that the client 1671 does not yet have a correctly-set system clock at the time of 1672 certificate verification presents difficulties with verifying that 1673 the certificate is within its validity period, i.e., that the current 1674 time lies between the times specified in the certificate's notBefore 1675 and notAfter fields. It may be operationally necessary in some cases 1676 for a client to accept a certificate which appears to be expired or 1677 not yet valid. While there is no perfect solution to this problem, 1678 there are several mitigations the client can implement to make it 1679 more difficult for an adversary to successfully present an expired 1680 certificate: 1682 Check whether the system time is in fact unreliable. On systems 1683 with the ntp_adjtime() system call, a return code other than 1684 TIME_ERROR indicates that some trusted software has already set 1685 the time and certificates can be strictly validated. 1687 Allow the system administrator to specify that certificates should 1688 *always* be strictly validated. Such a configuration is 1689 appropriate on systems which have a battery-backed clock and which 1690 can reasonably prompt the user to manually set an approximately- 1691 correct time if it appears to be needed. 1693 Once the clock has been synchronized, periodically write the 1694 current system time to persistent storage. Do not accept any 1695 certificate whose notAfter field is earlier than the last recorded 1696 time. 1698 NTP time replies are expected to be consistent with the NTS-KE TLS 1699 certificate validity period, i.e. time replies received 1700 immediately after an NTS-KE handshake are expected to lie within 1701 the certificate validity period. Implementations are recommended 1702 to check that this is the case. Performing a new NTS-KE handshake 1703 based solely on the fact that the certificate used by the NTS-KE 1704 server in a previous handshake has expired is normally not 1705 necessary. Clients that still wish to do this must take care not 1706 to cause an inadvertent denial-of-service attack on the NTS-KE 1707 server, for example by picking a random time in the week preceding 1708 certificate expiry to perform the new handshake. 1710 Use multiple time sources. The ability to pass off an expired 1711 certificate is only useful to an adversary who has compromised the 1712 corresponding private key. If the adversary has compromised only 1713 a minority of servers, NTP's selection algorithm (RFC 5905 section 1714 11.2.1 [RFC5905]) will protect the client from accepting bad time 1715 from the adversary-controlled servers. 1717 9.6. Delay Attacks 1719 In a packet delay attack, an adversary with the ability to act as a 1720 man-in-the-middle delays time synchronization packets between client 1721 and server asymmetrically [RFC7384]. Since NTP's formula for 1722 computing time offset relies on the assumption that network latency 1723 is roughly symmetrical, this leads to the client to compute an 1724 inaccurate value [Mizrahi]. The delay attack does not reorder or 1725 modify the content of the exchanged synchronization packets. 1726 Therefore, cryptographic means do not provide a feasible way to 1727 mitigate this attack. However, the maximum error that an adversary 1728 can introduce is bounded by half of the round trip delay. 1730 RFC 5905 [RFC5905] specifies a parameter called MAXDIST which denotes 1731 the maximum round-trip latency (including not only the immediate 1732 round trip between client and server, but the whole distance back to 1733 the reference clock as reported in the Root Delay field) that a 1734 client will tolerate before concluding that the server is unsuitable 1735 for synchronization. The standard value for MAXDIST is one second, 1736 although some implementations use larger values. Whatever value a 1737 client chooses, the maximum error which can be introduced by a delay 1738 attack is MAXDIST/2. 1740 Usage of multiple time sources, or multiple network paths to a given 1741 time source [Shpiner], may also serve to mitigate delay attacks if 1742 the adversary is in control of only some of the paths. 1744 9.7. NTS Stripping 1746 Implementers must be aware of the possibility of "NTS stripping" 1747 attacks, where an attacker attempts to trick clients into reverting 1748 to plain NTP. Naive client implementations might, for example, 1749 revert automatically to plain NTP if the NTS-KE handshake fails. A 1750 man-in-the-middle attacker can easily cause this to happen. Even 1751 clients that already hold valid cookies can be vulnerable, since an 1752 attacker can force a client to repeat the NTS-KE handshake by sending 1753 faked NTP mode 4 replies with the NTS NAK kiss code. Forcing a 1754 client to repeat the NTS-KE handshake can also be the first step in 1755 more advanced attacks. 1757 For the reasons described here, implementations SHOULD NOT revert 1758 from NTS-protected to unprotected NTP with any server without 1759 explicit user action. 1761 10. Privacy Considerations 1763 10.1. Unlinkability 1765 Unlinkability prevents a device from being tracked when it changes 1766 network addresses (e.g. because said device moved between different 1767 networks). In other words, unlinkability thwarts an attacker that 1768 seeks to link a new network address used by a device with a network 1769 address that it was formerly using, because of recognizable data that 1770 the device persistently sends as part of an NTS-secured NTP 1771 association. This is the justification for continually supplying the 1772 client with fresh cookies, so that a cookie never represents 1773 recognizable data in the sense outlined above. 1775 NTS's unlinkability objective is merely to not leak any additional 1776 data that could be used to link a device's network address. NTS does 1777 not rectify legacy linkability issues that are already present in 1778 NTP. Thus, a client that requires unlinkability must also minimize 1779 information transmitted in a client query (mode 3) packet as 1780 described in the draft [I-D.ietf-ntp-data-minimization]. 1782 The unlinkability objective only holds for time synchronization 1783 traffic, as opposed to key establishment traffic. This implies that 1784 it cannot be guaranteed for devices that function not only as time 1785 clients, but also as time servers (because the latter can be 1786 externally triggered to send linkable data, such as the TLS 1787 certificate). 1789 It should also be noted that it could be possible to link devices 1790 that operate as time servers from their time synchronization traffic, 1791 using information exposed in (mode 4) server response packets (e.g. 1793 reference ID, reference time, stratum, poll). Also, devices that 1794 respond to NTP control queries could be linked using the information 1795 revealed by control queries. 1797 Note that the unlinkability objective does not prevent a client 1798 device to be tracked by its time servers. 1800 10.2. Confidentiality 1802 NTS does not protect the confidentiality of information in NTP's 1803 header fields. When clients implement 1804 [I-D.ietf-ntp-data-minimization], client packet headers do not 1805 contain any information which the client could conceivably wish to 1806 keep secret: one field is random, and all others are fixed. 1807 Information in server packet headers is likewise public: the origin 1808 timestamp is copied from the client's (random) transmit timestamp, 1809 and all other fields are set the same regardless of the identity of 1810 the client making the request. 1812 Future extension fields could hypothetically contain sensitive 1813 information, in which case NTS provides a mechanism for encrypting 1814 them. 1816 11. Acknowledgements 1818 The authors would like to thank Richard Barnes, Steven Bellovin, 1819 Scott Fluhrer, Patrik Faeltstroem (Faltstrom), Sharon Goldberg, Russ 1820 Housley, Benjamin Kaduk, Suresh Krishnan, Mirja Kuehlewind 1821 (Kuehlewind), Martin Langer, Barry Leiba, Miroslav Lichvar, Aanchal 1822 Malhotra, Danny Mayer, Dave Mills, Sandra Murphy, Hal Murray, Karen 1823 O'Donoghue, Eric K. Rescorla, Kurt Roeckx, Stephen Roettger, Dan 1824 Romascanu, Kyle Rose, Rich Salz, Brian Sniffen, Susan Sons, Douglas 1825 Stebila, Harlan Stenn, Joachim Stroembergsson (Strombergsson), Martin 1826 Thomson, Eric (Eric) Vyncke, Richard Welty, Christer Weinigel, and 1827 Magnus Westerlund for contributions to this document and comments on 1828 the design of NTS. 1830 12. References 1832 12.1. Normative References 1834 [IANA-AEAD] 1835 IANA, "Authenticated Encryption with Associated Data 1836 (AEAD) Parameters", 1837 . 1839 [RFC0020] Cerf, V., "ASCII format for network interchange", STD 80, 1840 RFC 20, DOI 10.17487/RFC0020, October 1969, 1841 . 1843 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1844 Requirement Levels", BCP 14, RFC 2119, 1845 DOI 10.17487/RFC2119, March 1997, 1846 . 1848 [RFC4291] Hinden, R. and S. Deering, "IP Version 6 Addressing 1849 Architecture", RFC 4291, DOI 10.17487/RFC4291, February 1850 2006, . 1852 [RFC5116] McGrew, D., "An Interface and Algorithms for Authenticated 1853 Encryption", RFC 5116, DOI 10.17487/RFC5116, January 2008, 1854 . 1856 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 1857 Housley, R., and W. Polk, "Internet X.509 Public Key 1858 Infrastructure Certificate and Certificate Revocation List 1859 (CRL) Profile", RFC 5280, DOI 10.17487/RFC5280, May 2008, 1860 . 1862 [RFC5297] Harkins, D., "Synthetic Initialization Vector (SIV) 1863 Authenticated Encryption Using the Advanced Encryption 1864 Standard (AES)", RFC 5297, DOI 10.17487/RFC5297, October 1865 2008, . 1867 [RFC5705] Rescorla, E., "Keying Material Exporters for Transport 1868 Layer Security (TLS)", RFC 5705, DOI 10.17487/RFC5705, 1869 March 2010, . 1871 [RFC5869] Krawczyk, H. and P. Eronen, "HMAC-based Extract-and-Expand 1872 Key Derivation Function (HKDF)", RFC 5869, 1873 DOI 10.17487/RFC5869, May 2010, 1874 . 1876 [RFC5890] Klensin, J., "Internationalized Domain Names for 1877 Applications (IDNA): Definitions and Document Framework", 1878 RFC 5890, DOI 10.17487/RFC5890, August 2010, 1879 . 1881 [RFC5905] Mills, D., Martin, J., Ed., Burbank, J., and W. Kasch, 1882 "Network Time Protocol Version 4: Protocol and Algorithms 1883 Specification", RFC 5905, DOI 10.17487/RFC5905, June 2010, 1884 . 1886 [RFC6125] Saint-Andre, P. and J. Hodges, "Representation and 1887 Verification of Domain-Based Application Service Identity 1888 within Internet Public Key Infrastructure Using X.509 1889 (PKIX) Certificates in the Context of Transport Layer 1890 Security (TLS)", RFC 6125, DOI 10.17487/RFC6125, March 1891 2011, . 1893 [RFC6335] Cotton, M., Eggert, L., Touch, J., Westerlund, M., and S. 1894 Cheshire, "Internet Assigned Numbers Authority (IANA) 1895 Procedures for the Management of the Service Name and 1896 Transport Protocol Port Number Registry", BCP 165, 1897 RFC 6335, DOI 10.17487/RFC6335, August 2011, 1898 . 1900 [RFC6874] Carpenter, B., Cheshire, S., and R. Hinden, "Representing 1901 IPv6 Zone Identifiers in Address Literals and Uniform 1902 Resource Identifiers", RFC 6874, DOI 10.17487/RFC6874, 1903 February 2013, . 1905 [RFC7301] Friedl, S., Popov, A., Langley, A., and E. Stephan, 1906 "Transport Layer Security (TLS) Application-Layer Protocol 1907 Negotiation Extension", RFC 7301, DOI 10.17487/RFC7301, 1908 July 2014, . 1910 [RFC7525] Sheffer, Y., Holz, R., and P. Saint-Andre, 1911 "Recommendations for Secure Use of Transport Layer 1912 Security (TLS) and Datagram Transport Layer Security 1913 (DTLS)", BCP 195, RFC 7525, DOI 10.17487/RFC7525, May 1914 2015, . 1916 [RFC7822] Mizrahi, T. and D. Mayer, "Network Time Protocol Version 4 1917 (NTPv4) Extension Fields", RFC 7822, DOI 10.17487/RFC7822, 1918 March 2016, . 1920 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 1921 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 1922 May 2017, . 1924 [RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol 1925 Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, 1926 . 1928 12.2. Informative References 1930 [I-D.ietf-ntp-data-minimization] 1931 Franke, D. and A. Malhotra, "NTP Client Data 1932 Minimization", draft-ietf-ntp-data-minimization-04 (work 1933 in progress), March 2019. 1935 [Mizrahi] Mizrahi, T., "A game theoretic analysis of delay attacks 1936 against time synchronization protocols", in Proceedings 1937 of Precision Clock Synchronization for Measurement Control 1938 and Communication, ISPCS 2012, pp. 1-6, 1939 DOI 10.1109/ISPCS.2012.6336612, September 2012. 1941 [RFC4086] Eastlake 3rd, D., Schiller, J., and S. Crocker, 1942 "Randomness Requirements for Security", BCP 106, RFC 4086, 1943 DOI 10.17487/RFC4086, June 2005, 1944 . 1946 [RFC5077] Salowey, J., Zhou, H., Eronen, P., and H. Tschofenig, 1947 "Transport Layer Security (TLS) Session Resumption without 1948 Server-Side State", RFC 5077, DOI 10.17487/RFC5077, 1949 January 2008, . 1951 [RFC7384] Mizrahi, T., "Security Requirements of Time Protocols in 1952 Packet Switched Networks", RFC 7384, DOI 10.17487/RFC7384, 1953 October 2014, . 1955 [RFC8573] Malhotra, A. and S. Goldberg, "Message Authentication Code 1956 for the Network Time Protocol", RFC 8573, 1957 DOI 10.17487/RFC8573, June 2019, 1958 . 1960 [Shpiner] Shpiner, A., Revah, Y., and T. Mizrahi, "Multi-path Time 1961 Protocols", in Proceedings of IEEE International Symposium 1962 on Precision Clock Synchronization for Measurement, 1963 Control and Communication (ISPCS), 1964 DOI 10.1109/ISPCS.2013.6644754, September 2013. 1966 Appendix A. Terms and Abbreviations 1968 AEAD Authenticated Encryption with Associated Data [RFC5116] 1970 ALPN Application-Layer Protocol Negotiation [RFC7301] 1972 C2S Client-to-server 1974 DoS Denial-of-Service 1976 DDoS Distributed Denial-of-Service 1978 EF Extension Field [RFC5905] 1980 HKDF Hashed Message Authentication Code-based Key Derivation 1981 Function [RFC5869] 1983 KoD Kiss-o'-Death [RFC5905] 1985 NTP Network Time Protocol [RFC5905] 1987 NTS Network Time Security 1989 NTS NAK NTS negative-acknowledgment 1991 NTS-KE Network Time Security Key Establishment 1993 S2C Server-to-client 1995 TLS Transport Layer Security [RFC8446] 1997 Authors' Addresses 1999 Daniel Fox Franke 2000 Akamai Technologies 2001 145 Broadway 2002 Cambridge, MA 02142 2003 United States 2005 Email: dafranke@akamai.com 2007 Dieter Sibold 2008 Physikalisch-Technische 2009 Bundesanstalt 2010 Bundesallee 100 2011 Braunschweig D-38116 2012 Germany 2014 Phone: +49-(0)531-592-8420 2015 Fax: +49-531-592-698420 2016 Email: dieter.sibold@ptb.de 2018 Kristof Teichel 2019 Physikalisch-Technische 2020 Bundesanstalt 2021 Bundesallee 100 2022 Braunschweig D-38116 2023 Germany 2025 Phone: +49-(0)531-592-4471 2026 Email: kristof.teichel@ptb.de 2027 Marcus Dansarie 2028 Sweden 2030 Email: marcus@dansarie.se 2031 URI: https://orcid.org/0000-0001-9246-0263 2033 Ragnar Sundblad 2034 Netnod 2035 Sweden 2037 Email: ragge@netnod.se