idnits 2.17.1 draft-huitema-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 -- The document date (July 2, 2017) is 2489 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-20 -- 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: January 3, 2018 RTFM, Inc. 6 July 2, 2017 8 SNI Encryption in TLS Through Tunneling 9 draft-huitema-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 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 January 3, 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 . . . . . . . . . . . . . . . . . 6 67 2.7. Fronting Server Spoofing . . . . . . . . . . . . . . . . 6 68 3. HTTP Co-Tenancy Fronting . . . . . . . . . . . . . . . . . . 7 69 3.1. HTTPS Tunnels . . . . . . . . . . . . . . . . . . . . . . 7 70 3.2. Delegation Token . . . . . . . . . . . . . . . . . . . . 8 71 4. SNI Encapsulation Specification . . . . . . . . . . . . . . . 9 72 4.1. Tunneling TLS in TLS . . . . . . . . . . . . . . . . . . 9 73 4.2. Tunneling design issues . . . . . . . . . . . . . . . . . 12 74 4.2.1. Gateway logic . . . . . . . . . . . . . . . . . . . . 13 75 4.2.2. Early data . . . . . . . . . . . . . . . . . . . . . 13 76 4.2.3. Client requirements . . . . . . . . . . . . . . . . . 14 77 5. SNI encryption with combined tickets . . . . . . . . . . . . 14 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 . . . . . . . . . . . . . . . . . . . . . . 19 84 6.3. Forward Secrecy . . . . . . . . . . . . . . . . . . . . . 20 85 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 20 86 8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 20 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 SNI encryption designs MUST mitigate this attack. 176 2.2. Avoid Widely Shared Secrets 178 It is easy to think of simple schemes in which the SNI is encrypted 179 or hashed using a shared secret. This symmetric key must be known by 180 the multiplexed server, and by every users of the protected services. 181 Such schemes are thus very fragile, since the compromise of a single 182 user would compromise the entire set of users and protected services. 184 SNI encryption designs MUST NOT rely on widely shared secrets. 186 2.3. Prevent SNI-based Denial of Service Attacks 188 Encrypting the SNI may create extra load for the multiplexed server. 189 Adversaries may mount denial of service attacks by generating random 190 encrypted SNI values and forcing the multiplexed server to spend 191 resources in useless decryption attempts. 193 It may be argued that this is not an important DOS avenue, as regular 194 TLS connection attempts also require the server to perform a number 195 of cryptographic operations. However, in many cases, the SNI 196 decryption will have to be performed by a front end component with 197 limited resources, while the TLS operations are performed by the 198 component dedicated to their respective services. SNI based DOS 199 attacks could target the front end component. 201 SNI encryption designs MUST mitigate the risk of denial of service 202 attacks through forced SNI decryption. 204 2.4. Do not stick out 206 In some designs, handshakes using SNI encryption can be easily 207 differentiated from "regular" handshakes. For example, some designs 208 require specific extensions in the Client Hello packets, or specific 209 values of the clear text SNI parameter. If adversaries can easily 210 detect the use of SNI encryption, they could block it, or they could 211 flag the users of SNI encryption for special treatment. 213 In the future, it might be possible to assume that a large fraction 214 of TLS handshakes use SNI encryption. If that was the case, the 215 detection of SNI encryption would be a lesser concern. However, we 216 have to assume that in the near future, only a small fraction of TLS 217 connections will use SNI encryption. 219 SNI encryption designs MUST minimize the observable differences 220 between the TLS handshakes that use SNI encryption and those that 221 don't. 223 2.5. Forward Secrecy 225 The general concerns about forward secrecy apply to SNI encryption 226 just as well as to regular TLS sessions. For example, some proposed 227 designs rely on a public key of the multiplexed server to define the 228 SNI encryption key. If the corresponding public key was compromised, 229 the adversaries would be able to process archival records of past 230 connections, and retrieve the protected SNI used in these 231 connections. These designs failed to maintain forward secrecy of SNI 232 encryption. 234 SNI encryption designs SHOULD provide forward secrecy for the 235 protected SNI. However, this may be very hard to achieve in 236 practice. Designs MAY compromise there, if they have other good 237 properties. 239 2.6. Proper Security Context 241 We can design solutions in which the multiplexed server or a fronting 242 service act as a relay to reach the protected service. Some of those 243 solutions involve just one TLS handshake between the client and the 244 multiplexed server, or between the client and the fronting service. 245 The master secret is verified by verifying a certificate provided by 246 either of these entities, but not by the protected service. 248 These solutions expose the client to a Man-In-The-Middle attack by 249 the multiplexed server or by the fronting service. Even if the 250 client has some reasonable trust in these services, the possibility 251 of MITM attack is troubling. 253 The multiplexed server or the fronting services could be pressured by 254 adversaries. By design, they could be forced to deny access to the 255 protected service, or to divulge which client accessed it. But if 256 MITM is possible, the adversaries would also be able to pressure them 257 into intercepting or spoofing the communications between client and 258 protected service. 260 SNI encryption designs MUST ensure that the master secret are 261 negotiated and verified "end to end", between client and protected 262 service. 264 2.7. Fronting Server Spoofing 266 Adversaries could mount an attack by spoofing the Fronting Service. 267 A spoofed Fronting Service could act as a "honeypot" for users of 268 hidden services. At a minimum, the fake server could record the IP 269 addresses of these users. If the SNI encryption solution places too 270 much trust on the fronting server, the fake server could also serve 271 fake content of its own choosing, including various forms of malware. 273 There are two main channels by which adversaries can conduct this 274 attack. Adversaries can simply try to mislead users into believing 275 that the honeypot is a valid Fronting Server, especially if that 276 information is carried by word of mouth or in unprotected DNS 277 records. Adversaries can also attempt to hijack the traffic to the 278 regular Fronting Server, using for example spoofed DNS responses or 279 spoofed IP level routing, combined with a spoofed certificate. 281 To mitigate this class of attacks, SNI encryption implementations 282 MUST ensure that the Fronting Servers are properly authenticated, and 283 SHOULD ensure that the relation between Hidden Services and Fronting 284 Services is obtained in a trustworthy manner. 286 3. HTTP Co-Tenancy Fronting 288 In the absence of TLS level SNI encryption, many sites rely on an 289 "HTTP Co-Tenancy" solution. The TLS connection is established with 290 the fronting server, and HTTP requests are then sent over that 291 connection to the hidden service. For example, the TLS SNI could be 292 set to "fronting.example.com", the fronting server, and HTTP requests 293 sent over that connection could be directed to "hidden.example.com/ 294 some-content", accessing the hidden service. This solution works 295 well in practice when the fronting server and the hidden server are 296 'co-tenant" of the same multiplexed server. 298 The HTTP fronting solution can be deployed without modification to 299 the TLS protocol, and does not require using and specific version of 300 TLS. There are however a few issues regarding discovery, client 301 implementations, trust, and applicability: 303 o The client has to discover that the hidden service can be accessed 304 through the fronting server. 306 o The client browser's has to be directed to access the hidden 307 service through the fronting service. 309 o Since the TLS connection is established with the fronting service, 310 the client has no proof that the content does in fact come from 311 the hidden service. The solution does thus not mitigate the 312 context sharing issues described in Section 2.6. 314 o Since this is an HTTP level solution, it would not protected non 315 HTTP protocols such as DNS over TLS [RFC7858] or IMAP over TLS 316 [RFC2595]. 318 The discovery issue is common to pretty much every SNI encryption 319 solution, and is also discussed in Section 4.2.3 and Section 5.3. 320 The browser issue may be solved by developing a browser extension 321 that support HTTP Fronting, and manages the list of fronting services 322 associated with the hidden services that the client uses. The multi- 323 protocol issue can be mitigated by using implementation of other 324 applications over HTTP, such as for example DNS over HTTPS 325 [I-D.hoffman-dns-over-https]. The trust issue, however, requires 326 specific developments such as HTTP tunnels or Delegation Tokens. 328 3.1. HTTPS Tunnels 330 The HTTP Fronting solution places a lot of trust in the Fronting 331 Server. This required trust can be reduced by tunnelling HTTPS in 332 HTTPS, which effectively treats the Fronting Server as an HTTP Proxy. 333 In this solution, the client establishes a TLS connection to the 334 Fronting Server, and then issues an HTTP Connect request to the 335 Hidden Server. This will effectively establish an end-to-end HTTPS 336 over TLS connection between the client and the Hidden Server, 337 mitigating the issues described in Section 2.6. 339 The HTTPS in HTTPS solution requires double encryption of every 340 packet. It also requires that the fronting server decrypts and relay 341 messages to the hidden server. Both of these requirements make the 342 implementation onerous. 344 3.2. Delegation Token 346 Clients would see their privacy compromised if they contacted the 347 wrong fronting server to access the hidden service, since this wrong 348 server could disclose their access to adversaries. This can possibly 349 be mitigated by recording the relation between fronting server and 350 hidden server in a Delegation Token. 352 The delegation token would be a form of certificate, signed by the 353 hidden service. It would have the following components: 355 o The DNS name of the fronting service 357 o TTL (i.e. expiration date) 359 o An indication of the type of access that would be used, such as 360 direct fronting in which the hidden content is directly served by 361 the fronting server, or HTTPS in HTTPS, or one of the TLS level 362 solutions discussed in Section 4 and Section 5 364 o Triple authentication, to make the barrier to setting up a 365 honeypot extremely high 367 1. Cert chain for hidden server certificate (e.g., 368 hidden.example.com) up to CA. 370 2. Certificate transparency proof of the hidden service 371 certificate (hidden.example.com) from a popular log, with a 372 requirement that the browser checks the proof before 373 connecting. 375 3. A TLSA record for hidden service domain name 376 (hidden.example.com), with full DNSSEC chain (also mandatory 377 to check) 379 o Possibly, a list of valid addresses of the fronting service. 381 o Some extension mechanism for other bits 382 If N multiple domains on a CDN are acceptable fronts, then we may 383 want some way to indicate this without publishing and maintaining N 384 separate tokens. 386 Delegation tokens could be published by the fronting server, in 387 response for example to a specific query by a client. The client 388 would then examine whether one of the Delegation Tokens matches the 389 hidden service that it wants to access. 391 QUESTION: Do we need a revocation mechanism? What if a fronting 392 service obtains a delegation token, and then becomes untrustable for 393 some other reason? Or is it sufficient to just use short TTL? 395 4. SNI Encapsulation Specification 397 We propose to provide SNI Privacy by using a form of TLS 398 encapsulation. The big advantage of this design compared to previous 399 attempts is that it requires effectively no changes to TLS 1.3. It 400 only requires a way to signal to the Gateway server that the 401 encrypted application data is actually a ClientHello which is 402 intended for the hidden service. Once the tunneled session is 403 established, encrypted packets will be forwarded to the Hidden 404 Service without requiring encryption or decryption by the Fronting 405 Service. 407 4.1. Tunneling TLS in TLS 409 The proposed design is to encapsulate a second Client Hello in the 410 early data of a TLS connection to the Fronting Service. To the 411 outside, it just appears that the client is resuming a session with 412 the fronting service. 414 Client Fronting Service Hidden Service 416 ClientHello 418 + early_data 420 + key_share* 422 + psk_key_exchange_modes 424 + pre_shared_key 426 + SNI = fronting 428 ( 429 //Application data 431 ClientHello#2 433 + KeyShare 435 + signature_algorithms* 437 + psk_key_exchange_modes* 439 + pre_shared_key* 441 + SNI = hidden 443 ) 445 --------> 447 ClientHello#2 449 + KeyShare 451 + signature_algorithms* 453 + psk_key_exchange_modes* 455 + pre_shared_key* 457 + SNI = hidden ----> 459 461 --------------------> 463 ServerHello 465 + pre_shared_key 467 + key_share* 469 {EncryptedExtensions} 471 {CertificateRequest*} 473 {Certificate*} 475 {CertificateVerify*} 477 {Finished} 479 <-------------------- 481 {Certificate*} 483 {CertificateVerify*} 485 {Finished} --------------------- 487 [Application Data] <-------------------> [Application Data] 489 Key to brackets: 491 * optional messages, not present in all scenarios 493 () encrypted with Client->Fronting 0-RTT key 495 <> encrypted with Client->Hidden 0-RTT key 497 {} encrypted with Client->Hidden 1-RTT handshake 499 [] encrypted with Client->Hidden 1-RTT key 501 The way this works is that the Gateway decrypts the _data_ in the 502 client's first flight, which is actually ClientHello#2 from the 503 client, containing the true SNI and then passes it on to the Hidden 504 server. However, the Hidden server responds with its own ServerHello 505 which the Gateway just passes unchanged, because it's actually the 506 response to ClientHello#2 rather than to ClientHello#1. As long as 507 ClientHello#1 and ClientHello#2 are similar (e.g., differing only in 508 the client's actual share (though of course it must be in the same 509 group)), SNI, and maybe EarlyDataIndication), then an attacker should 510 not be able to distinguish these cases. 512 4.2. Tunneling design issues 514 The big advantage of this design is that it requires effectively no 515 changes to TLS. It only requires a way to signal to the Fronting 516 Server that the encrypted application data is actually a ClientHello 517 which is intended for the hidden service. 519 The major disadvantage of this overall design strategy (however it's 520 signaled) is that it's somewhat harder to implement in the co- 521 tenanted cases than the most trivial "RealSNI" scheme. That means 522 that it's somewhat less likely that servers will implement it "by 523 default" and more likely that they will have to take explicit effort 524 to allow Encrypted SNI. Conversely, however, these modes (aside from 525 a server with a single wildcard or multi-SAN cert) involve more 526 changes to TLS to deal with issues like "what is the server cert that 527 is digested into the keys", and that requires more analysis, so there 528 is an advantage to deferring that. If we have EncryptedExtensions in 529 the client's first flight it would be possible to add RealSNI later 530 if/when we had clearer analysis for that case. 532 Notes on several obvious technical issues: 534 1. How does the Fronting Server distinguish this case from where the 535 initial flight is actual application data? See Section 4.2.1 for 536 some thoughts on this. 538 2. Can we make this work with 0-RTT data from the client to the 539 Hidden server? The answer is probably yes, as discussed in 540 Section 4.2.2. 542 3. What happens if the Fronting Server doesn't gateway, e.g., 543 because it has forgotten the ServerConfiguration? In that case, 544 the client gets a handshake with the Gateway, which it will have 545 to determine via trial decryption. At this point the Gateway 546 supplies a ServerConfiguration and the client can reconnect as 547 above. 549 4. What happens if the client does 0-RTT inside 0-RTT (as in #2 550 above) and the Hidden server doesn't recognize the 551 ServerConfiguration in ClientHello#2? In this case, the client 552 gets a 0-RTT rejection and it needs to do trial decryption to 553 know whether the rejection was from the Gateway or the Hidden 554 server. 556 The client part of that logic, including the handling of question #3 557 above, is discussed in Section 4.2.3. 559 4.2.1. Gateway 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 4.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 4.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 requires 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 delimitate the end of these 598 double encrypted stream, and also to ensure that the stream of 599 messages is not distinguishable from simply sending 0-RTT data to the 600 Fronting server. The blind relaying is simpler, and is the scenario 601 described in the diagram of Section 4.1. In that scenario, the 602 Fronting server switches to relaying mode immediately after 603 unwrapping and forwarding the second ClientHello. 605 4.2.3. Client requirements 607 In order to use the tunneling service, the client needs to identify 608 the Fronting Service willing to tunnel to the Hidden Service. We can 609 assume that the client will learn the identity of suitable Fronting 610 Services from the Hidden Service itself. 612 In order to tunnel the second ClientHello as 0-RTT data, the client 613 needs to have a shared secret with the Fronting Service. To avoid 614 the trap of "well known shared secrets" described in Section 2.2, 615 this should be a pair wise secret. The most practical solution is to 616 use a session resumption ticket. This requires that prior to the 617 tunneling attempt, the client establishes regular connections with 618 the fronting service and obtains one or several session resumption 619 tickets. 621 5. SNI encryption with combined tickets 623 EDITOR'S NOTE: This section is an alternative design to Section 4. 624 As the draft progresses, only one of the alternatives will be 625 selected, and the text corresponding to the other alternative will be 626 deleted. 628 We propose to provide SNI Privacy by relying solely on "combined 629 tickets". The big advantage of this design compared to previous 630 attempts is that it requires only minimal changes to implementations 631 of TLS 1.3. These changes are confined to the handling of the 632 combined ticket by Fronting and Hidden service, and to the signaling 633 of the Fronting SNI to the client by the Hidden service. 635 5.1. Session resumption with combined tickets 637 In this example, the client obtains a combined session resumption 638 ticket during a previous connection to the hidden service, and has 639 learned the SNI of the fronting service. The session resumption will 640 happen as follow: 642 Client Fronting Service Hidden Service 644 ClientHello 646 + early_data 648 + key_share* 650 + psk_key_exchange_modes 651 + pre_shared_key 653 + SNI = fronting 655 --------> 657 // Decode the ticket 659 // Forwards to hidden 661 ClientHello -------> 663 (Application Data*) ----------------------> 665 ServerHello 667 + pre_shared_key 669 + key_share* 671 {EncryptedExtensions} 673 + early_data* 675 {Finished} 677 <---------------------- [Application Data] 679 (EndOfEarlyData) 681 {Finished} ----------------------> 683 [Application Data] <---------------------> [Application Data] 685 + Indicates noteworthy extensions sent in the 687 previously noted message. 689 * Indicates optional or situation-dependent 691 messages/extensions that are not always sent. 693 () encrypted with Client->Hidden 0-RTT key 695 {} encrypted with Client->Hidden 1-RTT handshake 697 [] encrypted with Client->Hidden 1-RTT key 699 The Fronting server that receives the Client Hello will find the 700 combined ticket in the pre_shared_key extensions, just as it would in 701 a regular session resumption attempt. When parsing the ticket, the 702 Fronting server will discover that the session really is meant to be 703 resumed with the Hidden server. It will arrange for all the 704 connection data to be forwarded to the Hidden server, including 705 forwarding a copy of the initial Client Hello. 707 The Hidden server will receive the Client Hello. It will obtain the 708 identity of the Fronting service from the SNI parameter. It will 709 then parse the session resumption ticket, and proceed with the 710 resumption of the session. 712 In this design, the Client Hello message is relayed unchanged from 713 Fronting server to hidden server. This ensures that code changes are 714 confined to the interpretation of the message parameters. The 715 construction of handshake contexts is left unchanged. 717 5.2. New Combined Session Ticket 719 In normal TLS 1.3 operations, the server can send New Session Ticket 720 messages at any time after the receiving the Client Finished message. 721 The ticket structure is defined in TLS 1.3 as: 723 struct { 725 uint32 ticket_lifetime; 727 uint32 ticket_age_add; 729 opaque ticket_nonce<1..255>; 731 opaque ticket<1..2^16-1>; 733 Extension extensions<0..2^16-2>; 735 } NewSessionTicket; 737 When SNI encryption is enabled, tickets will carry a "Fronting SNI" 738 extension, and the ticket value itself will be negotiated between 739 Fronting Service and Hidden Service, as in: 741 Client Fronting Service Hidden Service 743 <======= 745 Combined Ticket =======> 747 [New Session Ticket 749 <------------------------ + SNI Extension] 751 <==> sent on connection between Hidden and Fronting service 753 <> encrypted with Fronting<->Hidden key 755 [] encrypted with Client->Hidden 1-RTT key 757 In theory, the actual format of the ticket could be set by mutual 758 agreement between Fronting Service and Hidden Service. In practice, 759 it is probably better to provide guidance, as the ticket must meet 760 three of requirements: 762 o The Fronting Server must understand enough of the combined ticket 763 to relay the connection towards the Hidden Server; 765 o The Hidden Server must understand enough of the combined ticket to 766 resume the session with the client; 768 o Third parties must not be able to deduce the name of the Hidden 769 Service from the value of the ticket. 771 There are two plausible designs, a stateful design and an shared key 772 design. (There is also a design in which the Hidden Server encrypts 773 the tickets with the public key of the Fronting Server, but that does 774 not seem very practical.) In the stateful design, the ticket are 775 just random numbers that the Fronting server associates with the 776 Hidden server, and the Hidden server associates with the session 777 context. The shared key design would work as follow: 779 o the hidden server and the fronting server share a symmetric key 780 K_sni. 782 o the "clear text" ticket includes a nonce, the ordinary ticket used 783 for session resumption by the hidden service, and the id of the 784 Hidden service for the Fronting Service. 786 o the ticket will be encrypted with AEAD, using the nonce as an IV. 788 o When the client reconnects to the fronting server, it decrypts the 789 ticket using K_sni and if it succeeds, then it just forwards the 790 CH to the hidden server indicated in id-hidden-service (which of 791 course has to know to ignore SNI). Otherwise, it terminates the 792 connection itself with its own SNI. 794 The hidden server can just refresh the ticket any time it pleases, as 795 usual. 797 This design allows the Hidden Service to hides behind many Fronting 798 Services, each using a different key. The Client Hello received by 799 the Hidden Server carries the SNI of the Frinting Service, which the 800 Hidden Server can use to select the appropriate K_sni. 802 5.3. First session 804 The previous sections present how sessions can be resumed with the 805 combined ticket. Clients have that have never contacted the Hidden 806 Server will need to obtain a first ticket during a first session. 807 The most plausible option is to have the client directly connects to 808 the Hidden Service, and then asks for a combined ticket. The obvious 809 issue is that the SNI will not be encrypted for this first 810 connection, which exposes clients to surveillance and censorship. 812 The client may also learn about the relation between Fronting Service 813 and Hidden Service through an out of band channel, such as DNS 814 service, or word of mouth. However, it is difficult to establish a 815 combined ticket completely out of band, since the ticket must be 816 associated to two shared secrets, one shared with the Fronting 817 service so the second Client Hello can be sent as 0-RTT data, and the 818 other shared with the Hidden service to ensure protection against 819 replay attacks. 821 An alternative may be to use the TLS-in-TLS service described in 822 Section 4.1 for the first contact. There will be some overhead due 823 to tunnelling, but as we discussed in Section 4.2.3 the tunneling 824 solution allows for safe first contact. Yet another way would be to 825 use the HTTPS in HTTPS tunneling described in Section 3.1. 827 6. Security Considerations 829 The encapsulation protocol proposed in this draft mitigates the known 830 attacks listed in Section 2. For example, the encapsulation design 831 uses pairwise security contexts, and is not dependent on the widely 832 shared secrets described in Section 2.2. The design also does not 833 rely on additional public key operations by the multiplexed server or 834 by the fronting server, and thus does not open the attack surface for 835 denial of service discussed in Section 2.3. The session keys are 836 negotiated end to end between the client and the protected service, 837 as required in Section 2.6. 839 The combined ticket solution also mitigates the known attacks. The 840 design also uses pairwise security contexts, and is not dependent on 841 the widely shared secrets described in Section 2.2. The design also 842 does not rely on additional public key operations by the multiplexed 843 server or by the fronting server, and thus does not open the attack 844 surface for denial of service discussed in Section 2.3. The session 845 keys are negotiated end to end between the client and the protected 846 service, as required in Section 2.6. 848 However, in some cases, proper mitigation depends on careful 849 implementation. 851 6.1. Replay attacks and side channels 853 Both solutions mitigate the replay attacks described in Section 2.1 854 because adversaries cannot receive the replies intended for the 855 client. However, the connection from the fronting service to the 856 hidden service can be observed through side channels. 858 To give an obvious example, suppose that the fronting service merely 859 relays the data by establishing a TCP connection to the hidden 860 service. Adversaries can associate the arrival of an encrypted 861 message to the fronting service and the setting of a connection to 862 the hidden service, and deduce which hidden service the user 863 accessed. 865 The mitigation of this attack relies on proper implementation of the 866 fronting service. This may require cooperation from the multiplexed 867 server. 869 6.2. Sticking out 871 The TLS encapsulation protocol mostly fulfills the requirements to 872 "not stick out" expressed in Section 2.4. The initial messages will 873 be sent as 0-RTT data, and will be encrypted using the 0-RTT key 874 negotiated with the fronting service. Adversaries cannot tell 875 whether the client is using TLS encapsulation or some other 0-RTT 876 service. However, this is only true if the fronting service 877 regularly uses 0-RTT data. 879 The combined token solution almost perfectly fulfills the 880 requirements to "not stick out" expressed in Section 2.4, as the 881 observable flow of message is almost exactly the same as a regular 882 TLS connection. However, adversaries could observe the values of the 883 PSK Identifier that contains the combined ticket. The proposed 884 ticket structure is designed to thwart analysis of the ticket, but if 885 implementations are not careful the size of the combined ticket can 886 be used as a side channel allowing adversaries to distinguish between 887 different Hidden Services located behind the same Fronting Service. 889 6.3. Forward Secrecy 891 In the TLS encapsulation protocol, the encapsulated Client Hello is 892 encrypted using the session resumption key. If this key is revealed, 893 the Client Hello data will also be revealed. The mitigation there is 894 to not use the same session resumption key multiple time. 896 The most common implementations of TLS tickets have the server using 897 Session Ticket Encryption Keys (STEKs) to create an encrypted copy of 898 the session parameters which is then stored by the client. When the 899 client resumes, it supplies this encrypted copy, the server decrypts 900 it, and has the parameters it needs to resume. The server need only 901 remember the STEK. If a STEK is disclosed to an adversary, then all 902 of the data encrypted by sessions protected by the STEK may be 903 decrypted by an adversary. 905 To mitigate this attack, server implementations of the TLS 906 encapsulation protocol SHOULD use stateful tickets instead of STEK 907 protected TLS tickets. If they do rely on STEK protected tickets, 908 they MUST ensure that the K_sni keys used to encrypt these tickets 909 are rotated frequently. 911 7. IANA Considerations 913 Do we need to register an extension point? Or is it just OK to use 914 early data? 916 8. Acknowledgements 918 A large part of this draft originates in discussion of SNI encryption 919 on the TLS WG mailing list, including comments after the tunneling 920 approach was first proposed in a message to that list: 921 . 924 During the discussion of SNI Encryption in Yokohama, Deb Cooley 925 argued that rather than messing with TLS to allow SNI encryption, we 926 should just tunnel TLS in TLS. A number of people objected to this 927 on the grounds of the performance cost for the gateway because it has 928 to encrypt and decrypt everything. 930 After the meeting, Martin Thomson suggested a modification to the 931 tunnelling proposal that removes this cost. The key observation is 932 that if we think of the 0-RTT flight as a separate message attached 933 to the handshake, then we can tunnel a second first flight in it. 935 The combined ticket approach was first proposed by Cedric Fournet and 936 Antoine Delignaut-Lavaud. 938 The delegation token design comes from many people, including Ben 939 Schwartz and Rich Salz. 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-20 (work in progress), 948 April 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, 953 . 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, 969 . 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