idnits 2.17.1 draft-ietf-httpbis-replay-01.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 : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == The document seems to lack the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. (The document does seem to have the reference to RFC 2119 which the ID-Checklist requires). -- The document date (October 20, 2017) is 2374 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) ** Obsolete normative reference: RFC 7230 (ref. 'HTTP') (Obsoleted by RFC 9110, RFC 9112) ** Obsolete normative reference: RFC 7231 (Obsoleted by RFC 9110) == Outdated reference: A later version (-28) exists of draft-ietf-tls-tls13-21 == Outdated reference: A later version (-34) exists of draft-ietf-quic-http-07 -- Obsolete informational reference (is this intentional?): RFC 7540 (Obsoleted by RFC 9113) Summary: 2 errors (**), 0 flaws (~~), 4 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 httpbis Working Group M. Thomson 3 Internet-Draft Mozilla 4 Intended status: Standards Track M. Nottingham 5 Expires: April 23, 2018 Fastly 6 W. Tarreau 7 HAProxy Technologies 8 October 20, 2017 10 Using Early Data in HTTP 11 draft-ietf-httpbis-replay-01 13 Abstract 15 This document explains the risks of using early data for HTTP and 16 describes techniques for reducing them. In particular, it defines a 17 mechanism that enables clients to communicate with servers about 18 early data, to assure correct operation. 20 Status of This Memo 22 This Internet-Draft is submitted in full conformance with the 23 provisions of BCP 78 and BCP 79. 25 Internet-Drafts are working documents of the Internet Engineering 26 Task Force (IETF). Note that other groups may also distribute 27 working documents as Internet-Drafts. The list of current Internet- 28 Drafts is at https://datatracker.ietf.org/drafts/current/. 30 Internet-Drafts are draft documents valid for a maximum of six months 31 and may be updated, replaced, or obsoleted by other documents at any 32 time. It is inappropriate to use Internet-Drafts as reference 33 material or to cite them other than as "work in progress." 35 This Internet-Draft will expire on April 23, 2018. 37 Copyright Notice 39 Copyright (c) 2017 IETF Trust and the persons identified as the 40 document authors. All rights reserved. 42 This document is subject to BCP 78 and the IETF Trust's Legal 43 Provisions Relating to IETF Documents 44 (https://trustee.ietf.org/license-info) in effect on the date of 45 publication of this document. Please review these documents 46 carefully, as they describe your rights and restrictions with respect 47 to this document. Code Components extracted from this document must 48 include Simplified BSD License text as described in Section 4.e of 49 the Trust Legal Provisions and are provided without warranty as 50 described in the Simplified BSD License. 52 Table of Contents 54 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 55 1.1. Conventions and Definitions . . . . . . . . . . . . . . . 3 56 2. Early Data in HTTP . . . . . . . . . . . . . . . . . . . . . 3 57 3. Supporting Early Data in HTTP Servers . . . . . . . . . . . . 3 58 4. Using Early Data in HTTP Clients . . . . . . . . . . . . . . 5 59 5. Extensions for Early Data in HTTP . . . . . . . . . . . . . . 6 60 5.1. The Early-Data Header Field . . . . . . . . . . . . . . . 6 61 5.2. The 425 (Too Early) Status Code . . . . . . . . . . . . . 7 62 6. Security Considerations . . . . . . . . . . . . . . . . . . . 8 63 6.1. Gateways and Early Data . . . . . . . . . . . . . . . . . 8 64 6.2. Consistent Handling of Early Data . . . . . . . . . . . . 8 65 6.3. Denial of Service . . . . . . . . . . . . . . . . . . . . 8 66 6.4. Out of Order Delivery . . . . . . . . . . . . . . . . . . 9 67 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9 68 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 9 69 8.1. Normative References . . . . . . . . . . . . . . . . . . 9 70 8.2. Informative References . . . . . . . . . . . . . . . . . 10 71 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 10 72 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 10 74 1. Introduction 76 TLS 1.3 [TLS13] introduces the concept of early data (also known as 77 zero round trip data or 0-RTT data). Early data allows a client to 78 send data to a server in the first round trip of a connection, 79 without waiting for the TLS handshake to complete if the client has 80 spoken to the same server recently. 82 When used with HTTP [HTTP], early data allows clients to send 83 requests immediately, avoiding the one or two round trip delay needed 84 for the TLS handshake. This is a significant performance 85 enhancement; however, it has significant limitations. 87 The primary risk of using early data is that an attacker might 88 capture and replay the request(s) it contains. TLS [TLS13] describes 89 techniques that can be used to reduce the likelihood that an attacker 90 can successfully replay a request, but these techniques can be 91 difficult to deploy, and still leave some possibility of a successful 92 attack. 94 Note that this is different from automated or user-initiated retries; 95 replays are initiated by an attacker without the awareness of the 96 client. 98 To help mitigate the risk of replays in HTTP, this document gives an 99 overview of techniques for controlling these risks in servers, and 100 defines requirements for clients when sending requests in early data. 102 The advice in this document also applies to use of 0-RTT in HTTP over 103 QUIC [HQ]. 105 1.1. Conventions and Definitions 107 The words "MUST", "MUST NOT", "SHOULD", and "MAY" are used in this 108 document. It's not shouting; when they are capitalized, they have 109 the special meaning defined in [RFC2119]. 111 2. Early Data in HTTP 113 Conceptually, early data is concatenated with other application to 114 form a single stream. This can mean that requests are entirely 115 contained within early data, or only part of a request is early. In 116 a multiplexed protocol, like HTTP/2 [RFC7540] or HTTP/QUIC [HQ], 117 multiple requests might be partially delivered in early data. 119 The model that this document assumes is that once the TLS handshake 120 completes, the early data received on that TLS connection is known to 121 not be a replayed copy of that data. However, it is important to 122 note that this does not mean that early data will not be or has not 123 been replayed on another connection. 125 3. Supporting Early Data in HTTP Servers 127 A server decides whether or not to offer a client the ability to send 128 early data on future connections when sending the TLS session ticket. 130 When a server enables early data, there are a number of techniques it 131 can use to mitigate the risks of replay: 133 1. TLS [TLS13] mandates the use of replay detection strategies that 134 reduce the ability of an attacker to successfully replay early 135 data. These anti-replay techniques reduce but don't completely 136 eliminate the chance of data being replayed and ensure a fixed 137 upper limit to the number of replays. 139 2. The server can choose whether it will process early data before 140 the TLS handshake completes. By deferring processing, it can 141 ensure that only a successfully completed connection is used for 142 the request(s) therein. This provides the server with some 143 assurance that the early data was not replayed. 145 3. If the server receives multiple requests in early data, it can 146 determine whether to defer HTTP processing on a per-request 147 basis. This may require buffering the responses to preserve 148 ordering in HTTP/1.1. 150 4. The server can cause a client to retry a request and not use 151 early data by responding with the 425 (Too Early) status code 152 (Section 5.2), in cases where the risk of replay is judged too 153 great. 155 For a given request, the level of tolerance to replay risk is 156 specific to the resource it operates upon (and therefore only known 157 to the origin server). In general, if processing a request does not 158 have state-changing side effects, the consequences of replay are not 159 significant. 161 The request method's safety ([RFC7231], Section 4.2.1) is one way to 162 determine this. However, some resources do elect to associate side 163 effects with safe methods, so this cannot be universally relied upon. 165 It is RECOMMENDED that origin servers allow resources to explicitly 166 configure whether early data is appropriate in requests. Absent such 167 explicit information, they SHOULD mitigate against early data in 168 requests that have unsafe methods, using the techniques outlined 169 above. 171 A request might be sent partially in early data with the remainder of 172 the request being sent after the handshake completes. This does not 173 necessarily affect handling of that request; what matters is when the 174 server starts acting upon the contents of a request. Any time a 175 server might initiate processing prior to completion of the handshake 176 it needs to consider how a possible replay of early data could affect 177 that processing (see also Section 6.2). 179 A server can partially process requests that are incomplete. Parsing 180 header fields - without acting on the values - and determining 181 request routing is likely to be safe from side-effects, but other 182 actions might not be. 184 Intermediary servers do not have sufficient information to make this 185 determination, so Section 5.2 describes a way for the origin to 186 signal to them that a particular request isn't appropriate for early 187 data. Intermediaries that accept early data MUST implement that 188 mechanism. 190 Note that a server cannot choose to selectively reject early data at 191 the TLS layer. TLS only permits a server to accept all early data, 192 or none of it. Once a server has decided to accept early data, it 193 MUST process all requests in early data, even if the server rejects 194 the request by sending a 425 (Too Early) response. 196 A server can limit the amount of early data with the 197 "max_early_data_size" field of the "early_data" TLS extension. This 198 can be used to avoid committing an arbitrary amount of memory for 199 deferred requests. A server SHOULD ensure that when it accepts early 200 data, it can defer processing of requests until after the TLS 201 handshake completes. 203 4. Using Early Data in HTTP Clients 205 A client that wishes to use early data commences sending HTTP 206 requests immediately after sending the TLS ClientHello. 208 By their nature, clients have control over whether a given request is 209 sent in early data - thereby giving the client control over risk of 210 replay. Absent other information, clients MAY send requests with 211 safe HTTP methods (see [RFC7231], Section 4.2.1) in early data when 212 it is available, and SHOULD NOT send unsafe methods (or methods whose 213 safety is not known) in early data. 215 If the server rejects early data at the TLS layer, a client MUST 216 start sending again as though the connection was new. For HTTP/2, 217 this means re-sending the connection preface. Any requests sent in 218 early data MUST be sent again, unless the client decides to abandon 219 those requests. 221 This automatic retry exposes the request to a potential replay 222 attack. An attacker sends early data to one server instance that 223 accepts and processes the early data, but allows that connection to 224 proceed no further. The attacker then forwards the same messages 225 from the client to another server instance that will reject early 226 data. The client then retries the request, resulting in the request 227 being processed twice. Replays are also possible if there are 228 multiple server instances that will accept early data, or if the same 229 server accepts early data multiple times (though this would be in 230 violation of requirements in TLS). 232 Clients that use early data MUST retry requests upon receipt of a 425 233 (Too Early) status code; see Section 5.2. 235 An intermediary MUST NOT use early data when forwarding a request 236 unless early data was used on a previous hop, or it knows that the 237 request can be retried safely without consequences (typically, using 238 out-of-band configuration). Absent better information, that means 239 that an intermediary can only use early data if the request either 240 arrived in early data or arrived with the "Early-Data" header field 241 set to "1" (see Section 5.1). 243 5. Extensions for Early Data in HTTP 245 Because HTTP requests can span multiple "hops", it is necessary to 246 explicitly communicate whether a request has been sent in early data 247 on a previous connection. Likewise, some means of explicitly 248 triggering a retry when early data is not desirable is necessary. 249 Finally, it is necessary to know whether the client will actually 250 perform such a retry. 252 To meet these needs, two signalling mechanisms are defined: 254 o The "Early-Data" header field is included in requests that are 255 received in early data. 257 o The 425 (Too Early) status code is defined for a server to 258 indicate that a request could not be processed due to the 259 consequences of a possible replay attack. 261 They are designed to enable better coordination of the use of early 262 data between the user agent and origin server, and also when a 263 gateway (also "reverse proxy", "Content Delivery Network", or 264 "surrogate") is present. 266 Gateways typically don't have specific information about whether a 267 given request can be processed safely when it is sent in early data. 268 In many cases, only the origin server has the necessary information 269 to decide whether the risk of replay is acceptable. These extensions 270 allow coordination between a gateway and its origin server. 272 5.1. The Early-Data Header Field 274 The "Early-Data" request header field indicates that the request has 275 been conveyed in early data, and additionally indicates that a client 276 understands the 425 (Too Early) status code. 278 It has just one valid value: "1". Its syntax is defined by the 279 following ABNF [ABNF]: 281 Early-Data = "1" 283 For example: 285 GET /resource HTTP/1.0 286 Host: example.com 287 Early-Data: 1 289 An intermediary that forwards a request prior to the completion of 290 the TLS handshake MUST send it with the "Early-Data" header field set 291 to "1" (i.e., it adds it if not present in the request). An 292 intermediary MUST use the "Early-Data" header field if it might have 293 forwarded the request prior to handshake completion (see Section 6.2 294 for details). 296 An intermediary MUST NOT remove this header field if it is present in 297 a request. 299 The "Early-Data" header field is not intended for use by user agents 300 (that is, the original initiator of a request). Sending a request in 301 early data implies that the client understands this specification and 302 is willing to retry a request in response to a 425 (Too Early) status 303 code. A user agent that sends a request in early data does not need 304 to include the "Early-Data" header field. 306 A server cannot make a request that contains the Early-Data header 307 field safe for processing by waiting for the handshake to complete. 308 A request that is marked with Early-Data was sent in early data on a 309 previous hop. Requests that contain the Early-Data field and cannot 310 be safely processed MUST be rejected using the 425 (Too Early) status 311 code. 313 5.2. The 425 (Too Early) Status Code 315 A 425 (Too Early) status code indicates that the server is unwilling 316 to risk processing a request that might be replayed. 318 Clients (user-agents and intermediaries) that sent the request in 319 early data MUST automatically retry the request when receiving a 425 320 (Too Early) response status code. Such retries MUST NOT be sent in 321 early data. 323 Intermediaries that receive a 425 (Too Early) status code MAY 324 automatically retry requests after allowing the handshake to complete 325 unless the original request contained the "Early-Data" header field 326 when it was received. Otherwise, an intermediary MUST forward the 327 425 (Too Early) status code. 329 The server cannot assume that a client is able to retry a request 330 unless the request is received in early data or the "Early-Data" 331 header field is set to "1". A server SHOULD NOT emit the 425 status 332 code unless one of these conditions is met. 334 The 425 (Too Early) status code is not cacheable by default. Its 335 payload is not the representation of any identified resource. 337 6. Security Considerations 339 Using early data exposes a client to the risk that their request is 340 replayed. A retried or replayed request can produce different side 341 effects on the server. In addition to those side effects, replays 342 and retries might be used for traffic analysis to recover information 343 about requests or the resources those requests target. 345 6.1. Gateways and Early Data 347 A gateway that forwards requests that were received in early data 348 MUST only do so if it knows that the origin server that receives 349 those requests understands the "Early-Data" header field and will 350 correctly generate a 425 (Too Early) status code. A gateway that 351 isn't certain about origin server support SHOULD either delay 352 forwarding the request until the TLS handshake with its client 353 completes, or send a 425 (Too Early) status code in response. A 354 gateway that is uncertain about whether an origin server supports the 355 "Early-Data" header field SHOULD disable early data. 357 6.2. Consistent Handling of Early Data 359 Consistent treatment of a request that arrives in - or partially in - 360 early data is critical to avoiding inappropriate processing of 361 replayed requests. If a request is not safe to process before the 362 TLS handshake completes, then all instances of the server (including 363 gateways) need to agree and either reject the request or delay 364 processing. 366 A server MUST NOT act on early data before the handshake completes if 367 it and any other server instance could make a different decision 368 about how to handle the same data. 370 6.3. Denial of Service 372 Accepting early data exposes a server to potential denial of service 373 through the replay of requests that are expensive to handle. A 374 server that is under load SHOULD prefer rejecting TLS early data as a 375 whole rather than accepting early data and selectively processing 376 requests. Generating a 503 (Service Unavailable) or 425 (Too Early) 377 status code often leads to clients retrying requests, which could 378 result in increased load. 380 6.4. Out of Order Delivery 382 In protocols that deliver data out of order (such as QUIC [HQ]) early 383 data can arrive after the handshake completes. This leads to 384 potential ambiguity about the status of requests and could lead to 385 inconsistent treatment (see Section 6.2). Implementations MUST 386 either ensure that any early data that is delivered late is either 387 discarded or consistently identified and processed. 389 7. IANA Considerations 391 This document registers the "Early-Data" header field in the "Message 392 Headers" registry [HEADERS]. 394 Header field name: Early-Data 396 Applicable protocol: http 398 Status: standard 400 Author/Change controller: IETF 402 Specification document(s): This document 404 Related information: (empty) 406 This document registers the 425 (Too Early) status code in the 407 "Hypertext Transfer Protocol (HTTP) Status Code" registry established 408 in [RFC7231]. 410 Value: 425 412 Description: Too Early 414 Reference: This document 416 8. References 418 8.1. Normative References 420 [ABNF] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 421 Specifications: ABNF", STD 68, RFC 5234, 422 DOI 10.17487/RFC5234, January 2008, 423 . 425 [HEADERS] Klyne, G., Nottingham, M., and J. Mogul, "Registration 426 Procedures for Message Header Fields", BCP 90, RFC 3864, 427 DOI 10.17487/RFC3864, September 2004, 428 . 430 [HTTP] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 431 Protocol (HTTP/1.1): Message Syntax and Routing", 432 RFC 7230, DOI 10.17487/RFC7230, June 2014, 433 . 435 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 436 Requirement Levels", BCP 14, RFC 2119, 437 DOI 10.17487/RFC2119, March 1997, 438 . 440 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 441 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 442 DOI 10.17487/RFC7231, June 2014, 443 . 445 [TLS13] Rescorla, E., "The Transport Layer Security (TLS) Protocol 446 Version 1.3", draft-ietf-tls-tls13-21 (work in progress), 447 July 2017. 449 8.2. Informative References 451 [HQ] Bishop, M., "Hypertext Transfer Protocol (HTTP) over 452 QUIC", draft-ietf-quic-http-07 (work in progress), October 453 2017. 455 [RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 456 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 457 DOI 10.17487/RFC7540, May 2015, 458 . 460 Acknowledgments 462 This document was not easy to produce. The following people made 463 substantial contributions to the quality and completeness of the 464 document: Subodh Iyengar, Benjamin Kaduk, Ilari Liusavaara, Kazuho 465 Oku, Kyle Rose, and Victor Vasiliev. 467 Authors' Addresses 469 Martin Thomson 470 Mozilla 472 Email: martin.thomson@gmail.com 473 Mark Nottingham 474 Fastly 476 Email: mnot@mnot.net 478 Willy Tarreau 479 HAProxy Technologies 481 Email: willy@haproxy.org