idnits 2.17.00 (12 Aug 2021) /tmp/idnits15660/draft-ietf-quic-tls-14.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 : ---------------------------------------------------------------------------- ** The abstract seems to contain references ([2], [3], [1]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: o If the packet is from a previously installed encryption level, it MUST not contain data which extends past the end of previously received data in that flow. Implementations MUST treat any violations of this requirement as a connection error of type PROTOCOL_VIOLATION. -- The document date (August 15, 2018) is 1374 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. 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: '1' on line 1325 -- Looks like a reference, but probably isn't: '2' on line 1327 -- Looks like a reference, but probably isn't: '3' on line 1329 == Unused Reference: 'QUIC-HTTP' is defined on line 1308, but no explicit reference was found in the text -- Possible downref: Non-RFC (?) normative reference: ref. 'AES' ** Downref: Normative reference to an Informational RFC: RFC 8439 (ref. 'CHACHA') == Outdated reference: draft-ietf-quic-recovery has been published as RFC 9002 == Outdated reference: draft-ietf-quic-transport has been published as RFC 9000 -- Possible downref: Non-RFC (?) normative reference: ref. 'SHA' == Outdated reference: draft-ietf-tls-iana-registry-updates has been published as RFC 8447 == Outdated reference: A later version (-34) exists of draft-ietf-quic-http-14 Summary: 2 errors (**), 0 flaws (~~), 7 warnings (==), 7 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 QUIC M. Thomson, Ed. 3 Internet-Draft Mozilla 4 Intended status: Standards Track S. Turner, Ed. 5 Expires: February 16, 2019 sn3rd 6 August 15, 2018 8 Using Transport Layer Security (TLS) to Secure QUIC 9 draft-ietf-quic-tls-14 11 Abstract 13 This document describes how Transport Layer Security (TLS) is used to 14 secure QUIC. 16 Note to Readers 18 Discussion of this draft takes place on the QUIC working group 19 mailing list (quic@ietf.org), which is archived at 20 https://mailarchive.ietf.org/arch/search/?email_list=quic [1]. 22 Working Group information can be found at https://github.com/quicwg 23 [2]; source code and issues list for this draft can be found at 24 https://github.com/quicwg/base-drafts/labels/-tls [3]. 26 Status of This Memo 28 This Internet-Draft is submitted in full conformance with the 29 provisions of BCP 78 and BCP 79. 31 Internet-Drafts are working documents of the Internet Engineering 32 Task Force (IETF). Note that other groups may also distribute 33 working documents as Internet-Drafts. The list of current Internet- 34 Drafts is at https://datatracker.ietf.org/drafts/current/. 36 Internet-Drafts are draft documents valid for a maximum of six months 37 and may be updated, replaced, or obsoleted by other documents at any 38 time. It is inappropriate to use Internet-Drafts as reference 39 material or to cite them other than as "work in progress." 41 This Internet-Draft will expire on February 16, 2019. 43 Copyright Notice 45 Copyright (c) 2018 IETF Trust and the persons identified as the 46 document authors. All rights reserved. 48 This document is subject to BCP 78 and the IETF Trust's Legal 49 Provisions Relating to IETF Documents 50 (https://trustee.ietf.org/license-info) in effect on the date of 51 publication of this document. Please review these documents 52 carefully, as they describe your rights and restrictions with respect 53 to this document. Code Components extracted from this document must 54 include Simplified BSD License text as described in Section 4.e of 55 the Trust Legal Provisions and are provided without warranty as 56 described in the Simplified BSD License. 58 Table of Contents 60 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 61 2. Notational Conventions . . . . . . . . . . . . . . . . . . . 3 62 2.1. TLS Overview . . . . . . . . . . . . . . . . . . . . . . 4 63 3. Protocol Overview . . . . . . . . . . . . . . . . . . . . . . 6 64 4. Carrying TLS Messages . . . . . . . . . . . . . . . . . . . . 7 65 4.1. Interface to TLS . . . . . . . . . . . . . . . . . . . . 9 66 4.1.1. Sending and Receiving Handshake Messages . . . . . . 9 67 4.1.2. Encryption Level Changes . . . . . . . . . . . . . . 11 68 4.1.3. TLS Interface Summary . . . . . . . . . . . . . . . . 11 69 4.2. TLS Version . . . . . . . . . . . . . . . . . . . . . . . 12 70 4.3. ClientHello Size . . . . . . . . . . . . . . . . . . . . 13 71 4.4. Peer Authentication . . . . . . . . . . . . . . . . . . . 13 72 4.5. Enabling 0-RTT . . . . . . . . . . . . . . . . . . . . . 14 73 4.6. Rejecting 0-RTT . . . . . . . . . . . . . . . . . . . . . 14 74 4.7. HelloRetryRequest . . . . . . . . . . . . . . . . . . . . 14 75 4.8. TLS Errors . . . . . . . . . . . . . . . . . . . . . . . 15 76 4.9. Discarding Unused Keys . . . . . . . . . . . . . . . . . 15 77 5. QUIC Packet Protection . . . . . . . . . . . . . . . . . . . 16 78 5.1. QUIC Packet Encryption Keys . . . . . . . . . . . . . . . 16 79 5.1.1. Initial Secrets . . . . . . . . . . . . . . . . . . . 17 80 5.2. QUIC AEAD Usage . . . . . . . . . . . . . . . . . . . . . 17 81 5.3. Packet Number Protection . . . . . . . . . . . . . . . . 18 82 5.3.1. AES-Based Packet Number Protection . . . . . . . . . 20 83 5.3.2. ChaCha20-Based Packet Number Protection . . . . . . . 20 84 5.4. Receiving Protected Packets . . . . . . . . . . . . . . . 20 85 5.5. Use of 0-RTT Keys . . . . . . . . . . . . . . . . . . . . 21 86 5.6. Receiving Out-of-Order Protected Frames . . . . . . . . . 21 87 6. Key Update . . . . . . . . . . . . . . . . . . . . . . . . . 22 88 7. Security of Initial Messages . . . . . . . . . . . . . . . . 23 89 8. QUIC-Specific Additions to the TLS Handshake . . . . . . . . 24 90 8.1. Protocol and Version Negotiation . . . . . . . . . . . . 24 91 8.2. QUIC Transport Parameters Extension . . . . . . . . . . . 24 92 9. Security Considerations . . . . . . . . . . . . . . . . . . . 25 93 9.1. Packet Reflection Attack Mitigation . . . . . . . . . . . 25 94 9.2. Peer Denial of Service . . . . . . . . . . . . . . . . . 25 95 9.3. Packet Number Protection Analysis . . . . . . . . . . . . 26 97 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 27 98 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 27 99 11.1. Normative References . . . . . . . . . . . . . . . . . . 27 100 11.2. Informative References . . . . . . . . . . . . . . . . . 28 101 11.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 29 102 Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 29 103 A.1. Since draft-ietf-quic-tls-13 . . . . . . . . . . . . . . 29 104 A.2. Since draft-ietf-quic-tls-12 . . . . . . . . . . . . . . 29 105 A.3. Since draft-ietf-quic-tls-11 . . . . . . . . . . . . . . 30 106 A.4. Since draft-ietf-quic-tls-10 . . . . . . . . . . . . . . 30 107 A.5. Since draft-ietf-quic-tls-09 . . . . . . . . . . . . . . 30 108 A.6. Since draft-ietf-quic-tls-08 . . . . . . . . . . . . . . 30 109 A.7. Since draft-ietf-quic-tls-07 . . . . . . . . . . . . . . 30 110 A.8. Since draft-ietf-quic-tls-05 . . . . . . . . . . . . . . 30 111 A.9. Since draft-ietf-quic-tls-04 . . . . . . . . . . . . . . 30 112 A.10. Since draft-ietf-quic-tls-03 . . . . . . . . . . . . . . 30 113 A.11. Since draft-ietf-quic-tls-02 . . . . . . . . . . . . . . 30 114 A.12. Since draft-ietf-quic-tls-01 . . . . . . . . . . . . . . 30 115 A.13. Since draft-ietf-quic-tls-00 . . . . . . . . . . . . . . 31 116 A.14. Since draft-thomson-quic-tls-01 . . . . . . . . . . . . . 31 117 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 31 118 Contributors . . . . . . . . . . . . . . . . . . . . . . . . . . 31 119 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 32 121 1. Introduction 123 This document describes how QUIC [QUIC-TRANSPORT] is secured using 124 Transport Layer Security (TLS) version 1.3 [TLS13]. TLS 1.3 provides 125 critical latency improvements for connection establishment over 126 previous versions. Absent packet loss, most new connections can be 127 established and secured within a single round trip; on subsequent 128 connections between the same client and server, the client can often 129 send application data immediately, that is, using a zero round trip 130 setup. 132 This document describes how the standardized TLS 1.3 acts as a 133 security component of QUIC. 135 2. Notational Conventions 137 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 138 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 139 "OPTIONAL" in this document are to be interpreted as described in BCP 140 14 [RFC2119] [RFC8174] when, and only when, they appear in all 141 capitals, as shown here. 143 This document uses the terminology established in [QUIC-TRANSPORT]. 145 For brevity, the acronym TLS is used to refer to TLS 1.3. 147 2.1. TLS Overview 149 TLS provides two endpoints with a way to establish a means of 150 communication over an untrusted medium (that is, the Internet) that 151 ensures that messages they exchange cannot be observed, modified, or 152 forged. 154 Internally, TLS is a layered protocol, with the structure shown 155 below: 157 +--------------+--------------+--------------+ 158 | Handshake | Alerts | Application | 159 | Layer | | Data | 160 | | | | 161 +--------------+--------------+--------------+ 162 | | 163 | Record Layer | 164 | | 165 +--------------------------------------------+ 167 Each upper layer (handshake, alerts, and application data) is carried 168 as a series of typed TLS records. Records are individually 169 cryptographically protected and then transmitted over a reliable 170 transport (typically TCP) which provides sequencing and guaranteed 171 delivery. 173 The TLS authenticated key exchange occurs between two entities: 174 client and server. The client initiates the exchange and the server 175 responds. If the key exchange completes successfully, both client 176 and server will agree on a secret. TLS supports both pre-shared key 177 (PSK) and Diffie-Hellman (DH) key exchanges. PSK is the basis for 178 0-RTT; the latter provides perfect forward secrecy (PFS) when the DH 179 keys are destroyed. 181 After completing the TLS handshake, the client will have learned and 182 authenticated an identity for the server and the server is optionally 183 able to learn and authenticate an identity for the client. TLS 184 supports X.509 [RFC5280] certificate-based authentication for both 185 server and client. 187 The TLS key exchange is resistent to tampering by attackers and it 188 produces shared secrets that cannot be controlled by either 189 participating peer. 191 TLS 1.3 provides two basic handshake modes of interest to QUIC: 193 o A full 1-RTT handshake in which the client is able to send 194 application data after one round trip and the server immediately 195 responds after receiving the first handshake message from the 196 client. 198 o A 0-RTT handshake in which the client uses information it has 199 previously learned about the server to send application data 200 immediately. This application data can be replayed by an attacker 201 so it MUST NOT carry a self-contained trigger for any non- 202 idempotent action. 204 A simplified TLS 1.3 handshake with 0-RTT application data is shown 205 in Figure 1, see [TLS13] for more options and details. 207 Client Server 209 ClientHello 210 (0-RTT Application Data) --------> 211 ServerHello 212 {EncryptedExtensions} 213 {Finished} 214 <-------- [Application Data] 215 (EndOfEarlyData) 216 {Finished} --------> 218 [Application Data] <-------> [Application Data] 220 () Indicates messages protected by early data (0-RTT) keys 221 {} Indicates messages protected using handshake keys 222 [] Indicates messages protected using application data 223 (1-RTT) keys 225 Figure 1: TLS Handshake with 0-RTT 227 Data is protected using a number of encryption levels: 229 o Plaintext 231 o Early Data (0-RTT) Keys 233 o Handshake Keys 235 o Application Data (1-RTT) Keys 237 Application data may appear only in the early data and application 238 data levels. Handshake and Alert messages may appear in any level. 240 The 0-RTT handshake is only possible if the client and server have 241 previously communicated. In the 1-RTT handshake, the client is 242 unable to send protected application data until it has received all 243 of the handshake messages sent by the server. 245 3. Protocol Overview 247 QUIC [QUIC-TRANSPORT] assumes responsibility for the confidentiality 248 and integrity protection of packets. For this it uses keys derived 249 from a TLS 1.3 handshake [TLS13], but instead of carrying TLS records 250 over QUIC (as with TCP), TLS Handshake and Alert messages are carried 251 directly over the QUIC transport, which takes over the 252 responsibilities of the TLS record layer, as shown below. 254 +--------------+--------------+ +-------------+ 255 | TLS | TLS | | QUIC | 256 | Handshake | Alerts | | Applications| 257 | | | | (h2q, etc.) | 258 +--------------+--------------+-+-------------+ 259 | | 260 | QUIC Transport | 261 | (streams, reliability, congestion, etc.) | 262 | | 263 +---------------------------------------------+ 264 | | 265 | QUIC Packet Protection | 266 | | 267 +---------------------------------------------+ 269 QUIC also relies on TLS 1.3 for authentication and negotiation of 270 parameters that are critical to security and performance. 272 Rather than a strict layering, these two protocols are co-dependent: 273 QUIC uses the TLS handshake; TLS uses the reliability and ordered 274 delivery provided by QUIC streams. 276 At a high level, there are two main interactions between the TLS and 277 QUIC components: 279 o The TLS component sends and receives messages via the QUIC 280 component, with QUIC providing a reliable stream abstraction to 281 TLS. 283 o The TLS component provides a series of updates to the QUIC 284 component, including (a) new packet protection keys to install (b) 285 state changes such as handshake completion, the server 286 certificate, etc. 288 Figure 2 shows these interactions in more detail, with the QUIC 289 packet protection being called out specially. 291 +------------+ +------------+ 292 | |<- Handshake Messages ->| | 293 | |<---- 0-RTT Keys -------| | 294 | |<--- Handshake Keys-----| | 295 | QUIC |<---- 1-RTT Keys -------| TLS | 296 | |<--- Handshake Done ----| | 297 +------------+ +------------+ 298 | ^ 299 | Protect | Protected 300 v | Packet 301 +------------+ 302 | QUIC | 303 | Packet | 304 | Protection | 305 +------------+ 307 Figure 2: QUIC and TLS Interactions 309 Unlike TLS over TCP, QUIC applications which want to send data do not 310 send it through TLS "application_data" records. Rather, they send it 311 as QUIC STREAM frames which are then carried in QUIC packets. 313 4. Carrying TLS Messages 315 QUIC carries TLS handshake data in CRYPTO frames, each of which 316 consists of a contiguous block of handshake data identified by an 317 offset and length. Those frames are packaged into QUIC packets and 318 encrypted under the current TLS encryption level. As with TLS over 319 TCP, once TLS handshake data has been delivered to QUIC, it is QUIC's 320 responsibility to deliver it reliably. Each chunk of data that is 321 produced by TLS is associated with the set of keys that TLS is 322 currently using. If QUIC needs to retransmit that data, it MUST use 323 the same keys even if TLS has already updated to newer keys. 325 One important difference between TLS 1.3 records (used with TCP) and 326 QUIC CRYPTO frames is that in QUIC multiple frames may appear in the 327 same QUIC packet as long as they are associated with the same 328 encryption level. For instance, an implementation might bundle a 329 Handshake message and an ACK for some Handshake data into the same 330 packet. 332 Each encryption level has a specific list of frames which may appear 333 in it. The rules here generalize those of TLS, in that frames 334 associated with establishing the connection can usually appear at any 335 encryption level, whereas those associated with transferring data can 336 only appear in the 0-RTT and 1-RTT encryption levels 338 o CRYPTO frames MAY appear in packets of any encryption level. 340 o CONNECTION_CLOSE MAY appear in packets of any encryption level 341 other than 0-RTT. 343 o PADDING and PING frames MAY appear in packets of any encryption 344 level. 346 o ACK frames MAY appear in packets of any encryption level other 347 than 0-RTT, but can only acknowledge packets which appeared in 348 that encryption level. 350 o STREAM frames MUST ONLY appear in the 0-RTT and 1-RTT levels. 352 o All other frame types MUST only appear at the 1-RTT levels. 354 Because packets could be reordered on the wire, QUIC uses the packet 355 type to indicate which level a given packet was encrypted under, as 356 shown in Table 1. When multiple packets of different encryption 357 levels need to be sent, endpoints SHOULD use coalesced packets to 358 send them in the same UDP datagram. 360 +-----------------+------------------+-----------+ 361 | Packet Type | Encryption Level | PN Space | 362 +-----------------+------------------+-----------+ 363 | Initial | Initial secrets | Initial | 364 | | | | 365 | 0-RTT Protected | 0-RTT | 0/1-RTT | 366 | | | | 367 | Handshake | Handshake | Handshake | 368 | | | | 369 | Retry | N/A | N/A | 370 | | | | 371 | Short Header | 1-RTT | 0/1-RTT | 372 +-----------------+------------------+-----------+ 374 Table 1: Encryption Levels by Packet Type 376 Section 6.5 of [QUIC-TRANSPORT] shows how packets at the various 377 encryption levels fit into the handshake process. 379 4.1. Interface to TLS 381 As shown in Figure 2, the interface from QUIC to TLS consists of 382 three primary functions: 384 o Sending and receiving handshake messages 386 o Rekeying (both transmit and receive) 388 o Handshake state updates 390 Additional functions might be needed to configure TLS. 392 4.1.1. Sending and Receiving Handshake Messages 394 In order to drive the handshake, TLS depends on being able to send 395 and receive handshake messages. There are two basic functions on 396 this interface: one where QUIC requests handshake messages and one 397 where QUIC provides handshake packets. 399 Before starting the handshake QUIC provides TLS with the transport 400 parameters (see Section 8.2) that it wishes to carry. 402 A QUIC client starts TLS by requesting TLS handshake octets from TLS. 403 The client acquires handshake octets before sending its first packet. 404 A QUIC server starts the process by providing TLS with the client's 405 handshake octets. 407 At any given time, the TLS stack at an endpoint will have a current 408 sending encryption level and receiving encryption level. Each 409 encryption level is associated with a different flow of bytes, which 410 is reliably transmitted to the peer in CRYPTO frames. When TLS 411 provides handshake octets to be sent, they are appended to the 412 current flow and any packet that includes the CRYPTO frame is 413 protected using keys from the corresponding encryption level. 415 When an endpoint receives a QUIC packet containing a CRYPTO frame 416 from the network, it proceeds as follows: 418 o If the packet was in the TLS receiving encryption level, sequence 419 the data into the input flow as usual. As with STREAM frames, the 420 offset is used to find the proper location in the data sequence. 421 If the result of this process is that new data is available, then 422 it is delivered to TLS in order. 424 o If the packet is from a previously installed encryption level, it 425 MUST not contain data which extends past the end of previously 426 received data in that flow. Implementations MUST treat any 427 violations of this requirement as a connection error of type 428 PROTOCOL_VIOLATION. 430 o If the packet is from a new encryption level, it is saved for 431 later processing by TLS. Once TLS moves to receiving from this 432 encryption level, saved data can be provided. When providing data 433 from any new encryption level to TLS, if there is data from a 434 previous encryption level that TLS has not consumed, this MUST be 435 treated as a connection error of type PROTOCOL_VIOLATION. 437 Each time that TLS is provided with new data, new handshake octets 438 are requested from TLS. TLS might not provide any octets if the 439 handshake messages it has received are incomplete or it has no data 440 to send. 442 Once the TLS handshake is complete, this is indicated to QUIC along 443 with any final handshake octets that TLS needs to send. TLS also 444 provides QUIC with the transport parameters that the peer advertised 445 during the handshake. 447 Once the handshake is complete, TLS becomes passive. TLS can still 448 receive data from its peer and respond in kind, but it will not need 449 to send more data unless specifically requested - either by an 450 application or QUIC. One reason to send data is that the server 451 might wish to provide additional or updated session tickets to a 452 client. 454 When the handshake is complete, QUIC only needs to provide TLS with 455 any data that arrives in CRYPTO streams. In the same way that is 456 done during the handshake, new data is requested from TLS after 457 providing received data. 459 Important: Until the handshake is reported as complete, the 460 connection and key exchange are not properly authenticated at the 461 server. Even though 1-RTT keys are available to a server after 462 receiving the first handshake messages from a client, the server 463 cannot consider the client to be authenticated until it receives 464 and validates the client's Finished message. 466 The requirement for the server to wait for the client Finished 467 message creates a dependency on that message being delivered. A 468 client can avoid the potential for head-of-line blocking that this 469 implies by sending a copy of the CRYPTO frame that carries the 470 Finished message in multiple packets. This enables immediate 471 server processing for those packets. 473 4.1.2. Encryption Level Changes 475 As keys for new encryption levels become available, TLS provides QUIC 476 with those keys. Separately, as TLS starts using keys at a given 477 encryption level, TLS indicates to QUIC that it is now reading or 478 writing with keys at that encryption level. These events are not 479 asynchronous; they always occur immediately after TLS is provided 480 with new handshake octets, or after TLS produces handshake octets. 482 If 0-RTT is possible, it is ready after the client sends a TLS 483 ClientHello message or the server receives that message. After 484 providing a QUIC client with the first handshake octets, the TLS 485 stack might signal the change to 0-RTT keys. On the server, after 486 receiving handshake octets that contain a ClientHello message, a TLS 487 server might signal that 0-RTT keys are available. 489 Although TLS only uses one encryption level at a time, QUIC may use 490 more than one level. For instance, after sending its Finished 491 message (using a CRYPTO frame at the Handshake encryption level) an 492 endpoint can send STREAM data (in 1-RTT encryption). If the Finished 493 message is lost, the endpoint uses the Handshake encryption level to 494 retransmit the lost message. Reordering or loss of packets can mean 495 that QUIC will need to handle packets at multiple encryption levels. 496 During the handshake, this means potentially handling packets at 497 higher and lower encryption levels than the current encryption level 498 used by TLS. 500 In particular, server implementations need to be able to read packets 501 at the Handshake encryption level before the final TLS handshake 502 message at the 0-RTT encryption level (EndOfEarlyData) is available. 503 Though the content of CRYPTO frames at the Handshake encryption level 504 cannot be forwarded to TLS before EndOfEarlyData is processed, the 505 client could send ACK frames that the server needs to process in 506 order to detect lost Handshake packets. 508 4.1.3. TLS Interface Summary 510 Figure 3 summarizes the exchange between QUIC and TLS for both client 511 and server. Each arrow is tagged with the encryption level used for 512 that transmission. 514 Client Server 516 Get Handshake 517 Initial -------------> 518 Rekey tx to 0-RTT Keys 519 0-RTT ---------------> 520 Handshake Received 521 Get Handshake 522 <------------- Initial 523 Rekey rx to 0-RTT keys 524 Handshake Received 525 Rekey rx to Handshake keys 526 Get Handshake 527 <----------- Handshake 528 Rekey tx to 1-RTT keys 529 <--------------- 1-RTT 530 Handshake Received 531 Rekey rx to Handshake keys 532 Handshake Received 533 Get Handshake 534 Handshake Complete 535 Handshake -----------> 536 Rekey tx to 1-RTT keys 537 1-RTT ---------------> 538 Handshake Received 539 Rekey rx to 1-RTT keys 540 Get Handshake 541 Handshake Complete 542 <--------------- 1-RTT 543 Handshake Received 545 Figure 3: Interaction Summary between QUIC and TLS 547 4.2. TLS Version 549 This document describes how TLS 1.3 [TLS13] is used with QUIC. 551 In practice, the TLS handshake will negotiate a version of TLS to 552 use. This could result in a newer version of TLS than 1.3 being 553 negotiated if both endpoints support that version. This is 554 acceptable provided that the features of TLS 1.3 that are used by 555 QUIC are supported by the newer version. 557 A badly configured TLS implementation could negotiate TLS 1.2 or 558 another older version of TLS. An endpoint MUST terminate the 559 connection if a version of TLS older than 1.3 is negotiated. 561 4.3. ClientHello Size 563 QUIC requires that the first Initial packet from a client contain an 564 entire crytographic handshake message, which for TLS is the 565 ClientHello. Though a packet larger than 1200 octets might be 566 supported by the path, a client improves the likelihood that a packet 567 is accepted if it ensures that the first ClientHello message is small 568 enough to stay within this limit. 570 QUIC packet and framing add at least 36 octets of overhead to the 571 ClientHello message. That overhead increases if the client chooses a 572 connection ID without zero length. Overheads also do not include the 573 token or a connection ID longer than 8 octets, both of which might be 574 required if a server sends a Retry packet. 576 A typical TLS ClientHello can easily fit into a 1200 octet packet. 577 However, in addition to the overheads added by QUIC, there are 578 several variables that could cause this limit to be exceeded. Large 579 session tickets, multiple or large key shares, and long lists of 580 supported ciphers, signature algorithms, versions, QUIC transport 581 parameters, and other negotiable parameters and extensions could 582 cause this message to grow. 584 For servers, in addition to connection ID and tokens, the size of TLS 585 session tickets can have an effect on a client's ability to connect. 586 Minimizing the size of these values increases the probability that 587 they can be successfully used by a client. 589 A client is not required to fit the ClientHello that it sends in 590 response to a HelloRetryRequest message into a single UDP datagram. 592 The TLS implementation does not need to ensure that the ClientHello 593 is sufficiently large. QUIC PADDING frames are added to increase the 594 size of the packet as necessary. 596 4.4. Peer Authentication 598 The requirements for authentication depend on the application 599 protocol that is in use. TLS provides server authentication and 600 permits the server to request client authentication. 602 A client MUST authenticate the identity of the server. This 603 typically involves verification that the identity of the server is 604 included in a certificate and that the certificate is issued by a 605 trusted entity (see for example [RFC2818]). 607 A server MAY request that the client authenticate during the 608 handshake. A server MAY refuse a connection if the client is unable 609 to authenticate when requested. The requirements for client 610 authentication vary based on application protocol and deployment. 612 A server MUST NOT use post-handshake client authentication (see 613 Section 4.6.2 of [TLS13]). 615 4.5. Enabling 0-RTT 617 In order to be usable for 0-RTT, TLS MUST provide a NewSessionTicket 618 message that contains the "max_early_data" extension with the value 619 0xffffffff; the amount of data which the client can send in 0-RTT is 620 controlled by the "initial_max_data" transport parameter supplied by 621 the server. A client MUST treat receipt of a NewSessionTicket that 622 contains a "max_early_data" extension with any other value as a 623 connection error of type PROTOCOL_VIOLATION. 625 Early data within the TLS connection MUST NOT be used. As it is for 626 other TLS application data, a server MUST treat receiving early data 627 on the TLS connection as a connection error of type 628 PROTOCOL_VIOLATION. 630 4.6. Rejecting 0-RTT 632 A server rejects 0-RTT by rejecting 0-RTT at the TLS layer. This 633 also prevents QUIC from sending 0-RTT data. A server will always 634 reject 0-RTT if it sends a TLS HelloRetryRequest. 636 When 0-RTT is rejected, all connection characteristics that the 637 client assumed might be incorrect. This includes the choice of 638 application protocol, transport parameters, and any application 639 configuration. The client therefore MUST reset the state of all 640 streams, including application state bound to those streams. 642 A client MAY attempt to send 0-RTT again if it receives a Retry or 643 Version Negotiation packet. These packets do not signify rejection 644 of 0-RTT. 646 4.7. HelloRetryRequest 648 In TLS over TCP, the HelloRetryRequest feature (see Section 4.1.4 of 649 [TLS13]) can be used to correct a client's incorrect KeyShare 650 extension as well as for a stateless round-trip check. From the 651 perspective of QUIC, this just looks like additional messages carried 652 in the Initial encryption level. Although it is in principle 653 possible to use this feature for address verification in QUIC, QUIC 654 implementations SHOULD instead use the Retry feature (see Section 4.4 655 of [QUIC-TRANSPORT]). HelloRetryRequest is still used to request key 656 shares. 658 4.8. TLS Errors 660 If TLS experiences an error, it generates an appropriate alert as 661 defined in Section 6 of [TLS13]. 663 A TLS alert is turned into a QUIC connection error by converting the 664 one-octet alert description into a QUIC error code. The alert 665 description is added to 0x100 to produce a QUIC error code from the 666 range reserved for CRYPTO_ERROR. The resulting value is sent in a 667 QUIC CONNECTION_CLOSE frame. 669 The alert level of all TLS alerts is "fatal"; a TLS stack MUST NOT 670 generate alerts at the "warning" level. 672 4.9. Discarding Unused Keys 674 After QUIC moves to a new encryption level, packet protection keys 675 for previous encryption levels can be discarded. This occurs several 676 times during the handshake, as well as when keys are updated (see 677 Section 6). 679 Packet protection keys are not discarded immediately when new keys 680 are availble. If packets from a lower encryption level contain 681 CRYPTO frames, frames that retransmit that data MUST be sent at the 682 same encryption level. Similarly, an endpoint generates 683 acknowledgements for packets at the same encryption level as the 684 packet being acknowledged. Thus, it is possible that keys for a 685 lower encryption level are needed for a short time after keys for a 686 newer encryption level are available. 688 An endpoint cannot discard keys for a given encryption level unless 689 it has both received and acknowledged all CRYPTO frames for that 690 encryption level and when all CRYPTO frames for that encryption level 691 have been acknowledged by its peer. However, this does not guarantee 692 that no further packets will need to be received or sent at that 693 encryption level because a peer might not have received all the 694 acknowledgements necessary to reach the same state. 696 After all CRYPTO frames for a given encryption level have been sent 697 and all expected CRYPTO frames received, and all the corresponding 698 acknowledgments have been received or sent, an endpoint starts a 699 timer. To limit the effect of packet loss around a change in keys, 700 endpoints MUST retain packet protection keys for that encryption 701 level for at least three times the current Retramsmission Timeout 702 (RTO) interval as defined in [QUIC-RECOVERY]. Retaining keys for 703 this interval allows packets containing CRYPTO or ACK frames at that 704 encryption level to be sent if packets are determined to be lost or 705 new packets require acknowledgment. 707 Though an endpoint might retain older keys, new data MUST be sent at 708 the highest currently-available encryption level. Only ACK frames 709 and retransmissions of data in CRYPTO frames are sent at a previous 710 encryption level. These packets MAY also include PADDING frames. 712 Once this timer expires, an endpoint MUST NOT either accept or 713 generate new packets using those packet protection keys. An endpoint 714 can discard packet protection keys for that encryption level. 716 Key updates (see Section 6) can be used to update 1-RTT keys before 717 keys from other encryption levels are discarded. In that case, 718 packets protected with the newest packet protection keys and packets 719 sent two updates prior will appear to use the same keys. After the 720 handshake is complete, endpoints only need to maintain the two latest 721 sets of packet protection keys and MAY discard older keys. Updating 722 keys multiple times rapidly can cause packets to be effectively lost 723 if packets are significantly delayed. Because key updates can only 724 be performed once per round trip time, only packets that are delayed 725 by more than a round trip will be lost as a result of changing keys; 726 such packets will be marked as lost before this, as they leave a gap 727 in the sequence of packet numbers. 729 5. QUIC Packet Protection 731 As with TLS over TCP, QUIC encrypts packets with keys derived from 732 the TLS handshake, using the AEAD algorithm negotiated by TLS. 734 5.1. QUIC Packet Encryption Keys 736 QUIC derives packet encryption keys in the same way as TLS 1.3: Each 737 encryption level/direction pair has a secret value, which is then 738 used to derive the traffic keys using as described in Section 7.3 of 739 [TLS13] 741 The keys for the Initial encryption level are computed based on the 742 client's initial Destination Connection ID, as described in 743 Section 5.1.1. 745 The keys for other encryption levels are computed in the same fashion 746 as the corresponding TLS keys (see Section 7 of [TLS13]), except that 747 the label for HKDF-Expand-Label uses the prefix "quic " rather than 748 "tls13 ". A different label provides key separation between TLS and 749 QUIC. 751 5.1.1. Initial Secrets 753 Initial packets are protected with a secret derived from the 754 Destination Connection ID field from the client's first Initial 755 packet of the connection. Specifically: 757 initial_salt = 0x9c108f98520a5c5c32968e950e8a2c5fe06d6c38 758 initial_secret = HKDF-Extract(initial_salt, 759 client_dst_connection_id) 761 client_initial_secret = HKDF-Expand-Label(initial_secret, 762 "client in", "", 763 Hash.length) 764 server_initial_secret = HKDF-Expand-Label(initial_secret, 765 "server in", "", 766 Hash.length) 768 Note that if the server sends a Retry, the client's Initial will 769 correspond to a new connection and thus use the server provided 770 Destination Connection ID. 772 The hash function for HKDF when deriving initial secrets and keys is 773 SHA-256 [SHA]. The connection ID used with HKDF-Expand-Label is the 774 initial Destination Connection ID. 776 The value of initial_salt is a 20 octet sequence shown in the figure 777 in hexadecimal notation. Future versions of QUIC SHOULD generate a 778 new salt value, thus ensuring that the keys are different for each 779 version of QUIC. This prevents a middlebox that only recognizes one 780 version of QUIC from seeing or modifying the contents of handshake 781 packets from future versions. 783 Note: The Destination Connection ID is of arbitrary length, and it 784 could be zero length if the server sends a Retry packet with a 785 zero-length Source Connection ID field. In this case, the Initial 786 keys provide no assurance to the client that the server received 787 its packet; the client has to rely on the exchange that included 788 the Retry packet for that property. 790 5.2. QUIC AEAD Usage 792 The Authentication Encryption with Associated Data (AEAD) [AEAD] 793 function used for QUIC packet protection is the AEAD that is 794 negotiated for use with the TLS connection. For example, if TLS is 795 using the TLS_AES_128_GCM_SHA256, the AEAD_AES_128_GCM function is 796 used. 798 QUIC packets are protected prior to applying packet number encryption 799 (Section 5.3). The unprotected packet number is part of the 800 associated data (A). When removing packet protection, an endpoint 801 first removes the protection from the packet number. 803 All QUIC packets other than Version Negotiation and Retry packets are 804 protected with an AEAD algorithm [AEAD]. Prior to establishing a 805 shared secret, packets are protected with AEAD_AES_128_GCM and a key 806 derived from the destination connection ID in the client's first 807 Initial packet (see Section 5.1.1). This provides protection against 808 off-path attackers and robustness against QUIC version unaware 809 middleboxes, but not against on-path attackers. 811 All ciphersuites currently defined for TLS 1.3 - and therefore QUIC - 812 have a 16-byte authentication tag and produce an output 16 bytes 813 larger than their input. 815 The key and IV for the packet are computed as described in 816 Section 5.1. The nonce, N, is formed by combining the packet 817 protection IV with the packet number. The 64 bits of the 818 reconstructed QUIC packet number in network byte order are left- 819 padded with zeros to the size of the IV. The exclusive OR of the 820 padded packet number and the IV forms the AEAD nonce. 822 The associated data, A, for the AEAD is the contents of the QUIC 823 header, starting from the flags octet in either the short or long 824 header, up to and including the unprotected packet number. 826 The input plaintext, P, for the AEAD is the content of the QUIC frame 827 following the header, as described in [QUIC-TRANSPORT]. 829 The output ciphertext, C, of the AEAD is transmitted in place of P. 831 Some AEAD functions have limits for how many packets can be encrypted 832 under the same key and IV (see for example [AEBounds]). This might 833 be lower than the packet number limit. An endpoint MUST initiate a 834 key update (Section 6) prior to exceeding any limit set for the AEAD 835 that is in use. 837 5.3. Packet Number Protection 839 QUIC packet numbers are protected using a key that is derived from 840 the current set of secrets. The key derived using the "pn" label is 841 used to protect the packet number from casual observation. The 842 packet number protection algorithm depends on the negotiated AEAD. 844 Packet number protection is applied after packet protection is 845 applied (see Section 5.2). The ciphertext of the packet is sampled 846 and used as input to an encryption algorithm. 848 In sampling the packet ciphertext, the packet number length is 849 assumed to be 4 octets (its maximum possible encoded length), unless 850 there is insufficient space in the packet for sampling. The sampled 851 ciphertext starts after allowing for a 4 octet packet number unless 852 this would cause the sample to extend past the end of the packet. If 853 the sample would extend past the end of the packet, the end of the 854 packet is sampled. 856 For example, the sampled ciphertext for a packet with a short header 857 can be determined by: 859 sample_offset = 1 + len(connection_id) + 4 861 if sample_offset + sample_length > packet_length then 862 sample_offset = packet_length - sample_length 863 sample = packet[sample_offset..sample_offset+sample_length] 865 A packet with a long header is sampled in the same way, noting that 866 multiple QUIC packets might be included in the same UDP datagram and 867 that each one is handled separately. 869 sample_offset = 6 + len(destination_connection_id) + 870 len(source_connection_id) + 871 len(payload_length) + 4 872 if packet_type == Initial: 873 sample_offset += len(token_length) + 874 len(token) 876 To ensure that this process does not sample the packet number, packet 877 number protection algorithms MUST NOT sample more ciphertext than the 878 minimum expansion of the corresponding AEAD. 880 Packet number protection is applied to the packet number encoded as 881 described in Section 4.11 of [QUIC-TRANSPORT]. Since the length of 882 the packet number is stored in the first octet of the encoded packet 883 number, it may be necessary to progressively decrypt the packet 884 number. 886 Before a TLS ciphersuite can be used with QUIC, a packet protection 887 algorithm MUST be specifed for the AEAD used with that ciphersuite. 888 This document defines algorithms for AEAD_AES_128_GCM, 889 AEAD_AES_128_CCM, AEAD_AES_256_GCM, AEAD_AES_256_CCM (all AES AEADs 890 are defined in [AEAD]), and AEAD_CHACHA20_POLY1305 ([CHACHA]). 892 5.3.1. AES-Based Packet Number Protection 894 This section defines the packet protection algorithm for 895 AEAD_AES_128_GCM, AEAD_AES_128_CCM, AEAD_AES_256_GCM, and 896 AEAD_AES_256_CCM. AEAD_AES_128_GCM and AEAD_AES_128_CCM use 128-bit 897 AES [AES] in counter (CTR) mode. AEAD_AES_256_GCM, and 898 AEAD_AES_256_CCM use 256-bit AES in CTR mode. 900 This algorithm samples 16 octets from the packet ciphertext. This 901 value is used as the counter input to AES-CTR. 903 encrypted_pn = AES-CTR(pn_key, sample, packet_number) 905 5.3.2. ChaCha20-Based Packet Number Protection 907 When AEAD_CHACHA20_POLY1305 is in use, packet number protection uses 908 the raw ChaCha20 function as defined in Section 2.4 of [CHACHA]. 909 This uses a 256-bit key and 16 octets sampled from the packet 910 protection output. 912 The first 4 octets of the sampled ciphertext are interpreted as a 913 32-bit number in little-endian order and are used as the block count. 914 The remaining 12 octets are interpreted as three concatenated 32-bit 915 numbers in little-endian order and used as the nonce. 917 The encoded packet number is then encrypted with ChaCha20 directly. 918 In pseudocode: 920 counter = DecodeLE(sample[0..3]) 921 nonce = DecodeLE(sample[4..7], sample[8..11], sample[12..15]) 922 encrypted_pn = ChaCha20(pn_key, counter, nonce, packet_number) 924 5.4. Receiving Protected Packets 926 Once an endpoint successfully receives a packet with a given packet 927 number, it MUST discard all packets in the same packet number space 928 with higher packet numbers if they cannot be successfully unprotected 929 with either the same key, or - if there is a key update - the next 930 packet protection key (see Section 6). Similarly, a packet that 931 appears to trigger a key update, but cannot be unprotected 932 successfully MUST be discarded. 934 Failure to unprotect a packet does not necessarily indicate the 935 existence of a protocol error in a peer or an attack. The truncated 936 packet number encoding used in QUIC can cause packet numbers to be 937 decoded incorrectly if they are delayed significantly. 939 5.5. Use of 0-RTT Keys 941 If 0-RTT keys are available (see Section 4.5), the lack of replay 942 protection means that restrictions on their use are necessary to 943 avoid replay attacks on the protocol. 945 A client MUST only use 0-RTT keys to protect data that is idempotent. 946 A client MAY wish to apply additional restrictions on what data it 947 sends prior to the completion of the TLS handshake. A client 948 otherwise treats 0-RTT keys as equivalent to 1-RTT keys, except that 949 it MUST NOT send ACKs with 0-RTT keys. 951 A client that receives an indication that its 0-RTT data has been 952 accepted by a server can send 0-RTT data until it receives all of the 953 server's handshake messages. A client SHOULD stop sending 0-RTT data 954 if it receives an indication that 0-RTT data has been rejected. 956 A server MUST NOT use 0-RTT keys to protect packets; it uses 1-RTT 957 keys to protect acknowledgements of 0-RTT packets. Clients MUST NOT 958 attempt to decrypt 0-RTT packets it receives and instead MUST discard 959 them. 961 Note: 0-RTT data can be acknowledged by the server as it receives 962 it, but any packets containing acknowledgments of 0-RTT data 963 cannot have packet protection removed by the client until the TLS 964 handshake is complete. The 1-RTT keys necessary to remove packet 965 protection cannot be derived until the client receives all server 966 handshake messages. 968 5.6. Receiving Out-of-Order Protected Frames 970 Due to reordering and loss, protected packets might be received by an 971 endpoint before the final TLS handshake messages are received. A 972 client will be unable to decrypt 1-RTT packets from the server, 973 whereas a server will be able to decrypt 1-RTT packets from the 974 client. 976 However, a server MUST NOT process data from incoming 1-RTT protected 977 packets before verifying either the client Finished message or - in 978 the case that the server has chosen to use a pre-shared key - the 979 pre-shared key binder (see Section 4.2.11 of [TLS13]). Verifying 980 these values provides the server with an assurance that the 981 ClientHello has not been modified. Packets protected with 1-RTT keys 982 MAY be stored and later decrypted and used once the handshake is 983 complete. 985 A server could receive packets protected with 0-RTT keys prior to 986 receiving a TLS ClientHello. The server MAY retain these packets for 987 later decryption in anticipation of receiving a ClientHello. 989 6. Key Update 991 Once the 1-RTT keys are established and the short header is in use, 992 it is possible to update the keys. The KEY_PHASE bit in the short 993 header is used to indicate whether key updates have occurred. The 994 KEY_PHASE bit is initially set to 0 and then inverted with each key 995 update Section 6. 997 The KEY_PHASE bit allows a recipient to detect a change in keying 998 material without necessarily needing to receive the first packet that 999 triggered the change. An endpoint that notices a changed KEY_PHASE 1000 bit can update keys and decrypt the packet that contains the changed 1001 bit, see Section 6. 1003 An endpoint MUST NOT initiate more than one key update at a time. A 1004 new key cannot be used until the endpoint has received and 1005 successfully decrypted a packet with a matching KEY_PHASE. 1007 A receiving endpoint detects an update when the KEY_PHASE bit doesn't 1008 match what it is expecting. It creates a new secret (see Section 7.2 1009 of [TLS13]) and the corresponding read key and IV. If the packet can 1010 be decrypted and authenticated using these values, then the keys it 1011 uses for packet protection are also updated. The next packet sent by 1012 the endpoint will then use the new keys. 1014 An endpoint doesn't need to send packets immediately when it detects 1015 that its peer has updated keys. The next packet that it sends will 1016 simply use the new keys. If an endpoint detects a second update 1017 before it has sent any packets with updated keys it indicates that 1018 its peer has updated keys twice without awaiting a reciprocal update. 1019 An endpoint MUST treat consecutive key updates as a fatal error and 1020 abort the connection. 1022 An endpoint SHOULD retain old keys for a short period to allow it to 1023 decrypt packets with smaller packet numbers than the packet that 1024 triggered the key update. This allows an endpoint to consume packets 1025 that are reordered around the transition between keys. Packets with 1026 higher packet numbers always use the updated keys and MUST NOT be 1027 decrypted with old keys. 1029 Keys and their corresponding secrets SHOULD be discarded when an 1030 endpoint has received all packets with packet numbers lower than the 1031 lowest packet number used for the new key. An endpoint might discard 1032 keys if it determines that the length of the delay to affected 1033 packets is excessive. 1035 This ensures that once the handshake is complete, packets with the 1036 same KEY_PHASE will have the same packet protection keys, unless 1037 there are multiple key updates in a short time frame succession and 1038 significant packet reordering. 1040 Initiating Peer Responding Peer 1042 @M QUIC Frames 1043 New Keys -> @N 1044 @N QUIC Frames 1045 --------> 1046 QUIC Frames @M 1047 New Keys -> @N 1048 QUIC Frames @N 1049 <-------- 1051 Figure 4: Key Update 1053 A packet that triggers a key update could arrive after successfully 1054 processing a packet with a higher packet number. This is only 1055 possible if there is a key compromise and an attack, or if the peer 1056 is incorrectly reverting to use of old keys. Because the latter 1057 cannot be differentiated from an attack, an endpoint MUST immediately 1058 terminate the connection if it detects this condition. 1060 7. Security of Initial Messages 1062 Initial packets are not protected with a secret key, so they are 1063 subject to potential tampering by an attacker. QUIC provides 1064 protection against attackers that cannot read packets, but does not 1065 attempt to provide additional protection against attacks where the 1066 attacker can observe and inject packets. Some forms of tampering - 1067 such as modifying the TLS messages themselves - are detectable, but 1068 some - such as modifying ACKs - are not. 1070 For example, an attacker could inject a packet containing an ACK 1071 frame that makes it appear that a packet had not been received or to 1072 create a false impression of the state of the connection (e.g., by 1073 modifying the ACK Delay). Note that such a packet could cause a 1074 legitimate packet to be dropped as a duplicate. Implementations 1075 SHOULD use caution in relying on any data which is contained in 1076 Initial packets that is not otherwise authenticated. 1078 It is also possible for the attacker to tamper with data that is 1079 carried in Handshake packets, but because that tampering requires 1080 modifying TLS handshake messages, that tampering will cause the TLS 1081 handshake to fail. 1083 8. QUIC-Specific Additions to the TLS Handshake 1085 QUIC uses the TLS handshake for more than just negotiation of 1086 cryptographic parameters. The TLS handshake validates protocol 1087 version selection, provides preliminary values for QUIC transport 1088 parameters, and allows a server to perform return routeability checks 1089 on clients. 1091 8.1. Protocol and Version Negotiation 1093 The QUIC version negotiation mechanism is used to negotiate the 1094 version of QUIC that is used prior to the completion of the 1095 handshake. However, this packet is not authenticated, enabling an 1096 active attacker to force a version downgrade. 1098 To ensure that a QUIC version downgrade is not forced by an attacker, 1099 version information is copied into the TLS handshake, which provides 1100 integrity protection for the QUIC negotiation. This does not prevent 1101 version downgrade prior to the completion of the handshake, though it 1102 means that a downgrade causes a handshake failure. 1104 TLS uses Application Layer Protocol Negotiation (ALPN) [RFC7301] to 1105 select an application protocol. The application-layer protocol MAY 1106 restrict the QUIC versions that it can operate over. Servers MUST 1107 select an application protocol compatible with the QUIC version that 1108 the client has selected. 1110 If the server cannot select a compatible combination of application 1111 protocol and QUIC version, it MUST abort the connection. A client 1112 MUST abort a connection if the server picks an incompatible 1113 combination of QUIC version and ALPN identifier. 1115 8.2. QUIC Transport Parameters Extension 1117 QUIC transport parameters are carried in a TLS extension. Different 1118 versions of QUIC might define a different format for this struct. 1120 Including transport parameters in the TLS handshake provides 1121 integrity protection for these values. 1123 enum { 1124 quic_transport_parameters(0xffa5), (65535) 1125 } ExtensionType; 1127 The "extension_data" field of the quic_transport_parameters extension 1128 contains a value that is defined by the version of QUIC that is in 1129 use. The quic_transport_parameters extension carries a 1130 TransportParameters when the version of QUIC defined in 1131 [QUIC-TRANSPORT] is used. 1133 The quic_transport_parameters extension is carried in the ClientHello 1134 and the EncryptedExtensions messages during the handshake. 1136 While the transport parameters are technically available prior to the 1137 completion of the handshake, they cannot be fully trusted until the 1138 handshake completes, and reliance on them should be minimized. 1139 However, any tampering with the parameters will cause the handshake 1140 to fail. 1142 9. Security Considerations 1144 There are likely to be some real clangers here eventually, but the 1145 current set of issues is well captured in the relevant sections of 1146 the main text. 1148 Never assume that because it isn't in the security considerations 1149 section it doesn't affect security. Most of this document does. 1151 9.1. Packet Reflection Attack Mitigation 1153 A small ClientHello that results in a large block of handshake 1154 messages from a server can be used in packet reflection attacks to 1155 amplify the traffic generated by an attacker. 1157 QUIC includes three defenses against this attack. First, the packet 1158 containing a ClientHello MUST be padded to a minimum size. Second, 1159 if responding to an unverified source address, the server is 1160 forbidden to send more than three UDP datagrams in its first flight 1161 (see Section 4.7 of [QUIC-TRANSPORT]). Finally, because 1162 acknowledgements of Handshake packets are authenticated, a blind 1163 attacker cannot forge them. Put together, these defenses limit the 1164 level of amplification. 1166 9.2. Peer Denial of Service 1168 QUIC, TLS and HTTP/2 all contain a messages that have legitimate uses 1169 in some contexts, but that can be abused to cause a peer to expend 1170 processing resources without having any observable impact on the 1171 state of the connection. If processing is disproportionately large 1172 in comparison to the observable effects on bandwidth or state, then 1173 this could allow a malicious peer to exhaust processing capacity 1174 without consequence. 1176 QUIC prohibits the sending of empty "STREAM" frames unless they are 1177 marked with the FIN bit. This prevents "STREAM" frames from being 1178 sent that only waste effort. 1180 While there are legitimate uses for some redundant packets, 1181 implementations SHOULD track redundant packets and treat excessive 1182 volumes of any non-productive packets as indicative of an attack. 1184 9.3. Packet Number Protection Analysis 1186 Packet number protection relies on the packet protection AEAD being a 1187 pseudorandom function (PRF), which is not a property that AEAD 1188 algorithms guarantee. Therefore, no strong assurances about the 1189 general security of this mechanism can be shown in the general case. 1190 The AEAD algorithms described in this document are assumed to be 1191 PRFs. 1193 The packet number protection algorithms defined in this document take 1194 the form: 1196 encrypted_pn = packet_number XOR PRF(pn_key, sample) 1198 This construction is secure against chosen plaintext attacks (IND- 1199 CPA) [IMC]. 1201 Use of the same key and ciphertext sample more than once risks 1202 compromising packet number protection. Protecting two different 1203 packet numbers with the same key and ciphertext sample reveals the 1204 exclusive OR of those packet numbers. Assuming that the AEAD acts as 1205 a PRF, if L bits are sampled, the odds of two ciphertext samples 1206 being identical approach 2^(-L/2), that is, the birthday bound. For 1207 the algorithms described in this document, that probability is one in 1208 2^64. 1210 Note: In some cases, inputs shorter than the full size required by 1211 the packet protection algorithm might be used. 1213 To prevent an attacker from modifying packet numbers, values of 1214 packet numbers are transitively authenticated using packet 1215 protection; packet numbers are part of the authenticated additional 1216 data. A falsified or modified packet number can only be detected 1217 once the packet protection is removed. 1219 An attacker can guess values for packet numbers and have an endpoint 1220 confirm guesses through timing side channels. If the recipient of a 1221 packet discards packets with duplicate packet numbers without 1222 attempting to remove packet protection they could reveal through 1223 timing side-channels that the packet number matches a received 1224 packet. For authentication to be free from side-channels, the entire 1225 process of packet number protection removal, packet number recovery, 1226 and packet protection removal MUST be applied together without timing 1227 and other side-channels. 1229 For the sending of packets, construction and protection of packet 1230 payloads and packet numbers MUST be free from side-channels that 1231 would reveal the packet number or its encoded size. 1233 10. IANA Considerations 1235 This document does not create any new IANA registries, but it 1236 registers the values in the following registries: 1238 o TLS ExtensionsType Registry [TLS-REGISTRIES] - IANA is to register 1239 the quic_transport_parameters extension found in Section 8.2. The 1240 Recommended column is to be marked Yes. The TLS 1.3 Column is to 1241 include CH and EE. 1243 11. References 1245 11.1. Normative References 1247 [AEAD] McGrew, D., "An Interface and Algorithms for Authenticated 1248 Encryption", RFC 5116, DOI 10.17487/RFC5116, January 2008, 1249 . 1251 [AES] "Advanced encryption standard (AES)", National Institute 1252 of Standards and Technology report, 1253 DOI 10.6028/nist.fips.197, November 2001. 1255 [CHACHA] Nir, Y. and A. Langley, "ChaCha20 and Poly1305 for IETF 1256 Protocols", RFC 8439, DOI 10.17487/RFC8439, June 2018, 1257 . 1259 [QUIC-RECOVERY] 1260 Iyengar, J., Ed. and I. Swett, Ed., "QUIC Loss Detection 1261 and Congestion Control", draft-ietf-quic-recovery-14 (work 1262 in progress), August 2018. 1264 [QUIC-TRANSPORT] 1265 Iyengar, J., Ed. and M. Thomson, Ed., "QUIC: A UDP-Based 1266 Multiplexed and Secure Transport", draft-ietf-quic- 1267 transport-14 (work in progress), August 2018. 1269 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1270 Requirement Levels", BCP 14, RFC 2119, 1271 DOI 10.17487/RFC2119, March 1997, 1272 . 1274 [RFC7301] Friedl, S., Popov, A., Langley, A., and E. Stephan, 1275 "Transport Layer Security (TLS) Application-Layer Protocol 1276 Negotiation Extension", RFC 7301, DOI 10.17487/RFC7301, 1277 July 2014, . 1279 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 1280 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 1281 May 2017, . 1283 [SHA] Dang, Q., "Secure Hash Standard", National Institute of 1284 Standards and Technology report, 1285 DOI 10.6028/nist.fips.180-4, July 2015. 1287 [TLS-REGISTRIES] 1288 Salowey, J. and S. Turner, "IANA Registry Updates for 1289 Transport Layer Security (TLS) and Datagram Transport 1290 Layer Security (DTLS)", draft-ietf-tls-iana-registry- 1291 updates-05 (work in progress), May 2018. 1293 [TLS13] Rescorla, E., "The Transport Layer Security (TLS) Protocol 1294 Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, 1295 . 1297 11.2. Informative References 1299 [AEBounds] 1300 Luykx, A. and K. Paterson, "Limits on Authenticated 1301 Encryption Use in TLS", March 2016, 1302 . 1304 [IMC] Katz, J. and Y. Lindell, "Introduction to Modern 1305 Cryptography, Second Edition", ISBN 978-1466570269, 1306 November 2014. 1308 [QUIC-HTTP] 1309 Bishop, M., Ed., "Hypertext Transfer Protocol (HTTP) over 1310 QUIC", draft-ietf-quic-http-14 (work in progress), August 1311 2018. 1313 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, 1314 DOI 10.17487/RFC2818, May 2000, 1315 . 1317 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 1318 Housley, R., and W. Polk, "Internet X.509 Public Key 1319 Infrastructure Certificate and Certificate Revocation List 1320 (CRL) Profile", RFC 5280, DOI 10.17487/RFC5280, May 2008, 1321 . 1323 11.3. URIs 1325 [1] https://mailarchive.ietf.org/arch/search/?email_list=quic 1327 [2] https://github.com/quicwg 1329 [3] https://github.com/quicwg/base-drafts/labels/-tls 1331 Appendix A. Change Log 1333 *RFC Editor's Note:* Please remove this section prior to 1334 publication of a final version of this document. 1336 Issue and pull request numbers are listed with a leading octothorp. 1338 A.1. Since draft-ietf-quic-tls-13 1340 o Updated to TLS 1.3 final (#1660) 1342 A.2. Since draft-ietf-quic-tls-12 1344 o Changes to integration of the TLS handshake (#829, #1018, #1094, 1345 #1165, #1190, #1233, #1242, #1252, #1450) 1347 * The cryptographic handshake uses CRYPTO frames, not stream 0 1349 * QUIC packet protection is used in place of TLS record 1350 protection 1352 * Separate QUIC packet number spaces are used for the handshake 1354 * Changed Retry to be independent of the cryptographic handshake 1356 * Limit the use of HelloRetryRequest to address TLS needs (like 1357 key shares) 1359 o Changed codepoint of TLS extension (#1395, #1402) 1361 A.3. Since draft-ietf-quic-tls-11 1363 o Encrypted packet numbers. 1365 A.4. Since draft-ietf-quic-tls-10 1367 o No significant changes. 1369 A.5. Since draft-ietf-quic-tls-09 1371 o Cleaned up key schedule and updated the salt used for handshake 1372 packet protection (#1077) 1374 A.6. Since draft-ietf-quic-tls-08 1376 o Specify value for max_early_data_size to enable 0-RTT (#942) 1378 o Update key derivation function (#1003, #1004) 1380 A.7. Since draft-ietf-quic-tls-07 1382 o Handshake errors can be reported with CONNECTION_CLOSE (#608, 1383 #891) 1385 A.8. Since draft-ietf-quic-tls-05 1387 No significant changes. 1389 A.9. Since draft-ietf-quic-tls-04 1391 o Update labels used in HKDF-Expand-Label to match TLS 1.3 (#642) 1393 A.10. Since draft-ietf-quic-tls-03 1395 No significant changes. 1397 A.11. Since draft-ietf-quic-tls-02 1399 o Updates to match changes in transport draft 1401 A.12. Since draft-ietf-quic-tls-01 1403 o Use TLS alerts to signal TLS errors (#272, #374) 1405 o Require ClientHello to fit in a single packet (#338) 1407 o The second client handshake flight is now sent in the clear (#262, 1408 #337) 1410 o The QUIC header is included as AEAD Associated Data (#226, #243, 1411 #302) 1413 o Add interface necessary for client address validation (#275) 1415 o Define peer authentication (#140) 1417 o Require at least TLS 1.3 (#138) 1419 o Define transport parameters as a TLS extension (#122) 1421 o Define handling for protected packets before the handshake 1422 completes (#39) 1424 o Decouple QUIC version and ALPN (#12) 1426 A.13. Since draft-ietf-quic-tls-00 1428 o Changed bit used to signal key phase 1430 o Updated key phase markings during the handshake 1432 o Added TLS interface requirements section 1434 o Moved to use of TLS exporters for key derivation 1436 o Moved TLS error code definitions into this document 1438 A.14. Since draft-thomson-quic-tls-01 1440 o Adopted as base for draft-ietf-quic-tls 1442 o Updated authors/editors list 1444 o Added status note 1446 Acknowledgments 1448 This document has benefited from input from Dragana Damjanovic, 1449 Christian Huitema, Jana Iyengar, Adam Langley, Roberto Peon, Eric 1450 Rescorla, Ian Swett, and many others. 1452 Contributors 1454 Ryan Hamilton was originally an author of this specification. 1456 Authors' Addresses 1458 Martin Thomson (editor) 1459 Mozilla 1461 Email: martin.thomson@gmail.com 1463 Sean Turner (editor) 1464 sn3rd 1466 Email: sean@sn3rd.com