idnits 2.17.1 draft-ietf-tls-sni-encryption-00.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 date (August 29, 2017) is 2429 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) == Outdated reference: A later version (-28) exists of draft-ietf-tls-tls13-21 -- Obsolete informational reference (is this intentional?): RFC 5246 (Obsoleted by RFC 8446) Summary: 0 errors (**), 0 flaws (~~), 2 warnings (==), 2 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: March 2, 2018 RTFM, Inc. 6 August 29, 2017 8 SNI Encryption in TLS Through Tunneling 9 draft-ietf-tls-sni-encryption-00.txt 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 http://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 March 2, 2018. 41 Copyright Notice 43 Copyright (c) 2017 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 (http://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 . . . . . . . . . . . . . . . . . . . . . . . . 2 59 1.1. Key Words . . . . . . . . . . . . . . . . . . . . . . . . 3 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 . . . . . . . 4 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. SNI Encapsulation Specification . . . . . . . . . . . . . . . 8 72 4.1. Tunneling TLS in TLS . . . . . . . . . . . . . . . . . . 9 73 4.2. Tunneling design issues . . . . . . . . . . . . . . . . . 11 74 4.2.1. Fronting Server logic . . . . . . . . . . . . . . . . 12 75 4.2.2. Early data . . . . . . . . . . . . . . . . . . . . . 13 76 4.2.3. Client requirements . . . . . . . . . . . . . . . . . 13 77 5. SNI encryption with combined tickets . . . . . . . . . . . . 13 78 5.1. Session resumption with combined tickets . . . . . . . . 14 79 5.2. New Combined Session Ticket . . . . . . . . . . . . . . . 16 80 5.3. First session . . . . . . . . . . . . . . . . . . . . . . 18 81 6. Security Considerations . . . . . . . . . . . . . . . . . . . 19 82 6.1. Replay attacks and side channels . . . . . . . . . . . . 19 83 6.2. Sticking out . . . . . . . . . . . . . . . . . . . . . . 20 84 6.3. Forward Secrecy . . . . . . . . . . . . . . . . . . . . . 20 85 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 20 86 8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 21 87 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 21 88 9.1. Normative References . . . . . . . . . . . . . . . . . . 21 89 9.2. Informative References . . . . . . . . . . . . . . . . . 21 90 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 22 92 1. Introduction 94 Historically, adversaries have been able to monitor the use of web 95 services through three channels: looking at DNS requests, looking at 96 IP addresses in packet headers, and looking at the data stream 97 between user and services. These channels are getting progressively 98 closed. A growing fraction of Internet communication is encrypted, 99 mostly using Transport Layer Security (TLS) [RFC5246]. Progressive 100 deployment of solutions like DNS in TLS [RFC7858] mitigates the 101 disclosure of DNS information. More and more services are colocated 102 on multiplexed servers, loosening the relation between IP address and 103 web service. However, multiplexed servers rely on the Service Name 104 Information (SNI) to direct TLS connections to the appropriate 105 service implementation. This protocol element is transmitted in 106 clear text. As the other methods of monitoring get blocked, 107 monitoring focuses on the clear text SNI. The purpose of SNI 108 encryption is to prevent that. 110 In the past, there have been multiple attempts at defining SNI 111 encryption. These attempts have generally floundered, because the 112 simple designs fail to mitigate several of the attacks listed in 113 Section 2. In the absence of a TLS level solution, the most popular 114 approach to SNI privacy is HTTP level fronting, which we discuss in 115 Section 3. 117 The current draft proposes two designs for SNI Encryption in TLS. 118 Both designs hide a "Hidden Service" behind a "Fronting Service". To 119 an external observer, the TLS connections will appear to be directed 120 towards the Fronting Service. The cleartext SNI parameter will 121 document the Fronting Service. A second SNI parameter will be 122 transmitted in an encrypted form to the Fronting Service, and will 123 allow that service to redirect the connection towards the Hidden 124 Service. 126 The first design relies on tunneling TLS in TLS, as explained in 127 Section 4. It does not require TLS extensions, but relies on 128 conventions in the implementation of TLS 1.3 [I-D.ietf-tls-tls13] by 129 the Client and the Fronting Server. 131 The second design, presented in Section 5 removes the requirement for 132 tunneling, on simply relies on Combined Tickets. It uses the 133 extension process for session tickets already defined in 134 [I-D.ietf-tls-tls13]. 136 This draft is presented as is to trigger discussions. It is expected 137 that as the draft progresses, only one of the two proposed solutions 138 will be retained. 140 1.1. Key Words 142 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 143 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 144 document are to be interpreted as described in [RFC2119]. 146 2. Security and Privacy Requirements for SNI Encryption 148 Over the past years, there have been multiple proposals to add an SNI 149 encryption option in TLS. Many of these proposals appeared 150 promising, but were rejected after security reviews pointed plausible 151 attacks. In this section, we collect a list of these known attacks. 153 2.1. Mitigate Replay Attacks 155 The simplest SNI encryption designs replace in the initial TLS 156 exchange the clear text SNI with an encrypted value, using a key 157 known to the multiplexed server. Regardless of the encryption used, 158 these designs can be broken by a simple replay attack, which works as 159 follow: 161 1- The user starts a TLS connection to the multiplexed server, 162 including an encrypted SNI value. 164 2- The adversary observes the exchange and copies the encrypted SNI 165 parameter. 167 3- The adversary starts its own connection to the multiplexed server, 168 including in its connection parameters the encrypted SNI copied from 169 the observed exchange. 171 4- The multiplexed server establishes the connection to the protected 172 service, thus revealing the identity of the service. 174 One of the goals of SNI encryption is to prevent adversaries from 175 knowing which Hidden Service the client is using. Successful replay 176 attacks breaks that goal by allowing adversaries to discover that 177 service. 179 2.2. Avoid Widely Shared Secrets 181 It is easy to think of simple schemes in which the SNI is encrypted 182 or hashed using a shared secret. This symmetric key must be known by 183 the multiplexed server, and by every users of the protected services. 184 Such schemes are thus very fragile, since the compromise of a single 185 user would compromise the entire set of users and protected services. 187 2.3. Prevent SNI-based Denial of Service Attacks 189 Encrypting the SNI may create extra load for the multiplexed server. 190 Adversaries may mount denial of service attacks by generating random 191 encrypted SNI values and forcing the multiplexed server to spend 192 resources in useless decryption attempts. 194 It may be argued that this is not an important DOS avenue, as regular 195 TLS connection attempts also require the server to perform a number 196 of cryptographic operations. However, in many cases, the SNI 197 decryption will have to be performed by a front end component with 198 limited resources, while the TLS operations are performed by the 199 component dedicated to their respective services. SNI based DOS 200 attacks could target the front end component. 202 2.4. Do not stick out 204 In some designs, handshakes using SNI encryption can be easily 205 differentiated from "regular" handshakes. For example, some designs 206 require specific extensions in the Client Hello packets, or specific 207 values of the clear text SNI parameter. If adversaries can easily 208 detect the use of SNI encryption, they could block it, or they could 209 flag the users of SNI encryption for special treatment. 211 In the future, it might be possible to assume that a large fraction 212 of TLS handshakes use SNI encryption. If that was the case, the 213 detection of SNI encryption would be a lesser concern. However, we 214 have to assume that in the near future, only a small fraction of TLS 215 connections will use SNI encryption. 217 2.5. Forward Secrecy 219 The general concerns about forward secrecy apply to SNI encryption 220 just as well as to regular TLS sessions. For example, some proposed 221 designs rely on a public key of the multiplexed server to define the 222 SNI encryption key. If the corresponding private key was 223 compromised, the adversaries would be able to process archival 224 records of past connections, and retrieve the protected SNI used in 225 these connections. These designs failed to maintain forward secrecy 226 of SNI encryption. 228 2.6. Proper Security Context 230 We can design solutions in which the multiplexed server or a fronting 231 service act as a relay to reach the protected service. Some of those 232 solutions involve just one TLS handshake between the client and the 233 multiplexed server, or between the client and the fronting service. 234 The master secret is verified by verifying a certificate provided by 235 either of these entities, but not by the protected service. 237 These solutions expose the client to a Man-In-The-Middle attack by 238 the multiplexed server or by the fronting service. Even if the 239 client has some reasonable trust in these services, the possibility 240 of MITM attack is troubling. 242 The multiplexed server or the fronting services could be pressured by 243 adversaries. By design, they could be forced to deny access to the 244 protected service, or to divulge which client accessed it. But if 245 MITM is possible, the adversaries would also be able to pressure them 246 into intercepting or spoofing the communications between client and 247 protected service. 249 2.7. Fronting Server Spoofing 251 Adversaries could mount an attack by spoofing the Fronting Service. 252 A spoofed Fronting Service could act as a "honeypot" for users of 253 hidden services. At a minimum, the fake server could record the IP 254 addresses of these users. If the SNI encryption solution places too 255 much trust on the fronting server, the fake server could also serve 256 fake content of its own choosing, including various forms of malware. 258 There are two main channels by which adversaries can conduct this 259 attack. Adversaries can simply try to mislead users into believing 260 that the honeypot is a valid Fronting Server, especially if that 261 information is carried by word of mouth or in unprotected DNS 262 records. Adversaries can also attempt to hijack the traffic to the 263 regular Fronting Server, using for example spoofed DNS responses or 264 spoofed IP level routing, combined with a spoofed certificate. 266 3. HTTP Co-Tenancy Fronting 268 In the absence of TLS level SNI encryption, many sites rely on an 269 "HTTP Co-Tenancy" solution. The TLS connection is established with 270 the fronting server, and HTTP requests are then sent over that 271 connection to the hidden service. For example, the TLS SNI could be 272 set to "fronting.example.com", the fronting server, and HTTP requests 273 sent over that connection could be directed to "hidden.example.com/ 274 some-content", accessing the hidden service. This solution works 275 well in practice when the fronting server and the hidden server are 276 'co-tenant" of the same multiplexed server. 278 The HTTP fronting solution can be deployed without modification to 279 the TLS protocol, and does not require using and specific version of 280 TLS. There are however a few issues regarding discovery, client 281 implementations, trust, and applicability: 283 o The client has to discover that the hidden service can be accessed 284 through the fronting server. 286 o The client browser's has to be directed to access the hidden 287 service through the fronting service. 289 o Since the TLS connection is established with the fronting service, 290 the client has no proof that the content does in fact come from 291 the hidden service. The solution does thus not mitigate the 292 context sharing issues described in Section 2.6. 294 o Since this is an HTTP level solution, it would not protected non 295 HTTP protocols such as DNS over TLS [RFC7858] or IMAP over TLS 296 [RFC2595]. 298 The discovery issue is common to pretty much every SNI encryption 299 solution, and is also discussed in Section 4.2.3 and Section 5.3. 300 The browser issue may be solved by developing a browser extension 301 that support HTTP Fronting, and manages the list of fronting services 302 associated with the hidden services that the client uses. The multi- 303 protocol issue can be mitigated by using implementation of other 304 applications over HTTP, such as for example DNS over HTTPS 305 [I-D.hoffman-dns-over-https]. The trust issue, however, requires 306 specific developments. 308 3.1. HTTPS Tunnels 310 The HTTP Fronting solution places a lot of trust in the Fronting 311 Server. This required trust can be reduced by tunnelling HTTPS in 312 HTTPS, which effectively treats the Fronting Server as an HTTP Proxy. 313 In this solution, the client establishes a TLS connection to the 314 Fronting Server, and then issues an HTTP Connect request to the 315 Hidden Server. This will establish an end-to-end HTTPS over TLS 316 connection between the client and the Hidden Server, mitigating the 317 issues described in Section 2.6. 319 The HTTPS in HTTPS solution requires double encryption of every 320 packet. It also requires that the fronting server decrypts and relay 321 messages to the hidden server. Both of these requirements make the 322 implementation onerous. 324 3.2. Delegation Token 326 Clients would see their privacy compromised if they contacted the 327 wrong fronting server to access the hidden service, since this wrong 328 server could disclose their access to adversaries. This can possibly 329 be mitigated by recording the relation between fronting server and 330 hidden server in a Delegation Token. 332 The delegation token would be a form of certificate, signed by the 333 hidden service. It would have the following components: 335 o The DNS name of the fronting service 336 o TTL (i.e. expiration date) 338 o An indication of the type of access that would be used, such as 339 direct fronting in which the hidden content is directly served by 340 the fronting server, or HTTPS in HTTPS, or one of the TLS level 341 solutions discussed in Section 4 and Section 5 343 o Triple authentication, to make the barrier to setting up a 344 honeypot extremely high 346 1. Cert chain for hidden server certificate (e.g., 347 hidden.example.com) up to CA. 349 2. Certificate transparency proof of the hidden service 350 certificate (hidden.example.com) from a popular log, with a 351 requirement that the browser checks the proof before 352 connecting. 354 3. A TLSA record for hidden service domain name 355 (hidden.example.com), with full DNSSEC chain (also mandatory 356 to check) 358 o Possibly, a list of valid addresses of the fronting service. 360 o Some extension mechanism for other bits 362 If N multiple domains on a CDN are acceptable fronts, then we may 363 want some way to indicate this without publishing and maintaining N 364 separate tokens. 366 Delegation tokens could be published by the fronting server, in 367 response for example to a specific query by a client. The client 368 would then examine whether one of the Delegation Tokens matches the 369 hidden service that it wants to access. 371 QUESTION: Do we need a revocation mechanism? What if a fronting 372 service obtains a delegation token, and then becomes untrustable for 373 some other reason? Or is it sufficient to just use short TTL? 375 4. SNI Encapsulation Specification 377 We propose to provide SNI Privacy by using a form of TLS 378 encapsulation. The big advantage of this design compared to previous 379 attempts is that it requires effectively no changes to TLS 1.3. It 380 only requires a way to signal to the Fronting Server server that the 381 encrypted application data is actually a ClientHello which is 382 intended for the hidden service. Once the tunneled session is 383 established, encrypted packets will be forwarded to the Hidden 384 Service without requiring encryption or decryption by the Fronting 385 Service. 387 4.1. Tunneling TLS in TLS 389 The proposed design is to encapsulate a second Client Hello in the 390 early data of a TLS connection to the Fronting Service. To the 391 outside, it just appears that the client is resuming a session with 392 the fronting service. 394 Client Fronting Service Hidden Service 396 ClientHello 398 + early_data 400 + key_share* 402 + psk_key_exchange_modes 404 + pre_shared_key 406 + SNI = fronting 408 ( 410 //Application data 412 ClientHello#2 414 + KeyShare 416 + signature_algorithms* 418 + psk_key_exchange_modes* 420 + pre_shared_key* 422 + SNI = hidden 424 ) 426 --------> 428 ClientHello#2 430 + KeyShare 431 + signature_algorithms* 433 + psk_key_exchange_modes* 435 + pre_shared_key* 437 + SNI = hidden ----> 439 441 --------------------> 443 ServerHello 445 + pre_shared_key 447 + key_share* 449 {EncryptedExtensions} 451 {CertificateRequest*} 453 {Certificate*} 455 {CertificateVerify*} 457 {Finished} 459 <-------------------- 461 {Certificate*} 463 {CertificateVerify*} 465 {Finished} --------------------- 467 [Application Data] <-------------------> [Application Data] 469 Key to brackets: 471 * optional messages, not present in all scenarios 473 () encrypted with Client->Fronting 0-RTT key 475 <> encrypted with Client->Hidden 0-RTT key 477 {} encrypted with Client->Hidden 1-RTT handshake 479 [] encrypted with Client->Hidden 1-RTT key 481 The way this works is that the Fronting Server decrypts the _data_ in 482 the client's first flight, which is actually ClientHello#2 from the 483 client, containing the true SNI and then passes it on to the Hidden 484 server. However, the Hidden Server responds with its own ServerHello 485 which the Fronting Server just passes unchanged, because it's 486 actually the response to ClientHello#2 rather than to ClientHello#1. 487 As long as ClientHello#1 and ClientHello#2 are similar (e.g., 488 differing only in the client's actual share (though of course it must 489 be in the same group)), SNI, and maybe EarlyDataIndication), then an 490 attacker should not be able to distinguish these cases -- although 491 there may be possible attacks through timing analysis, or by 492 observing traffic between the Fronting Server and Hidden Server if 493 they are not colocated. 495 4.2. Tunneling design issues 497 The big advantage of this design is that it requires effectively no 498 changes to TLS. It only requires a way to signal to the Fronting 499 Server that the encrypted application data is actually a ClientHello 500 which is intended for the hidden service. 502 The major disadvantage of this overall design strategy (however it's 503 signaled) is that it's somewhat harder to implement in the co- 504 tenanted cases than the simple schemes that carry the "real SNI" in 505 an encrypted parameter of the Client Hello. That means that it's 506 somewhat less likely that servers will implement it "by default" and 507 more likely that they will have to take explicit effort to allow 508 Encrypted SNI. Conversely, however, these schemes (aside from a 509 server with a single wildcard or multi-SAN cert) involve more changes 510 to TLS to deal with issues like "what is the server cert that is 511 digested into the keys", and that requires more analysis, so there is 512 an advantage to deferring that. If we have EncryptedExtensions in 513 the client's first flight it would be possible to define a "Real SNI" 514 extension later if/when we had clearer analysis for that case. 516 Notes on several obvious technical issues: 518 1. How does the Fronting Server distinguish this case from where the 519 initial flight is actual application data? See Section 4.2.1 for 520 some thoughts on this. 522 2. Can we make this work with 0-RTT data from the client to the 523 Hidden server? The answer is probably yes, as discussed in 524 Section 4.2.2. 526 3. What happens if the Fronting Server doesn't gateway, e.g., 527 because it has forgotten the ServerConfiguration? In that case, 528 the client gets a handshake with the Fronting Server, which it 529 will have to determine via trial decryption. At this point the 530 Fronting Server supplies a ServerConfiguration and the client can 531 reconnect as above. 533 4. What happens if the client does 0-RTT inside 0-RTT (as in #2 534 above) and the Hidden server doesn't recognize the 535 ServerConfiguration in ClientHello#2? In this case, the client 536 gets a 0-RTT rejection and it needs to do trial decryption to 537 know whether the rejection was from the Fronting Server or the 538 Hidden server. 540 5. What happens if the Fronting Server is under a DOS attack, and 541 chooses to refuse all 0-RTT data? 543 The client part of that logic, including the handling of question #3 544 above, is discussed in Section 4.2.3. 546 4.2.1. Fronting Server logic 548 The big advantage of this design is that it requires effectively no 549 changes to TLS. It only requires a way to signal to the Fronting 550 Server that the encrypted application data is actually a ClientHello 551 which is intended for the hidden service. The two most obvious 552 designs are: 554 o Have an EncryptedExtension which indicates that the inner data is 555 tunnelled. 557 o Have a "tunnelled" TLS content type. 559 EncryptedExtensions would be the most natural, but they were removed 560 from the ClientHello during the TLS standardization. In Section 4.1 561 we assume that the second ClientHello is just transmitted as 0-RTT 562 data, and that the servers use some form of pattern matching to 563 differentiate between this second ClientHello and other application 564 messages. 566 4.2.2. Early data 568 In the proposed design, the second ClientHello is sent to the 569 Fronting Server as early data, encrypted with Client->Fronting 0-RTT 570 key. If the Client follows the second ClientHello with 0-RTT data, 571 that data could in theory be sent in two ways: 573 1. The client could use double encryption. The data is first 574 encrypted with the Client->Hidden 0-RTT key, then wrapped and 575 encrypted with the Client->Fronting 0-RTT key. The Fronting 576 server would decrypt, unwrap and relay. 578 2. The client could just encrypt the data with the Client->Hidden 579 0-RTT key, and ask the server to blindly relay it. 581 Each of these ways has its issues. The double encryption scenario 582 would require two end of early data messages, one double encrypted 583 and relayed by the Fronting Server to the Hidden Server, and another 584 sent from Client to Fronting Server, to delimit the end of the double 585 encrypted stream, and also to ensure that the stream of messages is 586 not distinguishable from simply sending 0-RTT data to the Fronting 587 server. The blind relaying is simpler, and is the scenario described 588 in the diagram of Section 4.1. In that scenario, the Fronting server 589 switches to relaying mode immediately after unwrapping and forwarding 590 the second ClientHello. However, the blind relaying requires the 591 ClientHello to be isolated to a single record. 593 4.2.3. Client requirements 595 In order to use the tunneling service, the client needs to identify 596 the Fronting Service willing to tunnel to the Hidden Service. We can 597 assume that the client will learn the identity of suitable Fronting 598 Services from the Hidden Service itself. 600 In order to tunnel the second ClientHello as 0-RTT data, the client 601 needs to have a shared secret with the Fronting Service. To avoid 602 the trap of "well known shared secrets" described in Section 2.2, 603 this should be a pair wise secret. The most practical solution is to 604 use a session resumption ticket. This requires that prior to the 605 tunneling attempt, the client establishes regular connections with 606 the fronting service and obtains one or several session resumption 607 tickets. 609 5. SNI encryption with combined tickets 611 EDITOR'S NOTE: This section is an alternative design to Section 4. 612 As the draft progresses, only one of the alternatives will be 613 selected, and the text corresponding to the other alternative will be 614 deleted. 616 We propose to provide SNI Privacy by relying solely on "combined 617 tickets". The big advantage of this design compared to previous 618 attempts is that it requires only minimal changes to implementations 619 of TLS 1.3. These changes are confined to the handling of the 620 combined ticket by Fronting and Hidden service, and to the signaling 621 of the Fronting SNI to the client by the Hidden service. 623 5.1. Session resumption with combined tickets 625 In this example, the client obtains a combined session resumption 626 ticket during a previous connection to the hidden service, and has 627 learned the SNI of the fronting service. The session resumption will 628 happen as follows: 630 Client Fronting Service Hidden Service 632 ClientHello 634 + early_data 636 + key_share* 638 + psk_key_exchange_modes 640 + pre_shared_key 642 + SNI = fronting 644 --------> 646 // Decode the ticket 648 // Forwards to hidden 650 ClientHello -------> 652 (Application Data*) ----------------------> 654 ServerHello 656 + pre_shared_key 657 + key_share* 659 {EncryptedExtensions} 661 + early_data* 663 {Finished} 665 <---------------------- [Application Data] 667 (EndOfEarlyData) 669 {Finished} ----------------------> 671 [Application Data] <---------------------> [Application Data] 673 + Indicates noteworthy extensions sent in the 675 previously noted message. 677 * Indicates optional or situation-dependent 679 messages/extensions that are not always sent. 681 () encrypted with Client->Hidden 0-RTT key 683 {} encrypted with Client->Hidden 1-RTT handshake 685 [] encrypted with Client->Hidden 1-RTT key 687 The Fronting server that receives the Client Hello will find the 688 combined ticket in the pre_shared_key extensions, just as it would in 689 a regular session resumption attempt. When parsing the ticket, the 690 Fronting server will discover that the session really is meant to be 691 resumed with the Hidden server. It will arrange for all the 692 connection data to be forwarded to the Hidden server, including 693 forwarding a copy of the initial Client Hello. 695 The Hidden server will receive the Client Hello. It will obtain the 696 identity of the Fronting service from the SNI parameter. It will 697 then parse the session resumption ticket, and proceed with the 698 resumption of the session. 700 In this design, the Client Hello message is relayed unchanged from 701 Fronting server to hidden server. This ensures that code changes are 702 confined to the interpretation of the message parameters. The 703 construction of handshake contexts is left unchanged. 705 5.2. New Combined Session Ticket 707 In normal TLS 1.3 operations, the server can send New Session Ticket 708 messages at any time after the receiving the Client Finished message. 709 The ticket structure is defined in TLS 1.3 as: 711 struct { 713 uint32 ticket_lifetime; 715 uint32 ticket_age_add; 717 opaque ticket_nonce<1..255>; 719 opaque ticket<1..2^16-1>; 721 Extension extensions<0..2^16-2>; 723 } NewSessionTicket; 725 When SNI encryption is enabled, tickets will carry a "Fronting SNI" 726 extension, and the ticket value itself will be negotiated between 727 Fronting Service and Hidden Service, as in: 729 Client Fronting Service Hidden Service 731 <======= 733 Combined Ticket =======> 735 [New Session Ticket 737 <------------------------ + SNI Extension] 739 <==> sent on connection between Hidden and Fronting service 741 <> encrypted with Fronting<->Hidden key 743 [] encrypted with Client->Hidden 1-RTT key 745 In theory, the actual format of the ticket could be set by mutual 746 agreement between Fronting Service and Hidden Service. In practice, 747 it is probably better to provide guidance, as the ticket must meet 748 three requirements: 750 o The Fronting Server must understand enough of the combined ticket 751 to relay the connection towards the Hidden Server; 753 o The Hidden Server must understand enough of the combined ticket to 754 resume the session with the client; 756 o Third parties must not be able to deduce the name of the Hidden 757 Service from the value of the ticket. 759 There are three plausible designs, a stateful design, a shared key 760 design, and a 762 In the stateful design, the ticket are just random numbers that the 763 Fronting server associates with the Hidden server, and the Hidden 764 server associates with the session context. The shared key design 765 would work as follow: 767 o the hidden server and the fronting server share a symmetric key 768 K_sni. 770 o the "clear text" ticket includes a nonce, the ordinary ticket used 771 for session resumption by the hidden service, and the id of the 772 Hidden service for the Fronting Service. 774 o the ticket will be encrypted with AEAD, using the nonce as an IV. 776 o When the client reconnects to the fronting server, it decrypts the 777 ticket using K_sni and if it succeeds, then it just forwards the 778 Client Hello to the hidden server indicated in id-hidden-service 779 (which of course has to know to ignore SNI). Otherwise, it 780 terminates the connection itself with its own SNI. 782 The hidden server can just refresh the ticket any time it pleases, as 783 usual. 785 This design allows the Hidden Service to hide behind many Fronting 786 Services, each using a different key. The Client Hello received by 787 the Hidden Server carries the SNI of the Fronting Service, which the 788 Hidden Server can use to select the appropriate K_sni. 790 In the public key design, the Hidden Server encrypts the tickets with 791 a public key of the Fronting Server. The ticket itself would be 792 similar to what is used in the shared key design. The compute cost 793 for a single decryption may be higher, but the Fronting Server would 794 not need to blindly try multiple decryption keys associated with 795 multiple Hidden Servers. The Hidden Server would not be able to 796 decrypt the ession Tickets, which means that it would have to rely on 797 some kind of stateful storage. 799 5.3. First session 801 The previous sections present how sessions can be resumed with the 802 combined ticket. Clients have that have never contacted the Hidden 803 Server will need to obtain a first ticket during a first session. 804 The most plausible option is to have the client directly connect to 805 the Hidden Service, and then ask for a combined ticket. The obvious 806 issue is that the SNI will not be encrypted for this first 807 connection, which exposes the client to surveillance and censorship. 809 The client may also learn about the relation between Fronting Service 810 and Hidden Service through an out of band channel, such as DNS 811 service, or word of mouth. However, it is difficult to establish a 812 combined ticket completely out of band, since the ticket must be 813 associated to two shared secrets, one understood by the Fronting 814 service and the other shared with the Hidden service to ensure 815 protection against replay attacks. 817 An alternative may be to use the TLS-in-TLS service described in 818 Section 4.1 for the first contact. There will be some overhead due 819 to tunnelling, but as we discussed in Section 4.2.3 the tunneling 820 solution allows for safe first contact. Yet another way would be to 821 use the HTTPS in HTTPS tunneling described in Section 3.1. 823 6. Security Considerations 825 The encapsulation protocol proposed in this draft mitigates the known 826 attacks listed in Section 2. For example, the encapsulation design 827 uses pairwise security contexts, and is not dependent on the widely 828 shared secrets described in Section 2.2. The design also does not 829 rely on additional public key operations by the multiplexed server or 830 by the fronting server, and thus does not open the attack surface for 831 denial of service discussed in Section 2.3. The session keys are 832 negotiated end to end between the client and the protected service, 833 as required in Section 2.6. 835 The combined ticket solution also mitigates the known attacks. The 836 design also uses pairwise security contexts, and is not dependent on 837 the widely shared secrets described in Section 2.2. The design also 838 does not rely on additional public key operations by the multiplexed 839 server or by the fronting server, and thus does not open the attack 840 surface for denial of service discussed in Section 2.3. The session 841 keys are negotiated end to end between the client and the protected 842 service, as required in Section 2.6. 844 However, in some cases, proper mitigation depends on careful 845 implementation. 847 6.1. Replay attacks and side channels 849 Both solutions mitigate the replay attacks described in Section 2.1 850 because adversaries cannot decrypt the replies intended for the 851 client. However, the connection from the fronting service to the 852 hidden service can be observed through side channels. 854 To give an obvious example, suppose that the fronting service merely 855 relays the data by establishing a TCP connection to the hidden 856 service. An adversary capable of observing all network traffic at 857 the fronting server can associate the arrival of an encrypted message 858 to the fronting service and the TCP handshake between the fronting 859 server and the hidden service, and deduce which hidden service the 860 user accessed. 862 The mitigation of this attack relies on proper implementation of the 863 fronting service. This may require cooperation from the multiplexed 864 server. 866 6.2. Sticking out 868 The TLS encapsulation protocol mostly fulfills the requirements to 869 "not stick out" expressed in Section 2.4. The initial messages will 870 be sent as 0-RTT data, and will be encrypted using the 0-RTT key 871 negotiated with the fronting service. Adversaries cannot tell 872 whether the client is using TLS encapsulation or some other 0-RTT 873 service. However, this is only true if the fronting service 874 regularly uses 0-RTT data. 876 The combined token solution almost perfectly fulfills the 877 requirements to "not stick out" expressed in Section 2.4, as the 878 observable flow of message is almost exactly the same as a regular 879 TLS connection. However, adversaries could observe the values of the 880 PSK Identifier that contains the combined ticket. The proposed 881 ticket structure is designed to thwart analysis of the ticket, but if 882 implementations are not careful the size of the combined ticket can 883 be used as a side channel allowing adversaries to distinguish between 884 different Hidden Services located behind the same Fronting Service. 886 6.3. Forward Secrecy 888 In the TLS encapsulation protocol, the encapsulated Client Hello is 889 encrypted using the session resumption key. If this key is revealed, 890 the Client Hello data will also be revealed. The mitigation there is 891 to not use the same session resumption key multiple time. 893 The most common implementations of TLS tickets have the server using 894 Session Ticket Encryption Keys (STEKs) to create an encrypted copy of 895 the session parameters which is then stored by the client. When the 896 client resumes, it supplies this encrypted copy, the server decrypts 897 it, and has the parameters it needs to resume. The server need only 898 remember the STEK. If a STEK is disclosed to an adversary, then all 899 of the data encrypted by sessions protected by the STEK may be 900 decrypted by an adversary. 902 To mitigate this attack, server implementations of the combined 903 ticket protocol SHOULD use stateful tickets instead of STEK protected 904 TLS tickets. If they do rely on STEK protected tickets, they MUST 905 ensure that the K_sni keys used to encrypt these tickets are rotated 906 frequently. 908 7. IANA Considerations 910 Do we need to register an extension point? Or is it just OK to use 911 early data? 913 8. Acknowledgements 915 A large part of this draft originates in discussion of SNI encryption 916 on the TLS WG mailing list, including comments after the tunneling 917 approach was first proposed in a message to that list: 918 . 921 During the discussion of SNI Encryption in Yokohama, Deb Cooley 922 argued that rather than messing with TLS to allow SNI encryption, we 923 should just tunnel TLS in TLS. A number of people objected to this 924 on the grounds of the performance cost for the Fronting Server 925 because it has to encrypt and decrypt everything. 927 After the meeting, Martin Thomson suggested a modification to the 928 tunnelling proposal that removes this cost. The key observation is 929 that if we think of the 0-RTT flight as a separate message attached 930 to the handshake, then we can tunnel a second first flight in it. 932 The combined ticket approach was first proposed by Cedric Fournet and 933 Antoine Delignaut-Lavaud. 935 The delegation token design comes from many people, including Ben 936 Schwartz, Brian Sniffen and Rich Salz. 938 Thanks to Daniel Kahn Gillmor for a pretty detailed review of the 939 initial draft. 941 9. References 943 9.1. Normative References 945 [I-D.ietf-tls-tls13] 946 Rescorla, E., "The Transport Layer Security (TLS) Protocol 947 Version 1.3", draft-ietf-tls-tls13-21 (work in progress), 948 July 2017. 950 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 951 Requirement Levels", BCP 14, RFC 2119, 952 DOI 10.17487/RFC2119, March 1997, . 955 9.2. Informative References 957 [I-D.hoffman-dns-over-https] 958 Hoffman, P. and P. McManus, "DNS Queries over HTTPS", 959 draft-hoffman-dns-over-https-01 (work in progress), June 960 2017. 962 [RFC2595] Newman, C., "Using TLS with IMAP, POP3 and ACAP", 963 RFC 2595, DOI 10.17487/RFC2595, June 1999, 964 . 966 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 967 (TLS) Protocol Version 1.2", RFC 5246, 968 DOI 10.17487/RFC5246, August 2008, . 971 [RFC7858] Hu, Z., Zhu, L., Heidemann, J., Mankin, A., Wessels, D., 972 and P. Hoffman, "Specification for DNS over Transport 973 Layer Security (TLS)", RFC 7858, DOI 10.17487/RFC7858, May 974 2016, . 976 Authors' Addresses 978 Christian Huitema 979 Private Octopus Inc. 980 Friday Harbor WA 98250 981 U.S.A 983 Email: huitema@huitema.net 985 Eric Rescorla 986 RTFM, Inc. 987 U.S.A 989 Email: ekr@rtfm.com