idnits 2.17.1 draft-ietf-tls-sni-encryption-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 -- Couldn't find a document date in the document -- date freshness check skipped. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Outdated reference: A later version (-34) exists of draft-ietf-quic-tls-09 == Outdated reference: A later version (-43) exists of draft-ietf-tls-dtls13-22 == Outdated reference: A later version (-28) exists of draft-ietf-tls-tls13-23 -- Obsolete informational reference (is this intentional?): RFC 5246 (Obsoleted by RFC 8446) -- Obsolete informational reference (is this intentional?): RFC 7540 (Obsoleted by RFC 9113) Summary: 0 errors (**), 0 flaws (~~), 4 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group C. Huitema 3 Internet-Draft Private Octopus Inc. 4 Intended status: Standards Track E. Rescorla 5 Expires: August 22, 2018 RTFM, Inc. 6 2 18, 2018 8 SNI Encryption in TLS Through Tunneling 9 draft-ietf-tls-sni-encryption-01 11 Abstract 13 This draft describes the general problem of encryption of the Server 14 Name Identification (SNI) parameter. The proposed solutions hide a 15 Hidden Service behind a Fronting Service, only disclosing the SNI of 16 the Fronting Service to external observers. The draft starts by 17 listing known attacks against SNI encryption, discusses the current 18 "co-tenancy fronting" solution, and then presents two potential TLS 19 layer solutions that might mitigate these attacks. 20 The first solution is based on TLS in TLS "quasi tunneling", and the 21 second solution is based on "combined tickets". These solutions only 22 require minimal extensions to the TLS protocol. 24 Status of This Memo 26 This Internet-Draft is submitted in full conformance with the 27 provisions of BCP 78 and BCP 79. 29 Internet-Drafts are working documents of the Internet Engineering 30 Task Force (IETF). Note that other groups may also distribute 31 working documents as Internet-Drafts. The list of current Internet- 32 Drafts is at https://datatracker.ietf.org/drafts/current/. 34 Internet-Drafts are draft documents valid for a maximum of six months 35 and may be updated, replaced, or obsoleted by other documents at any 36 time. It is inappropriate to use Internet-Drafts as reference 37 material or to cite them other than as "work in progress." 39 This Internet-Draft will expire on August 22, 2018. 41 Copyright Notice 43 Copyright (c) 2018 IETF Trust and the persons identified as the 44 document authors. All rights reserved. 46 This document is subject to BCP 78 and the IETF Trust's Legal 47 Provisions Relating to IETF Documents 48 (https://trustee.ietf.org/license-info) in effect on the date of 49 publication of this document. Please review these documents 50 carefully, as they describe your rights and restrictions with respect 51 to this document. Code Components extracted from this document must 52 include Simplified BSD License text as described in Section 4.e of 53 the Trust Legal Provisions and are provided without warranty as 54 described in the Simplified BSD License. 56 Table of Contents 58 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 59 1.1. Key Words . . . . . . . . . . . . . . . . . . . . . . . . 4 60 2. Security and Privacy Requirements for SNI Encryption . . . . 4 61 2.1. Mitigate Replay Attacks . . . . . . . . . . . . . . . . . 4 62 2.2. Avoid Widely Shared Secrets . . . . . . . . . . . . . . . 4 63 2.3. Prevent SNI-based Denial of Service Attacks . . . . . . . 5 64 2.4. Do not stick out . . . . . . . . . . . . . . . . . . . . 5 65 2.5. Forward Secrecy . . . . . . . . . . . . . . . . . . . . . 5 66 2.6. Proper Security Context . . . . . . . . . . . . . . . . . 5 67 2.7. Fronting Server Spoofing . . . . . . . . . . . . . . . . 6 68 3. HTTP Co-Tenancy Fronting . . . . . . . . . . . . . . . . . . 6 69 3.1. HTTPS Tunnels . . . . . . . . . . . . . . . . . . . . . . 7 70 3.2. Delegation Token . . . . . . . . . . . . . . . . . . . . 7 71 4. Supporting multiple protocols . . . . . . . . . . . . . . . . 9 72 4.1. Hiding the Application Layer Protocol Negotiation . . . . 9 73 4.2. Support other transports than HTTP . . . . . . . . . . . 9 74 5. SNI Encapsulation Specification . . . . . . . . . . . . . . . 10 75 5.1. Tunneling TLS in TLS . . . . . . . . . . . . . . . . . . 10 76 5.2. Tunneling design issues . . . . . . . . . . . . . . . . . 11 77 5.2.1. Fronting Server logic . . . . . . . . . . . . . . . . 12 78 5.2.2. Early data . . . . . . . . . . . . . . . . . . . . . 13 79 5.2.3. Client requirements . . . . . . . . . . . . . . . . . 13 80 6. SNI encryption with combined tickets . . . . . . . . . . . . 14 81 6.1. Session resumption with combined tickets . . . . . . . . 14 82 6.2. New Combined Session Ticket . . . . . . . . . . . . . . . 16 83 6.3. First session . . . . . . . . . . . . . . . . . . . . . . 17 84 7. Security Considerations . . . . . . . . . . . . . . . . . . . 18 85 7.1. Replay attacks and side channels . . . . . . . . . . . . 18 86 7.2. Sticking out . . . . . . . . . . . . . . . . . . . . . . 19 87 7.3. Forward Secrecy . . . . . . . . . . . . . . . . . . . . . 19 88 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 20 89 9. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 20 90 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 20 91 10.1. Normative References . . . . . . . . . . . . . . . . . . 20 92 10.2. Informative References . . . . . . . . . . . . . . . . . 21 93 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 22 95 1. Introduction 97 Historically, adversaries have been able to monitor the use of web 98 services through three channels: looking at DNS requests, looking at 99 IP addresses in packet headers, and looking at the data stream 100 between user and services. These channels are getting progressively 101 closed. A growing fraction of Internet communication is encrypted, 102 mostly using Transport Layer Security (TLS) [RFC5246]. Progressive 103 deployment of solutions like DNS in TLS [RFC7858] mitigates the 104 disclosure of DNS information. More and more services are colocated 105 on multiplexed servers, loosening the relation between IP address and 106 web service. However, multiplexed servers rely on the Service Name 107 Information (SNI) to direct TLS connections to the appropriate 108 service implementation. This protocol element is transmitted in 109 clear text. As the other methods of monitoring get blocked, 110 monitoring focuses on the clear text SNI. The purpose of SNI 111 encryption is to prevent that. 113 In the past, there have been multiple attempts at defining SNI 114 encryption. These attempts have generally floundered, because the 115 simple designs fail to mitigate several of the attacks listed in 116 Section 2. In the absence of a TLS level solution, the most popular 117 approach to SNI privacy is HTTP level fronting, which we discuss in 118 Section 3. 120 The current draft proposes two designs for SNI Encryption in TLS. 121 Both designs hide a "Hidden Service" behind a "Fronting Service". To 122 an external observer, the TLS connections will appear to be directed 123 towards the Fronting Service. The cleartext SNI parameter will 124 document the Fronting Service. A second SNI parameter will be 125 transmitted in an encrypted form to the Fronting Service, and will 126 allow that service to redirect the connection towards the Hidden 127 Service. 129 The first design relies on tunneling TLS in TLS, as explained in 130 Section 5. It does not require TLS extensions, but relies on 131 conventions in the implementation of TLS 1.3 [I-D.ietf-tls-tls13] by 132 the Client and the Fronting Server. 134 The second design, presented in Section 6 removes the requirement for 135 tunneling, on simply relies on Combined Tickets. It uses the 136 extension process for session tickets already defined in 137 [I-D.ietf-tls-tls13]. 139 This draft is presented as is to trigger discussions. It is expected 140 that as the draft progresses, only one of the two proposed solutions 141 will be retained. 143 1.1. Key Words 145 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 146 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 147 document are to be interpreted as described in [RFC2119]. 149 2. Security and Privacy Requirements for SNI Encryption 151 Over the past years, there have been multiple proposals to add an SNI 152 encryption option in TLS. Many of these proposals appeared 153 promising, but were rejected after security reviews pointed plausible 154 attacks. In this section, we collect a list of these known attacks. 156 2.1. Mitigate Replay Attacks 158 The simplest SNI encryption designs replace in the initial TLS 159 exchange the clear text SNI with an encrypted value, using a key 160 known to the multiplexed server. Regardless of the encryption used, 161 these designs can be broken by a simple replay attack, which works as 162 follow: 164 1- The user starts a TLS connection to the multiplexed server, 165 including an encrypted SNI value. 167 2- The adversary observes the exchange and copies the encrypted SNI 168 parameter. 170 3- The adversary starts its own connection to the multiplexed server, 171 including in its connection parameters the encrypted SNI copied from 172 the observed exchange. 174 4- The multiplexed server establishes the connection to the protected 175 service, thus revealing the identity of the service. 177 One of the goals of SNI encryption is to prevent adversaries from 178 knowing which Hidden Service the client is using. Successful replay 179 attacks breaks that goal by allowing adversaries to discover that 180 service. 182 2.2. Avoid Widely Shared Secrets 184 It is easy to think of simple schemes in which the SNI is encrypted 185 or hashed using a shared secret. This symmetric key must be known by 186 the multiplexed server, and by every users of the protected services. 187 Such schemes are thus very fragile, since the compromise of a single 188 user would compromise the entire set of users and protected services. 190 2.3. Prevent SNI-based Denial of Service Attacks 192 Encrypting the SNI may create extra load for the multiplexed server. 193 Adversaries may mount denial of service attacks by generating random 194 encrypted SNI values and forcing the multiplexed server to spend 195 resources in useless decryption attempts. 197 It may be argued that this is not an important DOS avenue, as regular 198 TLS connection attempts also require the server to perform a number 199 of cryptographic operations. However, in many cases, the SNI 200 decryption will have to be performed by a front end component with 201 limited resources, while the TLS operations are performed by the 202 component dedicated to their respective services. SNI based DOS 203 attacks could target the front end component. 205 2.4. Do not stick out 207 In some designs, handshakes using SNI encryption can be easily 208 differentiated from "regular" handshakes. For example, some designs 209 require specific extensions in the Client Hello packets, or specific 210 values of the clear text SNI parameter. If adversaries can easily 211 detect the use of SNI encryption, they could block it, or they could 212 flag the users of SNI encryption for special treatment. 214 In the future, it might be possible to assume that a large fraction 215 of TLS handshakes use SNI encryption. If that was the case, the 216 detection of SNI encryption would be a lesser concern. However, we 217 have to assume that in the near future, only a small fraction of TLS 218 connections will use SNI encryption. 220 2.5. Forward Secrecy 222 The general concerns about forward secrecy apply to SNI encryption 223 just as well as to regular TLS sessions. For example, some proposed 224 designs rely on a public key of the multiplexed server to define the 225 SNI encryption key. If the corresponding private key was 226 compromised, the adversaries would be able to process archival 227 records of past connections, and retrieve the protected SNI used in 228 these connections. These designs failed to maintain forward secrecy 229 of SNI encryption. 231 2.6. Proper Security Context 233 We can design solutions in which the multiplexed server or a fronting 234 service act as a relay to reach the protected service. Some of those 235 solutions involve just one TLS handshake between the client and the 236 multiplexed server, or between the client and the fronting service. 238 The master secret is verified by verifying a certificate provided by 239 either of these entities, but not by the protected service. 241 These solutions expose the client to a Man-In-The-Middle attack by 242 the multiplexed server or by the fronting service. Even if the 243 client has some reasonable trust in these services, the possibility 244 of MITM attack is troubling. 246 The multiplexed server or the fronting services could be pressured by 247 adversaries. By design, they could be forced to deny access to the 248 protected service, or to divulge which client accessed it. But if 249 MITM is possible, the adversaries would also be able to pressure them 250 into intercepting or spoofing the communications between client and 251 protected service. 253 2.7. Fronting Server Spoofing 255 Adversaries could mount an attack by spoofing the Fronting Service. 256 A spoofed Fronting Service could act as a "honeypot" for users of 257 hidden services. At a minimum, the fake server could record the IP 258 addresses of these users. If the SNI encryption solution places too 259 much trust on the fronting server, the fake server could also serve 260 fake content of its own choosing, including various forms of malware. 262 There are two main channels by which adversaries can conduct this 263 attack. Adversaries can simply try to mislead users into believing 264 that the honeypot is a valid Fronting Server, especially if that 265 information is carried by word of mouth or in unprotected DNS 266 records. Adversaries can also attempt to hijack the traffic to the 267 regular Fronting Server, using for example spoofed DNS responses or 268 spoofed IP level routing, combined with a spoofed certificate. 270 3. HTTP Co-Tenancy Fronting 272 In the absence of TLS level SNI encryption, many sites rely on an 273 "HTTP Co-Tenancy" solution. The TLS connection is established with 274 the fronting server, and HTTP requests are then sent over that 275 connection to the hidden service. For example, the TLS SNI could be 276 set to "fronting.example.com", the fronting server, and HTTP requests 277 sent over that connection could be directed to "hidden.example.com/ 278 some-content", accessing the hidden service. This solution works 279 well in practice when the fronting server and the hidden server are 280 'co-tenant" of the same multiplexed server. 282 The HTTP fronting solution can be deployed without modification to 283 the TLS protocol, and does not require using and specific version of 284 TLS. There are however a few issues regarding discovery, client 285 implementations, trust, and applicability: 287 o The client has to discover that the hidden service can be accessed 288 through the fronting server. 290 o The client browser's has to be directed to access the hidden 291 service through the fronting service. 293 o Since the TLS connection is established with the fronting service, 294 the client has no proof that the content does in fact come from 295 the hidden service. The solution does thus not mitigate the 296 context sharing issues described in Section 2.6. 298 o Since this is an HTTP level solution, it would not protected non 299 HTTP protocols such as DNS over TLS [RFC7858] or IMAP over TLS 300 [RFC2595]. 302 The discovery issue is common to pretty much every SNI encryption 303 solution, and is also discussed in Section 5.2.3 and Section 6.3. 304 The browser issue may be solved by developing a browser extension 305 that support HTTP Fronting, and manages the list of fronting services 306 associated with the hidden services that the client uses. The multi- 307 protocol issue can be mitigated by using implementation of other 308 applications over HTTP, such as for example DNS over HTTPS 309 [I-D.hoffman-dns-over-https]. The trust issue, however, requires 310 specific developments. 312 3.1. HTTPS Tunnels 314 The HTTP Fronting solution places a lot of trust in the Fronting 315 Server. This required trust can be reduced by tunnelling HTTPS in 316 HTTPS, which effectively treats the Fronting Server as an HTTP Proxy. 317 In this solution, the client establishes a TLS connection to the 318 Fronting Server, and then issues an HTTP Connect request to the 319 Hidden Server. This will establish an end-to-end HTTPS over TLS 320 connection between the client and the Hidden Server, mitigating the 321 issues described in Section 2.6. 323 The HTTPS in HTTPS solution requires double encryption of every 324 packet. It also requires that the fronting server decrypts and relay 325 messages to the hidden server. Both of these requirements make the 326 implementation onerous. 328 3.2. Delegation Token 330 Clients would see their privacy compromised if they contacted the 331 wrong fronting server to access the hidden service, since this wrong 332 server could disclose their access to adversaries. This can possibly 333 be mitigated by recording the relation between fronting server and 334 hidden server in a Delegation Token. 336 The delegation token would be a form of certificate, signed by the 337 hidden service. It would have the following components: 339 o The DNS name of the fronting service 341 o TTL (i.e. expiration date) 343 o An indication of the type of access that would be used, such as 344 direct fronting in which the hidden content is directly served by 345 the fronting server, or HTTPS in HTTPS, or one of the TLS level 346 solutions discussed in Section 5 and Section 6 348 o Triple authentication, to make the barrier to setting up a 349 honeypot extremely high 351 1. Cert chain for hidden server certificate (e.g., 352 hidden.example.com) up to CA. 354 2. Certificate transparency proof of the hidden service 355 certificate (hidden.example.com) from a popular log, with a 356 requirement that the browser checks the proof before 357 connecting. 359 3. A TLSA record for hidden service domain name 360 (hidden.example.com), with full DNSSEC chain (also mandatory 361 to check) 363 o Possibly, a list of valid addresses of the fronting service. 365 o Some extension mechanism for other bits 367 If N multiple domains on a CDN are acceptable fronts, then we may 368 want some way to indicate this without publishing and maintaining N 369 separate tokens. 371 Delegation tokens could be published by the fronting server, in 372 response for example to a specific query by a client. The client 373 would then examine whether one of the Delegation Tokens matches the 374 hidden service that it wants to access. 376 QUESTION: Do we need a revocation mechanism? What if a fronting 377 service obtains a delegation token, and then becomes untrustable for 378 some other reason? Or is it sufficient to just use short TTL? 380 4. Supporting multiple protocols 382 The SNI encryption requirement do not stop with HTTP over TLS. 383 Multiple other applications currently use TLS, including for example 384 SMTP [RFC5246], DNS [RFC7858], or XMPP [RFC7590]. These applications 385 too will benefit of SNI encryption. HTTP only methods like those 386 described in Section 3.1 would not apply there. In fact, even for 387 the HTTPS case, the HTTPS tunneling service described in Section 3.1 388 is compatible with HTTP 1.0 and HTTP 1.1, but interacts awkwardly 389 with the multiple streams feature of HTTP 2.0 [RFC7540]. This points 390 to the need of an application agnostic solution, that would be 391 implemented fully in the TLS layer. 393 4.1. Hiding the Application Layer Protocol Negotiation 395 The Application Layer Protocol Negotiation (ALPN) parameters of TLS 396 allow implementations to negotiate the application layer protocol 397 used on a given connection. TLS provides the ALPN values in clear 398 text during the initial handshake. While exposing the ALPN does not 399 create the same privacy issues as exposing the SNI, there is still a 400 risk. For example, some networks may attempt to block applications 401 that they do not understand, or that they wish users would not use. 403 In a sense, ALPN filtering could be very similar to the filtering of 404 specific port numbers exposed in some network. This filtering by 405 ports has given rise to evasion tactics in which various protocols 406 are tunneled over HTTP in order to use open ports 80 or 443. 407 Filtering by ALPN would probably beget the same responses, in which 408 the applications just move over HTTP, and only the HTTP ALPN values 409 are used. Applications would not need to do that if the ALPN was 410 hidden in the same way as the SNI. 412 It is thus desirable that SNI Encryption mechanisms be also able hide 413 the ALPN. 415 4.2. Support other transports than HTTP 417 The TLS handshake is also used over other transports such as UDP with 418 both DTLS [I-D.ietf-tls-dtls13] and QUIC [I-D.ietf-quic-tls]. The 419 requirement to encrypt the SNI apply just as well for these 420 transports as for TLS over TCP. 422 This points to a requirement for SNI Encryption mechanisms to also be 423 applicable to non-TCP transports such as DTLS or QUIC. 425 5. SNI Encapsulation Specification 427 We propose to provide SNI Privacy by using a form of TLS 428 encapsulation. The big advantage of this design compared to previous 429 attempts is that it requires effectively no changes to TLS 1.3. It 430 only requires a way to signal to the Fronting Server server that the 431 encrypted application data is actually a ClientHello which is 432 intended for the hidden service. Once the tunneled session is 433 established, encrypted packets will be forwarded to the Hidden 434 Service without requiring encryption or decryption by the Fronting 435 Service. 437 5.1. Tunneling TLS in TLS 439 The proposed design is to encapsulate a second Client Hello in the 440 early data of a TLS connection to the Fronting Service. To the 441 outside, it just appears that the client is resuming a session with 442 the fronting service. 444 Client Fronting Service Hidden Service 445 ClientHello 446 + early_data 447 + key_share* 448 + psk_key_exchange_modes 449 + pre_shared_key 450 + SNI = fronting 451 ( 452 //Application data 453 ClientHello#2 454 + KeyShare 455 + signature_algorithms* 456 + psk_key_exchange_modes* 457 + pre_shared_key* 458 + SNI = hidden 459 ) 460 --------> 461 ClientHello#2 462 + KeyShare 463 + signature_algorithms* 464 + psk_key_exchange_modes* 465 + pre_shared_key* 466 + SNI = hidden ----> 468 469 --------------------> 470 ServerHello 471 + pre_shared_key 472 + key_share* 474 {EncryptedExtensions} 475 {CertificateRequest*} 476 {Certificate*} 477 {CertificateVerify*} 478 {Finished} 479 <-------------------- 480 {Certificate*} 481 {CertificateVerify*} 482 {Finished} --------------------- 484 [Application Data] <-------------------> [Application Data] 486 Key to brackets: 488 * optional messages, not present in all scenarios 489 () encrypted with Client->Fronting 0-RTT key 490 <> encrypted with Client->Hidden 0-RTT key 491 {} encrypted with Client->Hidden 1-RTT handshake 492 [] encrypted with Client->Hidden 1-RTT key 494 The way this works is that the Fronting Server decrypts the _data_ in 495 the client's first flight, which is actually ClientHello#2 from the 496 client, containing the true SNI and then passes it on to the Hidden 497 server. However, the Hidden Server responds with its own ServerHello 498 which the Fronting Server just passes unchanged, because it's 499 actually the response to ClientHello#2 rather than to ClientHello#1. 500 As long as ClientHello#1 and ClientHello#2 are similar (e.g., 501 differing only in the client's actual share (though of course it must 502 be in the same group)), SNI, and maybe EarlyDataIndication), then an 503 attacker should not be able to distinguish these cases -- although 504 there may be possible attacks through timing analysis, or by 505 observing traffic between the Fronting Server and Hidden Server if 506 they are not colocated. 508 5.2. Tunneling design issues 510 The big advantage of this design is that it requires effectively no 511 changes to TLS. It only requires a way to signal to the Fronting 512 Server that the encrypted application data is actually a ClientHello 513 which is intended for the hidden service. 515 The major disadvantage of this overall design strategy (however it's 516 signaled) is that it's somewhat harder to implement in the co- 517 tenanted cases than the simple schemes that carry the "real SNI" in 518 an encrypted parameter of the Client Hello. That means that it's 519 somewhat less likely that servers will implement it "by default" and 520 more likely that they will have to take explicit effort to allow 521 Encrypted SNI. Conversely, however, these schemes (aside from a 522 server with a single wildcard or multi-SAN cert) involve more changes 523 to TLS to deal with issues like "what is the server cert that is 524 digested into the keys", and that requires more analysis, so there is 525 an advantage to deferring that. If we have EncryptedExtensions in 526 the client's first flight it would be possible to define a "Real SNI" 527 extension later if/when we had clearer analysis for that case. 529 Notes on several obvious technical issues: 531 1. How does the Fronting Server distinguish this case from where the 532 initial flight is actual application data? See Section 5.2.1 for 533 some thoughts on this. 535 2. Can we make this work with 0-RTT data from the client to the 536 Hidden server? The answer is probably yes, as discussed in 537 Section 5.2.2. 539 3. What happens if the Fronting Server doesn't gateway, e.g., 540 because it has forgotten the ServerConfiguration? In that case, 541 the client gets a handshake with the Fronting Server, which it 542 will have to determine via trial decryption. At this point the 543 Fronting Server supplies a ServerConfiguration and the client can 544 reconnect as above. 546 4. What happens if the client does 0-RTT inside 0-RTT (as in #2 547 above) and the Hidden server doesn't recognize the 548 ServerConfiguration in ClientHello#2? In this case, the client 549 gets a 0-RTT rejection and it needs to do trial decryption to 550 know whether the rejection was from the Fronting Server or the 551 Hidden server. 553 5. What happens if the Fronting Server is under a DOS attack, and 554 chooses to refuse all 0-RTT data? 556 The client part of that logic, including the handling of question #3 557 above, is discussed in Section 5.2.3. 559 5.2.1. Fronting Server logic 561 The big advantage of this design is that it requires effectively no 562 changes to TLS. It only requires a way to signal to the Fronting 563 Server that the encrypted application data is actually a ClientHello 564 which is intended for the hidden service. The two most obvious 565 designs are: 567 o Have an EncryptedExtension which indicates that the inner data is 568 tunnelled. 570 o Have a "tunnelled" TLS content type. 572 EncryptedExtensions would be the most natural, but they were removed 573 from the ClientHello during the TLS standardization. In Section 5.1 574 we assume that the second ClientHello is just transmitted as 0-RTT 575 data, and that the servers use some form of pattern matching to 576 differentiate between this second ClientHello and other application 577 messages. 579 5.2.2. Early data 581 In the proposed design, the second ClientHello is sent to the 582 Fronting Server as early data, encrypted with Client->Fronting 0-RTT 583 key. If the Client follows the second ClientHello with 0-RTT data, 584 that data could in theory be sent in two ways: 586 1. The client could use double encryption. The data is first 587 encrypted with the Client->Hidden 0-RTT key, then wrapped and 588 encrypted with the Client->Fronting 0-RTT key. The Fronting 589 server would decrypt, unwrap and relay. 591 2. The client could just encrypt the data with the Client->Hidden 592 0-RTT key, and ask the server to blindly relay it. 594 Each of these ways has its issues. The double encryption scenario 595 would require two end of early data messages, one double encrypted 596 and relayed by the Fronting Server to the Hidden Server, and another 597 sent from Client to Fronting Server, to delimit the end of the double 598 encrypted stream, and also to ensure that the stream of messages is 599 not distinguishable from simply sending 0-RTT data to the Fronting 600 server. The blind relaying is simpler, and is the scenario described 601 in the diagram of Section 5.1. In that scenario, the Fronting server 602 switches to relaying mode immediately after unwrapping and forwarding 603 the second ClientHello. However, the blind relaying requires the 604 ClientHello to be isolated to a single record. 606 5.2.3. Client requirements 608 In order to use the tunneling service, the client needs to identify 609 the Fronting Service willing to tunnel to the Hidden Service. We can 610 assume that the client will learn the identity of suitable Fronting 611 Services from the Hidden Service itself. 613 In order to tunnel the second ClientHello as 0-RTT data, the client 614 needs to have a shared secret with the Fronting Service. To avoid 615 the trap of "well known shared secrets" described in Section 2.2, 616 this should be a pair wise secret. The most practical solution is to 617 use a session resumption ticket. This requires that prior to the 618 tunneling attempt, the client establishes regular connections with 619 the fronting service and obtains one or several session resumption 620 tickets. 622 6. SNI encryption with combined tickets 624 EDITOR'S NOTE: This section is an alternative design to Section 5. 625 As the draft progresses, only one of the alternatives will be 626 selected, and the text corresponding to the other alternative will be 627 deleted. 629 We propose to provide SNI Privacy by relying solely on "combined 630 tickets". The big advantage of this design compared to previous 631 attempts is that it requires only minimal changes to implementations 632 of TLS 1.3. These changes are confined to the handling of the 633 combined ticket by Fronting and Hidden service, and to the signaling 634 of the Fronting SNI to the client by the Hidden service. 636 6.1. Session resumption with combined tickets 638 In this example, the client obtains a combined session resumption 639 ticket during a previous connection to the hidden service, and has 640 learned the SNI of the fronting service. The session resumption will 641 happen as follows: 643 Client Fronting Service Hidden Service 644 ClientHello 645 + early_data 646 + key_share* 647 + psk_key_exchange_modes 648 + pre_shared_key 649 + SNI = fronting 650 --------> 651 // Decode the ticket 652 // Forwards to hidden 653 ClientHello -------> 655 (Application Data*) ----------------------> 656 ServerHello 657 + pre_shared_key 658 + key_share* 659 {EncryptedExtensions} 660 + early_data* 661 {Finished} 662 <---------------------- [Application Data] 663 (EndOfEarlyData) 664 {Finished} ----------------------> 666 [Application Data] <---------------------> [Application Data] 668 + Indicates noteworthy extensions sent in the 669 previously noted message. 670 * Indicates optional or situation-dependent 671 messages/extensions that are not always sent. 672 () encrypted with Client->Hidden 0-RTT key 673 {} encrypted with Client->Hidden 1-RTT handshake 674 [] encrypted with Client->Hidden 1-RTT key 676 The Fronting server that receives the Client Hello will find the 677 combined ticket in the pre_shared_key extensions, just as it would in 678 a regular session resumption attempt. When parsing the ticket, the 679 Fronting server will discover that the session really is meant to be 680 resumed with the Hidden server. It will arrange for all the 681 connection data to be forwarded to the Hidden server, including 682 forwarding a copy of the initial Client Hello. 684 The Hidden server will receive the Client Hello. It will obtain the 685 identity of the Fronting service from the SNI parameter. It will 686 then parse the session resumption ticket, and proceed with the 687 resumption of the session. 689 In this design, the Client Hello message is relayed unchanged from 690 Fronting server to hidden server. This ensures that code changes are 691 confined to the interpretation of the message parameters. The 692 construction of handshake contexts is left unchanged. 694 6.2. New Combined Session Ticket 696 In normal TLS 1.3 operations, the server can send New Session Ticket 697 messages at any time after the receiving the Client Finished message. 698 The ticket structure is defined in TLS 1.3 as: 700 struct { 701 uint32 ticket_lifetime; 702 uint32 ticket_age_add; 703 opaque ticket_nonce<1..255>; 704 opaque ticket<1..2^16-1>; 705 Extension extensions<0..2^16-2>; 706 } NewSessionTicket; 708 When SNI encryption is enabled, tickets will carry a "Fronting SNI" 709 extension, and the ticket value itself will be negotiated between 710 Fronting Service and Hidden Service, as in: 712 Client Fronting Service Hidden Service 714 <======= 715 Combined Ticket =======> 716 [New Session Ticket 717 <------------------------ + SNI Extension] 719 <==> sent on connection between Hidden and Fronting service 720 <> encrypted with Fronting<->Hidden key 721 [] encrypted with Client->Hidden 1-RTT key 723 In theory, the actual format of the ticket could be set by mutual 724 agreement between Fronting Service and Hidden Service. In practice, 725 it is probably better to provide guidance, as the ticket must meet 726 three requirements: 728 o The Fronting Server must understand enough of the combined ticket 729 to relay the connection towards the Hidden Server; 731 o The Hidden Server must understand enough of the combined ticket to 732 resume the session with the client; 734 o Third parties must not be able to deduce the name of the Hidden 735 Service from the value of the ticket. 737 There are three plausible designs, a stateful design, a shared key 738 design, and a 739 In the stateful design, the ticket are just random numbers that the 740 Fronting server associates with the Hidden server, and the Hidden 741 server associates with the session context. The shared key design 742 would work as follow: 744 o the hidden server and the fronting server share a symmetric key 745 K_sni. 747 o the "clear text" ticket includes a nonce, the ordinary ticket used 748 for session resumption by the hidden service, and the id of the 749 Hidden service for the Fronting Service. 751 o the ticket will be encrypted with AEAD, using the nonce as an IV. 753 o When the client reconnects to the fronting server, it decrypts the 754 ticket using K_sni and if it succeeds, then it just forwards the 755 Client Hello to the hidden server indicated in id-hidden-service 756 (which of course has to know to ignore SNI). Otherwise, it 757 terminates the connection itself with its own SNI. 759 The hidden server can just refresh the ticket any time it pleases, as 760 usual. 762 This design allows the Hidden Service to hide behind many Fronting 763 Services, each using a different key. The Client Hello received by 764 the Hidden Server carries the SNI of the Fronting Service, which the 765 Hidden Server can use to select the appropriate K_sni. 767 In the public key design, the Hidden Server encrypts the tickets with 768 a public key of the Fronting Server. The ticket itself would be 769 similar to what is used in the shared key design. The compute cost 770 for a single decryption may be higher, but the Fronting Server would 771 not need to blindly try multiple decryption keys associated with 772 multiple Hidden Servers. The Hidden Server would not be able to 773 decrypt the ession Tickets, which means that it would have to rely on 774 some kind of stateful storage. 776 6.3. First session 778 The previous sections present how sessions can be resumed with the 779 combined ticket. Clients have that have never contacted the Hidden 780 Server will need to obtain a first ticket during a first session. 781 The most plausible option is to have the client directly connect to 782 the Hidden Service, and then ask for a combined ticket. The obvious 783 issue is that the SNI will not be encrypted for this first 784 connection, which exposes the client to surveillance and censorship. 786 The client may also learn about the relation between Fronting Service 787 and Hidden Service through an out of band channel, such as DNS 788 service, or word of mouth. However, it is difficult to establish a 789 combined ticket completely out of band, since the ticket must be 790 associated to two shared secrets, one understood by the Fronting 791 service and the other shared with the Hidden service to ensure 792 protection against replay attacks. 794 An alternative may be to use the TLS-in-TLS service described in 795 Section 5.1 for the first contact. There will be some overhead due 796 to tunnelling, but as we discussed in Section 5.2.3 the tunneling 797 solution allows for safe first contact. Yet another way would be to 798 use the HTTPS in HTTPS tunneling described in Section 3.1. 800 7. Security Considerations 802 The encapsulation protocol proposed in this draft mitigates the known 803 attacks listed in Section 2. For example, the encapsulation design 804 uses pairwise security contexts, and is not dependent on the widely 805 shared secrets described in Section 2.2. The design also does not 806 rely on additional public key operations by the multiplexed server or 807 by the fronting server, and thus does not open the attack surface for 808 denial of service discussed in Section 2.3. The session keys are 809 negotiated end to end between the client and the protected service, 810 as required in Section 2.6. 812 The combined ticket solution also mitigates the known attacks. The 813 design also uses pairwise security contexts, and is not dependent on 814 the widely shared secrets described in Section 2.2. The design also 815 does not rely on additional public key operations by the multiplexed 816 server or by the fronting server, and thus does not open the attack 817 surface for denial of service discussed in Section 2.3. The session 818 keys are negotiated end to end between the client and the protected 819 service, as required in Section 2.6. 821 However, in some cases, proper mitigation depends on careful 822 implementation. 824 7.1. Replay attacks and side channels 826 Both solutions mitigate the replay attacks described in Section 2.1 827 because adversaries cannot decrypt the replies intended for the 828 client. However, the connection from the fronting service to the 829 hidden service can be observed through side channels. 831 To give an obvious example, suppose that the fronting service merely 832 relays the data by establishing a TCP connection to the hidden 833 service. An adversary capable of observing all network traffic at 834 the fronting server can associate the arrival of an encrypted message 835 to the fronting service and the TCP handshake between the fronting 836 server and the hidden service, and deduce which hidden service the 837 user accessed. 839 The mitigation of this attack relies on proper implementation of the 840 fronting service. This may require cooperation from the multiplexed 841 server. 843 7.2. Sticking out 845 The TLS encapsulation protocol mostly fulfills the requirements to 846 "not stick out" expressed in Section 2.4. The initial messages will 847 be sent as 0-RTT data, and will be encrypted using the 0-RTT key 848 negotiated with the fronting service. Adversaries cannot tell 849 whether the client is using TLS encapsulation or some other 0-RTT 850 service. However, this is only true if the fronting service 851 regularly uses 0-RTT data. 853 The combined token solution almost perfectly fulfills the 854 requirements to "not stick out" expressed in Section 2.4, as the 855 observable flow of message is almost exactly the same as a regular 856 TLS connection. However, adversaries could observe the values of the 857 PSK Identifier that contains the combined ticket. The proposed 858 ticket structure is designed to thwart analysis of the ticket, but if 859 implementations are not careful the size of the combined ticket can 860 be used as a side channel allowing adversaries to distinguish between 861 different Hidden Services located behind the same Fronting Service. 863 7.3. Forward Secrecy 865 In the TLS encapsulation protocol, the encapsulated Client Hello is 866 encrypted using the session resumption key. If this key is revealed, 867 the Client Hello data will also be revealed. The mitigation there is 868 to not use the same session resumption key multiple time. 870 The most common implementations of TLS tickets have the server using 871 Session Ticket Encryption Keys (STEKs) to create an encrypted copy of 872 the session parameters which is then stored by the client. When the 873 client resumes, it supplies this encrypted copy, the server decrypts 874 it, and has the parameters it needs to resume. The server need only 875 remember the STEK. If a STEK is disclosed to an adversary, then all 876 of the data encrypted by sessions protected by the STEK may be 877 decrypted by an adversary. 879 To mitigate this attack, server implementations of the combined 880 ticket protocol SHOULD use stateful tickets instead of STEK protected 881 TLS tickets. If they do rely on STEK protected tickets, they MUST 882 ensure that the K_sni keys used to encrypt these tickets are rotated 883 frequently. 885 8. IANA Considerations 887 Do we need to register an extension point? Or is it just OK to use 888 early data? 890 9. Acknowledgements 892 A large part of this draft originates in discussion of SNI encryption 893 on the TLS WG mailing list, including comments after the tunneling 894 approach was first proposed in a message to that list: 895 . 898 During the discussion of SNI Encryption in Yokohama, Deb Cooley 899 argued that rather than messing with TLS to allow SNI encryption, we 900 should just tunnel TLS in TLS. A number of people objected to this 901 on the grounds of the performance cost for the Fronting Server 902 because it has to encrypt and decrypt everything. 904 After the meeting, Martin Thomson suggested a modification to the 905 tunnelling proposal that removes this cost. The key observation is 906 that if we think of the 0-RTT flight as a separate message attached 907 to the handshake, then we can tunnel a second first flight in it. 909 The combined ticket approach was first proposed by Cedric Fournet and 910 Antoine Delignaut-Lavaud. 912 The delegation token design comes from many people, including Ben 913 Schwartz, Brian Sniffen and Rich Salz. 915 Thanks to Daniel Kahn Gillmor for a pretty detailed review of the 916 initial draft. 918 10. References 920 10.1. Normative References 922 [I-D.ietf-quic-tls] 923 Thomson, M. and S. Turner, "Using Transport Layer Security 924 (TLS) to Secure QUIC", draft-ietf-quic-tls-09 (work in 925 progress), January 2018. 927 [I-D.ietf-tls-dtls13] 928 Rescorla, E., Tschofenig, H., and N. Modadugu, "The 929 Datagram Transport Layer Security (DTLS) Protocol Version 930 1.3", draft-ietf-tls-dtls13-22 (work in progress), 931 November 2017. 933 [I-D.ietf-tls-tls13] 934 Rescorla, E., "The Transport Layer Security (TLS) Protocol 935 Version 1.3", draft-ietf-tls-tls13-23 (work in progress), 936 January 2018. 938 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 939 Requirement Levels", BCP 14, RFC 2119, 940 DOI 10.17487/RFC2119, March 1997, 941 . 943 10.2. Informative References 945 [I-D.hoffman-dns-over-https] 946 Hoffman, P. and P. McManus, "DNS Queries over HTTPS", 947 draft-hoffman-dns-over-https-01 (work in progress), June 948 2017. 950 [RFC2595] Newman, C., "Using TLS with IMAP, POP3 and ACAP", 951 RFC 2595, DOI 10.17487/RFC2595, June 1999, 952 . 954 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 955 (TLS) Protocol Version 1.2", RFC 5246, 956 DOI 10.17487/RFC5246, August 2008, 957 . 959 [RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 960 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 961 DOI 10.17487/RFC7540, May 2015, 962 . 964 [RFC7590] Saint-Andre, P. and T. Alkemade, "Use of Transport Layer 965 Security (TLS) in the Extensible Messaging and Presence 966 Protocol (XMPP)", RFC 7590, DOI 10.17487/RFC7590, June 967 2015, . 969 [RFC7858] Hu, Z., Zhu, L., Heidemann, J., Mankin, A., Wessels, D., 970 and P. Hoffman, "Specification for DNS over Transport 971 Layer Security (TLS)", RFC 7858, DOI 10.17487/RFC7858, May 972 2016, . 974 Authors' Addresses 976 Christian Huitema 977 Private Octopus Inc. 978 Friday Harbor WA 98250 979 U.S.A 981 Email: huitema@huitema.net 983 Eric Rescorla 984 RTFM, Inc. 985 U.S.A 987 Email: ekr@rtfm.com