The privacy of the TLS 1.3 protocol Ghada Arfaoui, Xavier Bultel, Pierre-Alain Fouque, Adina Nedelcu, Cristina Onete

To cite this version:

Ghada Arfaoui, Xavier Bultel, Pierre-Alain Fouque, Adina Nedelcu, Cristina Onete. The privacy of the TLS 1.3 protocol. Proceedings on Privacy Enhancing Technologies, De Gruyter Open, 2019, 2019, pp.190 - 210. ￿10.2478/popets-2019-0065￿. ￿hal-02482253￿

HAL Id: hal-02482253 ://hal.archives-ouvertes.fr/hal-02482253 Submitted on 17 Feb 2020

HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. Proceedings on Privacy Enhancing Technologies ; 2019 (4):190–210

Ghada Arfaoui, Xavier Bultel, Pierre-Alain Fouque, Adina Nedelcu*, and Cristina Onete The privacy of the TLS 1.3 protocol

Abstract: TLS () is a widely 1 Introduction deployed protocol that plays a vital role in securing In- ternet traffic. Given the numerous known attacks for The TLS protocol is one of the most commonly used TLS 1.2, it was imperative to change and even redesign secure-channel establishment protocols today. It en- the protocol in order to address them. In August 2018, sures the security of, for example, exchanged a new version of the protocol, TLS 1.3, was standard- over the Internet when incorporated in https [14, 29], ized by the IETF (Internet Engineering Task Force). secure emailing, and even Voice-over-IP (VoIP) com- TLS 1.3 not only benefits from stronger security guaran- munications [31]. As other authenticated key-exchange tees, but aims to protect the identities of the server and (AKE) protocols, TLS consists of two steps: a hand- client by encrypting messages as soon as possible dur- shake and subsequently, secure message-exchange. Dur- ing the authentication. In this paper, we model the pri- ing the handshake, a client and a server exchange in- vacy guarantees of TLS 1.3 when parties execute a full formation over an insecure channel, allowing for (uni- handshake or use a session resumption, covering all the lateral or bilateral) authentication and for the compu- handshake modes of TLS. We build our privacy models tation a tuple of symmetric keys. Subsequently, during on top of the one defined by Hermans et al. for RFIDs the secure message-exchange step (also called the record (Radio Frequency Identification Devices) that mostly layer for TLS), these keys are used with authenticated targets authentication protocols. The enhanced mod- encryption. This process guarantees the most basic se- els share similarities to the Bellare-Rogaway AKE (Au- curity properties of a protocol for secure-channel estab- thenticated Key Exchange) security model and consider lishment, namely the confidentiality and authentication adversaries that can compromise both types of partic- of the messages. ipants in the protocol. In particular, modeling session In this paper, however, we shift the focus away from resumption is non-trivial, given that session resumption the security of secure-channel establishment, and in- tickets are essentially a state transmitted from one ses- stead consider the privacy it provides. sion to another and such link reveals information on In TLS, parties can choose to execute a full hand- the parties. On the positive side, we prove that TLS 1.3 shake each time they communicate, or they can resume protects the privacy of its users at least against pas- a past session using session resumption. The TLS 1.3 full sive adversaries, contrary to TLS 1.2, and against more handshake that is most likely to be used in practice con- powerful ones. sists of a unilaterally (server-only) authenticated Diffie- Keywords: privacy, TLS 1.3, AKE protocols Hellman-based key-exchange, which guarantees perfect , i.e., compromising a party’s long term DOI 10.2478/popets-2019-0065 Received 2019-02-28; revised 2019-06-15; accepted 2019-06-16. keys does not affect past sessions. Once a client and a server have successfully completed a full handshake, it is possible to resume that handshake later, by using a pre-shared key and optionally an additional Diffie- Hellman element. This improves performance by avoid- ing authentication. Ghada Arfaoui: Orange Labs, France, E-mail: Session resumption in TLS 1.3 strongly depends on [email protected] so-called session tickets. Upon the completion of a (full Xavier Bultel: IRISA, Rennes Univ, France, E-mail: or resumed) session, the server sends the client a ticket [email protected] as part of the secure session-traffic. In order to resume Pierre-Alain Fouque: IRISA, Rennes Univ, France, E-mail: that session the client sends the unencrypted ticket back [email protected] *Corresponding Author: Adina Nedelcu: Or- in a following session, and both parties use the associ- ange Labs, IRISA, Rennes Univ, France, E-mail: ad- ated pre-shared key (PSK) to compute new session keys. [email protected] Unfortunately, session resumption, in its pre-shared key Cristina Onete: XLIM/CNRS 7252, France E-mail: only mode, yields no forward secrecy. [email protected]

Unauthentifiziert | Heruntergeladen 17.02.20 20:33 UTC The privacy of the TLS 1.3 protocol 191

In this paper we show that, in addition to forward by never using identifiers in plaintext; for lower layers, secrecy, PSK-based session resumption also loses the more complex mechanisms such as might have to be degree of privacy guaranteed by full-mode handshakes. put into place. But, while learning a party’s identity is The same problem holds for PSK-DHE resumption. a complete privacy , partial information leakage –such as realizing whether the protocol has been run be- fore, or linking a single, anonymous user to two distinct 1.1 The TLS 1.3 protocol sessions – can also be exploited. This is the reason why modern privacy-preserving protocols aim to guarantee The history of the TLS protocol is littered with attacks various flavours of unlinkability, rather than the weaker against both the handshake and the record layer sub- property of identity-hiding. This is also the approach protocols [1–4, 6, 9–13, 21, 27, 28, 30, 32]. The plethora we take in this paper, modelling strong adversaries and of flaws discovered in the TLS 1.2 version have led the minimal restrictions on winning conditions. IETF to propose TLS 1.3 as the future de-facto AKE Even less ambitious goals, such as identity-hiding, 1 protocol to safeguard Internet connections. can be difficult to achieve in practice, for instance in the In many ways, the design of TLS 1.3 revolutionizes context of authentication. Krawczyk [25] noted that it real-world authenticated key-exchange, by employing is impossible to design a protocol that will protect both modern cryptographic mechanisms. All messages in the peers’ identities from active attacks, since the first peer the protocol are encrypted using AEAD (Authenticated must disclose its identity to its partner before authenti- Encryption with Auxiliary Data). Additionally, HKDF cation can take place. As TLS 1.3 is expected to mainly (Hash Key Derivation Function), replaces HMAC in the run – like its predecessors – with only unilateral authen- key schedule. The key schedule itself is much more com- tication, we may hope that it protects the identity of the plex than in previous versions, respecting the paradigm server from passive and active adversaries. This would of separating keys used at different layers and for dif- be a vast improvement with respect to previous versions ferent purposes. Insecure or obsolete algorithms from of TLS, in which the server’s identity is usually sent in previous versions of TLS are no longer supported by clear together with its certificate. TLS 1.3. The protocol is designed with modularity in In addition to the revolutionary design of its full mind, which should make it easier to implement or for- handshake, TLS 1.3 enables session resumption in two mally analyse. We give a more detailed description of modes: PSK and PSK-DHE. This latter mode adds the design elements that affect the privacy of TLS 1.3 freshness in session key computation. Both modes make in Appendix A. use of the so-called session tickets. However, there seems to be no consensus about its implementation, especially that TLS 1.3 specification gives only generic guidelines 1.2 Privacy notions for AKE about its construction. In this paper, we analyse the privacy of the different modes of TLS handshake and Beyond confidentiality, the notion of user privacy has discuss the privacy impact of the way session tickets are been increasingly required for practical cryptographic constructed. countermeasures. Such requirements were exacerbated by Edward Snowden’s revelations of mass surveillance attacks and large data centers storing massive amounts 1.3 Our contributions of user metadata [34], which co-motivated the emer- gence of GDPR [17] and e-Privacy [18] regulations. In Our three main contributions are as follows: we for- addition, designers of cryptographic primitives and pro- malized a game-based Left-or-Right indistinguishability tocols have taken to an “encrypt as early as possible” definition for the properties attained by the protocol; we paradigm, which formed the backbone of TLS 1.3. described a number of inevitable attacks in AKE pro- At the very minimum, a privacy-protecting protocol tocols (providing for them in our model); and finally can hide the identity of the participants (both client and we proved the privacy properties guaranteed by the full servers). At the level of the protocol, this can be done handshake and the session-resumption mechanisms. We discuss below in more detail each of these contributions. 1 For this paper, we have relied on the August 2018 ver- Our privacy model. We define the privacy of TLS as sion of RFC 8446, available at https://datatracker.ietf.org/doc/ a type of unlinkability of protocol sessions. The adver- rfc8446/.

Unauthentifiziert | Heruntergeladen 17.02.20 20:33 UTC The privacy of the TLS 1.3 protocol 192 sary is an active Man-in-the-Middle, who can interact two parties such that, for some given partner, one of the with protocol participants arbitrarily, akin to Bellare- two parties holds a resumption ticket with that partner, Rogaway AKE adversaries [8]. However, as opposed while the other does not. In that case, the adversary’s to [8] models, in which the adversary knows whom he strategy would be to force resumption and distinguish is interacting with, in our definitions we use the notion between the drawn parties based on whether resump- of virtual identifier taken from the RFID privacy frame- tion worked (the handshake runs to completion) or not work of Hermans et al. [23]. Our adversaries will repeat- (there is an abort). Thus, we must restrict the adver- edly be able to query a drawing oracle, which takes as sary’s winning conditions to capture the indistinguisha- input two (possibly distinct) parties of the same type bility between two parties that have similar resumption (clients or servers) and outputs either the left or the profiles. We note that these threats are generalizable to right party, depending on a secret bit b. The goal of our a wider category of protocols supporting resumption. adversary will be to guess b with a probability signifi- Indeed, the attacks do not exploit features specific to 1 cantly larger than 2 . TLS 1.3, but rather, weaknesses of session resumption A key aspect of our model is that we view resumed in general. sessions as being linked to the previous session in which Proving the privacy of TLS 1.3. In order to prove the PSK (and the ticket) is computed; we account for the privacy of TLS 1.3, we employ techniques often this by allowing clients and servers to have a state. The used in provable security for analysing AKE or other concept of tying sessions together in this way lies at types of protocols. We reduce the problem of breaking the core of our model, and is one of the strongest ways the privacy of TLS users to either breaking down the in which the adversary can try to link sessions. Unfor- atomic cryptographic primitives (like the signature or tunately, this inter-connection between the session also the authenticated encryption) or solving computational implies some restrictions in terms of the Left-or-Right, problem presumed hard (such as computational Diffie- Corruption, and Revealing queries that the adversary is Hellman). As long as these assumptions hold true, TLS allowed to make. guarantees the privacy of its users up to a certain num- A non-trivial design choice in our model concerns ber of intrinsic trivial attacks that we exclude from the Left-or-Right queries. Ideally, we would like the adver- model. sary to be able to make multiple drawing queries, under reasonable restrictions (such as: one cannot make draw the same party twice without first freeing it). Unfor- 1.4 Applicability and impact tunately this seems impossible: during the proof the re- duction to the AEAD security of the channel over which Our results are, to some degree, tailored to TLS 1.3, and the ticket is sent would require guessing a large, com- to some degree more generic, covering a wider class of binatorial number of instances. Consequently, we have protocols. We point out some of the limitations below. a choice of whether to define selective privacy (the ad- versary declares in advance which parties it will later Protocol limitations. Analysing the privacy of com- draw), or allowing a single DrawParty query, which is plex protocols, such as TLS 1.3, is a daunting task. As –however– adaptive. We choose the latter approach. a result, we only focus on some of its features, includ- ing the full handshake, session resumption in PSK and Trivial Attacks. Ideally, we would have liked our PSK-DHE mode, but not 0-RTT. The precise protocol games to have a “clean” winning condition: the adver- we analyse in this paper is described in Section 2.2. sary would win if he managed to output a correct guess Although we strove to include as many of the proto- for the bit b. Unfortunately, this is not possible. Even col’s privacy-preserving features as possible, some seem for the full TLS 1.3 handshake an adversary can win by difficult to model, including parameter negotiation and impersonating a client – since we consider server-only error messages. The former can be serious privacy risks, authentication. We call such an attack trivial, in the since they can be used to profile the server’s or client’s sense that it automatically allows the adversary to win, behaviour, which in turn can help link sessions of the regardless of the design of the protocol. same party. Another feature we omit is the Server Name Resumption brings out many more attacks against Indication (SNI) extension, which allows a single server user privacy, which we detail in Section 3. The easiest to run TLS handshakes on behalf of multiple domains, way in which an attacker can break our Left-or-Right using multiple public keys. Defining privacy in this con- privacy notion is to choose (by using the Draw oracle) text is tricky, since we would have to model the fact

Unauthentifiziert | Heruntergeladen 17.02.20 20:33 UTC The privacy of the TLS 1.3 protocol 193 that certain servers are allowed to run handshakes for ties as the sets of resuming and non-resuming parties, one domain, while others cannot. depending on the use case, can be prohibitively large. Finally, we only considered one possible implemen- Nonetheless, as resumption is often used, for instance, tation of session tickets, which is also implemented by, when accessing multiple resources on the same webpage, for instance, WolfSSL2: namely, the server will encrypt this would still give an attacker important information the resumption master secret and a nonce within the ses- about a user’s access patterns. Consequently, such at- sion ticket, using a long-term symmetric key. However, tacks are included in our analysis. we also discuss other implementations in our concluding Privacy in isolation. In this paper, we prove the pri- remarks. Session tickets are non-reusable in our model. vacy of the TLS 1.3 protocol in isolation, without con- Model limitations. Our model is also restricted sidering its composition with lower-layer protocols, nor to unilaterally, server-only-authenticated protocols in other encapsulating primitives. We argue that this is which the client sends the first message. However, we still meaningful, for two main reasons. First, note that can trivially transform a protocol for which the server as a general rule, privacy tends to be either preserved or is the initiator into one in which it is the responder (by lost: it is much harder to “create” it. In other words, if just adding a dummy message from the client, prompt- TLS 1.3 did not preserve privacy, then its use – even en- ing the communication) without impacting the security capsulated in privacy-preserving lower-layer protocols – analyses; It is only slightly more complicated to cap- would still lead to privacy breaches. In this paper, our ture a mutually-authenticated handshake: we must add goal was to show precisely what kind of privacy TLS a winning condition that prohibits the adversary from 1.3 preserves. In some ways, this indicates how much impersonating a client. privacy we can hope for, when TLS 1.3 is used as a pro- We also assume that servers have a way of a priori tocol in computer networks.3 We do note that one way distinguishing whether the handshake will be run in full, to extend our result would be to verify the possibility of PSK, or PSK-DHE modes, thus excluding some tamper- composing it with known results on privacy-preserving ing attempts by the adversary. In the TLS 1.3 protocol, routing protocols, such as Tor. This deserves to be the no such a priori knowledge is needed since the server ad- subject of a separate paper. justs to the format of the client’s first message. Finally, the mechanics of the Left-or-Right party-drawing ora- cle amount to a number of artificially destroyed tickets, 1.5 Related work which have no correspondence in real life. To the best of our knowledge, this work proposes the Our attacks. In this paper we present a number of first analysis of the privacy achieved by TLS 1.3. Our ways in which a generic adversary can link protocol ses- model has some similarities with existing work on pri- sions, both when session resumption is used (most at- vacy. We combine authenticated key-exchange models tacks), and when it is not. These attacks exploit weak- akin to Bellare-Rogaway [8] with game-based privacy in nesses which appear in TLS 1.3, but that are generaliz- authentication, as defined by Hermans et al. [23]. This able to larger classes of protocols. Informally speaking, approach was previously taken by Fouque et al. [20] it is the resumption mechanism in general introduces but in the context of mobile network communications weakness, not the TLS 1.3 resumption in particular. (without public-key primitives and session resumption). For session resumption, most of our attacks are, Although we rely on both the Bellare-Rogaway defini- to some extent, parallelizable, but have a limited real- tion of secure AKE and on the Hermans et al. notion world impact. The attacks generally exploit the fact of privacy-preserving RFID authentication, our model that resumed sessions imply the existence of a previ- is a non-trivial extension of these two frameworks. The ous, linked session in which the ticket was forwarded. definitions in this paper are much closer to characteris- This allows an attacker to always distinguish between tics such as the unilateral server-only authentication of a party that should be able to resume a session, and a party that cannot. In the real world, even if an adver- sary can distinguish between such two parties, he would require auxiliary information to fully identify the par- 3 Note, however, that the reverse is unfortunately not true: even if TLS 1.3 does preserve privacy, this does not by default guar- antee the privacy of its encapsulation in lower-layer protocols. 2 https://www.wolfssl.com/ This is an important limitation of our result.

Unauthentifiziert | Heruntergeladen 17.02.20 20:33 UTC The privacy of the TLS 1.3 protocol 194

TLS 1.3, its complex key schedule, and the ticket-based orthogonal to work which covers the privacy of anony- mechanism of session resumption. mous networking protocols like Tor [7]. Since TLS is a network protocol, our work also Outline of the paper. The paper is structured as fol- touches upon the field of anonymous communication in lows. In Section 2, we model the TLS 1.3 protocol and computer networks. An early formalization of anony- introduce cryptographic assumptions. In Section 3 we mous channels is provided by Hevia and Micciancio [22], describe several trivial attacks. We develop a model for who describe an adversary that is given a of mes- privacy of the full handshake in Section 4 and extend the sages in a given protocol, and his goal is to distinguish model by adding resumption in Section 5. We conclude between them. The adversary is passive and cannot cor- in Section 6. rupt parties. Their framework defines several types of privacy properties (such as sender and/or receiver un- linkability, anonymity) and shows existing reductions (either trivial, or by using techniques such as cryptog- 2 Preliminaries raphy or padding). The model of Hevia and Micciancio focuses more on the number of messages, their sender, The results in this paper are proved for an abstract form receiver, and size, and can be seen as a more global view of the full and resumed TLS 1.3 handshake. We stress of a network protocol when subjected to traffic analy- that our model of the TLS 1.3 handshakes is incom- sis. Our goal here is different: we aim to describe the plete as detailed in Section 1.4. In this section we first properties that are achieved by the TLS 1.3 protocol describe the way we model the TLS 1.3 full handshake somewhat in isolation (thus characterizing the design of and two resumption modes. We then describe in more TLS 1.3, rather than the way it is used). We argue that detail the key scheduling and a protocol idealization in this allows us to consider the effects of stronger adver- Section 2.1. We introduce cryptographic assumptions in saries, which are allowed to corrupt parties, reveal keys, Section 2.2. We illustrate, in Figure 1, an idealization of and play active Man-in-the-Middle roles. the TLS 1.3 handshake in full mode. We designate this

Hermans et al. [23] take an approach closer to ours protocol as ΠTLS. Then, we also illustrate, in Figure 2, and formalize privacy in authentication protocols, par- session resumption in both pre-shared key (PSK) and ticularly in the context of RFID authentication. They in pre-shared key with ephemeral Diffie Hellman (PSK- build on previous work dating back to the privacy model DHE) modes. We denote this by ΠTLS+res. To clarify, in of Vaudenay [33]. The adversary is an active Man-in- ΠTLS+res the parties can execute either full handshakes the-Middle which can interact with parties, adaptively or session resumptions, while in ΠTLS they can only ex- corrupt them, and learn the result of protocol execu- ecute full handshakes. The notations we use when de- tions. A central concept of this framework is that of vir- scribing the protocols are summarized in Table 1. The tual tag, which is a handle meant to hide the identity of key schedule is presented in Figure 3. a party (namely an RFID tag) from the adversary while the latter interacts with that tag. We adopt this concept here, and follow the general design of the Left-or-Right 2.1 TLS 1.3 handshake and session (LoR) indistinguishability game used by Hermans et al.. resumption As a result, our definition captures the unlinkability of TLS 1.3 sessions. In TLS 1.3, the client chooses the handshake mode by Our results are orthogonal to those of research the way it constructs its first message protocol. From on the security achieved by the TLS protocol, such that point onward, the execution of the protocol follows as [15, 24], although our model does rely on a simplifi- the path illustrated in the figures. If a message is ill- cation of the multistage security defined by Fischlin and formed, incomplete, invalid or out of order, the session is Günther [19]. terminated with a relevant error message. Anticipating We assume that implementers follow best practices a bit, we model this by having the Send oracle returning and ticket anti-replay measure are in place. Therefore, ⊥ (we do not model the multiple error messages defined the Selfie attack [16] would not occur in our model. in the RFC). This paper focuses on the privacy achieved by TLS 1.3 in isolation. We do not focus on its privacy when composed with lower-level protocols, a limitation which we discuss in Section 1.4. In that sense, our results are

Unauthentifiziert | Heruntergeladen 17.02.20 20:33 UTC The privacy of the TLS 1.3 protocol 195

es early secret in.(out.) prefixes (see Fig 2, Fig 11) {}key AE encryption with key −1 hs handshake secret bk binder key {}key AE decryption with key ms master secret bnd preshared key binder "" empty string .hs/ S.hs client/server handshake secret `0...`9 labels/strings Hτ hash of the partial transcript: C.htk/ S.htk client/server handshake traffic key PRF pseudo-random fct. C.hs, S.hs: H(CHello....KES ) C.fk/ S.fk client/server finished key MAC message auth. code C.ts, S.ts: H(CHello....FinS ) C.ts/ S.ts client/server traffic secret RO random oracle rms: H(CHello....FinC ) C.tk/ S.tk client/server traffic key k server’s ticket encrypt. key FinS : H(CHello....CVf) rms resumption master secret CHello...FinC TLS messages FinC : H(CHello....FinS ) psk preshared key g generator of a group G resumption specific: STicket session ticket k concatenation bnd: H(CHello....STicket)

NT ,in.NT ticket nonces | or operator FinS : H(CHello....KES ) Table 1. List of notations used in Figure 1 and Figure 2.

Client C Server S Client C Server S

(skS , kS ) (in.rms,in.NT ,in.STicket)(skS ,k) ··························· Key Exchange ··························· ··························· Key Exchange ··························· 1.CHello,KE =gx es := RO(0; 0) −−−−−−−−−−→C es := RO(0; 0) 2.SHello,KE =gy psk := PRF(in.rms; `8, in.NT ) ←−−−−−−−−−−S 10.CHello, KE = gx hs := RO(gxy; esk` ) hs := RO(gxy; esk` ) C 0 0 es := RO(psk; 0) −−−−−−−−−−→ C.hs := PRF(hs; `1,Hτ ) C.hs := PRF(hs; `1,Hτ ) 20in.STicket bk := PRF(es; `9,"") −−−−−−−−−−→ S.hs := PRF(hs; `2,Hτ ) S.hs := PRF(hs; `2,Hτ ) bnd := MAC(bk; Hτ )(in.rms, in.N ) := C.htk := PRF(C.hs; `3,"") C.htk := PRF(C.hs; `3,"") T 0 S.htk := (S.hs; ` ,"") S.htk := (S.hs; ` ,"") 3 .bnd −1 PRF 3 PRF 3 −−−−−−−−−−→ {in.STicket}k ························ Server Authentication ························ psk := PRF(in.rms; `8, in.NT ) es := RO(psk, 0) 3.{Cert ,CVf} S S.htk bk := PRF(es; `9,"") Verify CertS , CVf ←−−−−−−−−−− CVf := Sign.Sign(skS ,Hτ ) bnd := MAC(bk; Hτ ) S.fk := PRF(S.hs; `4,"") S.fk := PRF(S.hs; `4,"") 0 y C.fk := PRF(C.hs; `4,"") C.fk := PRF(C.hs; `4,"") 4 .SHello, KES = g ························ Session Authentication ························ ←−−−−−−−−−− Verify bnd xy xy hs := RO( g |0; esk`0) hs := RO( g |0; esk`0) 4.{FinS }S.htk ························ Session Authentication ························ Verify FinS ←−−−−−−−−−− FinS := MAC(S.fk; Hτ ) 5.{FinC }C.htk FinC := MAC(C.fk; Hτ ) −−−−−−−−−−→ Verify FinC 50.{Fin } Verify Fin ←−−−−−−−−−−S S.htk Fin := (S.fk; H ) ms := RO(0; hsk`0) ms := RO(0; hsk`0) S S MAC τ 0 6 .{FinC }C.htk C.ts := PRF(ms; `5,Hτ ) C.ts := PRF(ms; `5,Hτ ) FinC := MAC(C.fk; Hτ ) −−−−−−−−−−→ Verify FinC S.ts := PRF(ms; `6,Hτ ) S.ts := PRF(ms; `6,Hτ ) Secure record layer with tk C.tk := PRF(C.ts; `3,"") C.tk := PRF(C.ts; `3,"") S.tk := PRF(S.ts; `3,"") S.tk := PRF(S.ts; `3,"") 70. {out.STicket,out.N } ←−−−−−−−−−−−−−−−−−−−−T S.tk rms := PRF(ms; `7,Hτ ) rms := PRF(ms; `7,Hτ ) STicket := {rms, N } T k Fig. 2. Our modelling of the TLS 1.3 handshake- session resump- Secure record layer with tk(second model only) tion, both preshared key-only and preshared key with Diffie Hell- man key exchange. In the boxes we have the protocol elements 6. {STicket, NT }S.tk ←−−−−−−−−−−−−−−−−−−− specific to the pre-shared key with Diffie-Hellman key exchange mode. We have prefixed the NT , rms, STicket used at the be- Fig. 1. Our modelling of the TLS 1.3 handshake - full handshake ginning of the session with in, and those created at the end of a mode. We do not explicitly include the length of parameters. The session by out. This emphasises they are different variables. sections in boxes concern only the extended protocol, ΠTLS+res. tion and the session authentication4. During the first phase, the client and the server exchange desired ses- sion parameters and key share components. This allows Overview. We can distinguish three main phases in the them to compute an intermediate secret and temporary TLS protocol: the key exchange, the server authentica- encryption keys, which they use to encrypt the rest of

4 We use terminology that is slightly different than the one used in the RFC, for readability purposes.

Unauthentifiziert | Heruntergeladen 17.02.20 20:33 UTC The privacy of the TLS 1.3 protocol 196 the handshake. In the second phase, the server sends 0 his certificate and a signature; the client uses them to authenticate the server. At the end of the protocol, the 0|psk es bnd (ticket MAC key) client and server exchange a Message Authentication gxy|0 hs Code (MAC) over the transcript. If they correctly ver- C.htk (temp. enc. key) C.hs ify these messages, they compute a new secret, from C.fk (MAC key) which they derive the traffic encryption keys. S.htk (temp. enc. key) S.hs At this stage, the server can send some secret data S.fk (MAC key) 0 ms (i.e., a ticket) to the user enabling him to later on “jump- C.ts C.tk (final enc. key) start” a new session. This is so-called session resump- S.ts S.tk (final enc. key) tion. In order to initiate a resumption, a client will send rms psk a ticket to a server, followed by an associated MAC. If the ticket is valid, this allows parties to simplify Fig. 3. The key schedule of TLS 1.3, with bidirectional keys. We the negotiation/key exchange phase and completely use psk if it is a resumption and 0 otherwise. We use gxy if the eliminate the second phase, that of server authentica- handshake mode requires a Diffie-Hellman key exchange, and 0 otherwise. Encrypting the handshake and record layer messages tion. Resumption comes in two flavours: pre-shared key with distinct sets of keys is one of the improvements of TLS 1.3. (PSK) and pre-shared key with ephemeral Diffie Hell- man (PSK-DHE) modes, depending on whether or not a Diffie-Hellman key exchange is executed. Incorporat- Modelling the key derivation. In order to per- ing the Diffie-Hellman into resumption offers stronger form the key derivation, TLS 1.3 uses the Hash Key- security guarantees, at the price of extra computation Derivation Function (HKDF) [26], which has two main and protocol messages. operations: Extract and Expand. The Extract operation is applied to an input key material, with some (optional) Key schedule. The key schedule of TLS 1.3 appears salt. Its role is to transform a sufficiently random in- in Figure 3. We distinguish three main secrets: the put into a secret that has high entropy and is compact. early secret es, the handshake secret hs and the mas- The Expand operation takes a secret, a label and an ter secret ms. In a full mode handshake, es is simply a input. The secret is usually the output of a preceding publicly-computable string. However, it is used to “in- Extract operation. The label is a publicly-known string ject” the preshared key psk into the key schedule when and serves to have different outputs for the same inputs. resuming a session. The handshake secret hs is used to For example, two keys might be computed in almost the derive client and server handshake secrets (C.hs and same way, but using different labels will produce distinct S.hs), from which the parties compute two handshake and independent keys for different contexts. The input traffic keys (C.htk and S.htk) as well as message authen- is usually a session hash (the hash applied to the partial tication keys for the Finished messages (C.fk and S.fk). transcript), but it can sometimes be an empty string "". We introduce the prefix “C.” to designate the client se- Although the original protocol uses the HKDF func- crets and keys used to send data to the server. Similarly, tion [26] to extract key material, then expand it into we use the prefix “S.” to designate the secrets and keys keys, we choose to model the extraction steps as a ran- of the server used to send data to the client. The mas- dom oracle (RO), and the expansion steps as runs of ter secret ms is first used to compute the client and a pseudorandom function (PRF). Using the random- server secrets (C.ts and S.ts), and ultimately the traffic oracle model is a strong idealization; however, we deem (encryption) keys: C.tk and S.tk. Optionally, the mas- it acceptable for two reasons: (1) previous analyses of ter secret can be used to derive a resumption secret TLS 1.3 do show that the keys obtained through HKDF rms and, from it, the preshared key psk. The preshared are indistinguishable from random [15], under stronger key and associated ticket are needed in order to resume assumptions like PRF-ODH; (2) our focus here is pri- a session. vacy, and not the security of keys – in idealizing the key derivation, our proofs are cleaner and easier to follow. Protocol messages. A TLS 1.3 protocol run consists of the following messages. The numbers in brackets in- dicate where they appear in Fig 1 and Fig 2.

Unauthentifiziert | Heruntergeladen 17.02.20 20:33 UTC The privacy of the TLS 1.3 protocol 197

CHello(1,1’): The Client Hello message consists of the 2.2 Cryptographic assumptions protocol version(s), a nonce NC generated by the client, as well as lists of supported cryptographic Let A designate an algorithm, commonly referred to as $ primitives and client extensions. an adversary. We denote a ← A if the element a is uni- formly randomly sampled from the set A. KEC (1,1’): Both in the full handshake, and in the case of session resumption with PSK+DHE, the client The Computational Diffie-Hellman (CDH). Let G be a multiplicative cyclic group of order | | and g provides a client key-share message KEC consisting G a generator. Let us define ExpCDH(A) : x, y ←$ | |, of (the description of) a series of groups and an el- G G x y ∗ ement gx in each group, respectively5. g, g , g → A, g ← A. We define the advantage of A G ∗ xy SHello(2,4’): The Server Hello message includes the as AdvCDH(A) = P[g = g ]. Any adversary A against CDH in the group running in time t and making server’s nonce NS , as well as the server’s selection G of the version, extensions, and supported crypto- at most q queries has an advantage of at most CDH: G graphic primitives (from amongst the alternatives CDH ≥ AdvCDH(A). stated in CHello). Pseudorandom functions (prf). Let K be a keyspace. Let : K × {0, 1}m → {0, 1}n be some function fam- KES (2,4’): The server’s key-share element consists of a PRF m→n m single element gy chosen for one single group, chosen ily. Let R be the set of all functions from {0, 1} to {0, 1}n and f a function from Rm→n . We define the from amongst those sent in KEC . following oracle PRFb(z): If b = 1, output (k; z); oth- CertS (3): The server’s certificate CertS is modelled here PRF prf $ as just a public key, which we assume is only at- erwise, output f(z). Let us define ExpPRF(A): b ← {0, 1}, b k ←$ K, f ←$ Rm→n, d ← APRF (·). We define the advan- tributed to one legitimate entity holding the corre- tage of A as AdvPRF(A) = [b=d] − 1 . Any adversary sponding private key. prf P 2 CVf(3): The server issues the Certificate Verify message A against the prf property of PRF running in time t and to authenticate to the client as the owner of the key making at most q queries has an advantage of at most G in CertS . The CVf is a signature on the hash of the CDH: CDH ≥ AdvCDH(A). handshake messages, up to, and including CertS . Existential unforgeability (EUF-CMA). A digital sig- FinS (4,5’): The server Finished message FinS is a MAC nature scheme Sign is a tuple of three algorithms: (Gen, keyed with the Server Finished Key S.fk, on input Sign, Vfy). Gen() outputs a pair of a signing key sk and the current session hash, up to, and including CVf. a verification key pk. The algorithm Sign takes as input

FinC (5,6’): The client Finished message FinC is a MAC the key sk and a message msg and outputs a signature σ. keyed with the key C.fk, on input the session hash The algorithm Vfy takes as input the key pk, a message

up to, and including FinS . msg, and a signature σ, and outputs 1 if the signature STicket(6,2’,7’): At the end of a handshake, the server σ is valid for the message msg and 0 otherwise. may send a client a session resumption ticket STicket We define an oracle Sign(msg) that returns

followed by a nonce NT . The STicket encapsulates Sign.Sign(sk, msg) and stores msg in a list Lsig. EUF-CMA $ rms and a nonce NT in an encrypted and authenti- Let us define ExpSign (A): b ← {0, 1}, Lsig ← cated manner. These values will be used to compute ∅, sk, pk ← Sign.Gen() ,(msg∗, sk∗) ← ASign(·) . Sign psk. The NT needs to be forwarded to the client as We define the advantage of A as AdvEUF-CMA(A) = ∗ ∗ well. When resuming a session, a client sends the P[Sign.Vfy(pk; sk ) = 1 ∧ msg ∈/ Lsig]. Any adversary A STicket after CHello and KEC . against the EUF-CMA property of Sign running in time bnd(3’): In the cases of PSK and PSK+DHE, the client t and making at most q queries has an advantage of at Sign sends a pre-shared key binder bnd, which is a MAC most EUF-CMA: EUF-CMA ≥ AdvEUF-CMA(A). keyed with the key bk, on input CHello, KEC (if AE is a stateful-length hiding authenticated encryp- present) and STicket. The key bk is derived from the tion scheme (or stLHAE). Such a scheme provides con- early secret es, which takes as input the pre-shared fidentiality of communication, integrity of ciphertexts key psk. and additional data, protection against message reorder- ing and replay, as well as hiding the length of the mes- sages to some degree. An adversary A against stLHAE is given access to encryption and decryption oracles, AEncb

5 This key-share is also present in the PSK resumption mode; and ADec. Informally, an adversary wins the security however, if only PSK resumption is used, the DH element pro- game if he can distinguish between two possible outputs vided by the client is not used. of AEnc (he chooses two messages and receives a cipher-

Unauthentifiziert | Heruntergeladen 17.02.20 20:33 UTC The privacy of the TLS 1.3 protocol 198 text encrypting one of them) or if he can desynchronize a)Alice ←−−−−−−−“I am W’’ W the ADec oracle by inputting a successful forgery. Eavesdroppers can read the message. {“I am W”} We formally define the stLHAE security experiment b)Ak ←−−−−−−−−−k Wk in the full version of the paper [5]. Man-in-the-middle attack against privacy.

Fig. 4. Unencrypted versus encrypted authentication messages: 3 Trivial attacks encrypting provides stronger privacy guarantees, but it cannot defend against adversaries impersonating the unauthenticated In this section we detail trivial attacks applicable to party. TLS and related protocols, using an intuitive pseudo- protocol notation. not to that server. (Figure 5). Assume Alice wants Parties (Alice, Bob, or a website W/W’) exchange to have a session with a website, either W or W’. How- messages. The messages are written on top of arrows go- ever, assume there exists an adversary that can convince ing from a sender to a receiver of that message. Rather Alice that he is, for example, the website W. Alice will than formally defining a full protocol and its set of mes- accept the session if and only if the adversary imperson- sages, we informally describe message contents or their ated the correct website. Even if the adversary imper- intended role in between commas. If a party knows a sonates the wrong server, he still ends up learning some- symmetric encryption key k or a session resumption thing about Alice that he didn’t know before mounting ticket t, this is noted as a superscript. An encrypted the attack: namely, Alice did not wish to initiate a ses- text is written within accolades, with the encryption sion with that particular server. key specified as a subscript. A denotes the adversary. If a text is emphasised, A is able to impersonate W. this is a precondition or an assumption (on the powers “Start new session ” Alice −−−−−−−−−−−−−−−−−−→ W or W’? of the adversary) needed for the attack. Non-emphasised ··························· text is a comment or an explanation. If we list two par- “I am W’’ Alice ←−−−−−−−A(W) ties, followed by a question mark, this means the ad- a)If Alice accepts the session, W is the intended partner. versary is unsure which of the two is the real sender or b)If Alice rejects, W’6=W is the intended partner. receiver of the message.

Fig. 5. If an adversary can convince Alice he is W, he can learn 3.1 Full handshake attacks whether Alice intended to start a session with W or with another server.

Trivial privacy leaks (Figure 4). Messages used to authenticate a user are, by their nature, privacy- sensitive. The party sending the first authentication message in a protocol has no way of knowing, at the 3.2 Resumption attacks time the message is sent, if they are communicating with an honest or malicious party. In previous versions Client with a ticket, distinguishable from a client of TLS, the server used to send its certificate in the without a ticket (Figure 6). Alice and Bob wish to clear. This trivially leaks the identity of the server to connect to a website W. Alice has a resumption ticket, any eavesdropper. Encrypting the message protects it to Bob does not. An adversary sees either Alice or Bob some degree. Sessions between honest parties no longer establishing a session with W. If it is a session resump- leak sensitive information, but active adversaries could tion, he can, by process of elimination, conclude that it mount a man-in-the-middle attack by initiating a proto- was Alice who initiated the resumption. col session. As discussed in [25], AKE protocols cannot We can apply the same argument for servers. As- hide the identity of both parties against active adver- sume that Alice has a resumption ticket from a website saries. W, but she doesn’t have such a ticket from a website W’. If she resumes, she is clearly in a session with W, Impersonating a server leaks information about and not with W’. clients. Specifically, if they want to connect or

Unauthentifiziert | Heruntergeladen 17.02.20 20:33 UTC The privacy of the TLS 1.3 protocol 199

“Start new session” “Resume session with W using t” a)Alicet −−−−−−−−−−−−−−−−−→ W Alicet −−−−−−−−−−−−−−−−−−−−−−−−−−−→A “Resume session with W using t” b)Bob −−−−−−−−−−−−−−−−−→“Start new session” W A −−−−−−−−−−−−−−−−−−−−−−−−−−−→ W or W’? “Resume session using t” c)Alicet −−−−−−−−−−−−−−−−−→ W Fig. 8. The adversary reroutes a ticket meant for W to a server he is uncertain about. If the server accepts, it is W. If not, it is Fig. 6. Alice can either start a new session or resume an older some other website. one, while Bob can only start a new session. This makes them distinguishable. that exacerbates other types of attacks, such as session linking. Session Linking (Figure 7). An adversary can learn TLS’s pre-shared key only resumption mode does more about the identity of the participants in a session, not ensure perfect forward secrecy. Thus, once the ad- if he is able to “link” it to another one he knows more versary obtains the key material in a session, he can about. This is possible due to session resumption tickets compute the keys and secrets of their session resump- that appear identical in succeeding sessions. However, tion. to mount this attack, the adversary must first retrieve Session linking appeared when an adversary identi- the ticket, e.g., by decrypting the first message encod- fied the same ticket in a session and its resumption. If ing the ticket. The attack works as follows. We assume that session is instead resumed n number of times using the adversary obtains the transcripts of various proto- pre-shared key only resumption and the first session is col sessions, amongst which, a full handshake and its compromised, then an adversary could pair any of the resumption. Let us assume he has a way of “accessing” n sessions in order to obtain information about one of the ticket the server sent in the first session. Because he the parties. sees the same ticket in both sessions, he can conclude that one session is the resumption of the other. {Ticket t} Assume the adversary is uncertain about the iden- Alicek ←−−−−−−−−k Wk tity of the parties in one of the sessions. Due to this A obtains t and its associated preshared key. additional information (having linked the two sessions), Using the preshared key, A computes the he may now resolve this uncertainty. We illustrate one key schedule of subsequent resumptions. such example in Figure 7...... 0 0 {Ticket t } 0 0 Alicek ←−−−−−−−−−k Wk 0 0 “Resume session using t ” {Ticket t} t Alicek ←−−−−−−−−k Wk Alice or Bob? −−−−−−−−−−−−−−−−−−−−−−→ W A retrieves Alice’s ticket t. “Resume session using t” Alice or Bob?t −−−−−−−−−−−−−−−−−−−−−→ W Fig. 9. Assume the adversary compromises a session. Then he can A concludes Alice, and not Bob resumed the session. compromise any subsequent resumptions if they do not include a Diffie Hellman exchange. This allows him to mount the session linking attack even after an n-th resumption. Fig. 7. By seeing the same ticket in two sessions, the adversary concludes that one session is the resumption of the other one. Alice, who received the ticket in the initial session, is the party Ticket encryption key compromise (Figure 10). who resumed the session. Assume an adversary that knows the key a website W is using to encrypt its tickets. Next, the adversary tries to decrypt any tickets he sees on the network. If the Ticket redirection (Figure 8). Assume Alice wishes decryption succeeds, he knows the messages are meant to resume a session with a server unknown to the adver- for W. sary. To find out to whom Alice wishes to connect, the adversary will intercepts her first message in the proto- col and forward it to various servers. When he encoun- 3.3 Other attacks ters a server W that accepts the ticket, he has identified Alice’s intended website. There exist other implicit trivial attacks. First of all, Cascading pre-shared key compromise (Figure TLS allows the parties to propose from and choose be- 9). It’s not exactly a stand-alone attack, but a “feature” tween various cryptographic primitives and extensions. As a consequence, one can certainly distinguish between

Unauthentifiziert | Heruntergeladen 17.02.20 20:33 UTC The privacy of the TLS 1.3 protocol 200

A has W’s ticket encryption key. The adversary can create multiple vids, as long as a {Ticket t} Alicek ←−−−−−−−−k W or W’?k party is not bound inside two or more “active” vids at a A decrypts t, concludes Alice is talking to W time. He can also “activate” and “deactivate” the same if and only if decryption succeeds. vid multiple times.

Fig. 10. Assume that A has the long term ticket encryption key of a server W. He then decrypts any tickets on the network. If 4.2 Parties, instances and attributes decryption succeeds, the ticket is meant for W.

Let C = {Ci, Cj...} be a set of clients and S = {Si, Sj...} a set of servers. We denote by P = {P , P ...} the set parties that implement the protocol differently or do not i j of parties, namely the disjoint union S]C. Each party support the same extensions. This will happen in any has the following attributes: protocol that offers “freedom of choice”. But for sets of parties that implement the protocol in the same man- – pk and sk: the public key in the certificate and ner, our results apply. Secondly, traffic in the record the corresponding secret key. Clients have undefined layer can also be a distinguishing factor, for example certificates (⊥); by number of messages sent and received during a ses- – corr: a corruption attribute which is initialized to 0 sion. The model by Hevia and Micciancio [22] better (uncorrupted) and becomes 1 if the adversary has captures what happens at the record layer in terms of corrupted that party using a query; privacy, what guarantees we have and do not have. In our model, we only analyse the handshake. s A party may run multiple instances. We denote by πi th the s instance of the party Pi. We often substitute i s by vid, and πvid instantiates the real party behind a vid. 4 TLS full handshake mode Each instance possesses a series of attributes:

– pk, sk and corr, inherited from the real party behind In this section, we formally model the privacy of TLS’ a vid; full handshake mode (unilateral authentication and no – sid, a unique session identifier, used for matching resumption). We begin by introducing the concept of a instances. What constitutes the session identifier is virtual identifier. Next, we formally define the parties protocol specific. In some protocols, one party gen- and instances involved in the protocol, including their erates a unique string as the session identifier. In attributes. In the following section, we describe a set of Bellare-Rogaway models, two instances are involved auxiliary functions and lists that allow us to elaborate in the same session if their transcript, up to the the oracles and the winning conditions. We provide a last message, is the same. In the case of Π and theorem and a proof regarding the privacy achieved by TLS ΠTLS+res, we will consider the sid to be the concate- ΠTLS in this model. nation of the nonce of the client and the nonce of the server. Note that this constitues a subset of the transcript; 4.1 Virtual identifiers s – pid, the partner of πi , initialized to ⊥; – the accept bit, initialized to ⊥. It takes the value Central to our model is the concept of virtual identifier, 1 when the instance finishes in an accepting state or vid. The adversary has access to an oracle allowing and 0 if the instance aborts/rejects. A value of 1 him to bind together two parties, Pi and Pj. The output also implies that partner authentication succeeded of the oracle is a string vid=Pi|Pj, the concatenation (if it was the case); of the two parties. The adversary will use the vid to – the keys: C.htk - the client handshake traffic key, interact with the party “behind” it, which is either Pi S.htk - the server handshake traffic key, C.tk - the or Pj, based on a secret bit b. The adversary wins if he client traffic key and S.tk - the server traffic key; correctly identifies b, given certain winning conditions. – for all session keys key ∈ {C.htk, S.htk, C.tk, S.tk}, The adversary can choose Pi = Pj. Such sessions there exists a reveal bit ρ , set to 1 when the ad- help him learn more about the party and the protocol, key versary obtains the value of the key. but they leak no information about the bit b.

Unauthentifiziert | Heruntergeladen 17.02.20 20:33 UTC The privacy of the TLS 1.3 protocol 201

At the beginning of the privacy game we run an al- cess to the following oracles (we provide an extended gorithm called Setup(·). Setup(1λ) takes as input a secu- pseudocode form in Appendix B): rity parameter λ in unary notation. From the security b parameter we determine the nrsv (number of servers), – DrawParty (Pi, Pj) allows the adversary to obtain a nrcl (number of clients), and the keyspaces for all cryp- vid binding two parties, activating it. It adds Pi, Pj tographic primitives. We then initialize the parties and to Lact, creates a vid = Pi|Pj, adds vid to Lvid and create the keys for the servers. We initialize all lists to returns vid. This oracle aborts if type(Pi) 6= type(Pj) the empty list and any required cryptographic primi- (they are a server and a client) or one of the parties tives involved in the protocol. The set P containing all is already bound in an active vid at the time of the parties is then given to the adversary. query: Pi ∈ Lact ∨ Pj ∈ Lact. We also abort if the adversary queries two distinct clients: type(Pi) = type(Pj) = C ∧ Pi 6= Pj; 4.3 Auxiliary functions and lists – NewSession(vid, vid0) creates a new instance of a given active vid that will communicate with a speci- 0 s We also define a set of auxiliary functions and lists. fied partner vid . It returns a new instance πvid, with s 0 These are simply tools we use in modelling. πvid.pid = real(vid ). Its other attributes are set to default values. If vid = Pi|Sj with either Pi.corr = 1 s type(Pi) If Pi ∈ S, return S. Otherwise return C. or Pj.corr = 1, then πvid.corr = 1. If vid = Sk|Sl s s type(vid) Specifies whether the vid corresponds to a with Sk 6= Sl, we add πvid to Lchg. We add πvid to s client or a server. Let vid = Pi|Pj. If Pi, Pj ∈ Linst and return πvid. This oracle aborts if vid ∈/ Lvid, 0 0 S, return S. Otherwise return C. if vid ∈/ Lvid, or if type(vid) = type(vid ). The vids real(vid) Outputs the true party behind a vid. For all should be active at the time of the oracle call, and i, j, including i = j: they should partner with a party of the opposite If vid = Pi|Pj ∧ b = 0, return Pi. type. s If vid = Pi|Pj ∧ b = 1, return Pj. – Send(πvid, msg) enables an adversary to send the s 0 The bit b is uniformly randomly sampled by message msg to πvid and outputs msg , the next mes- s the challenger at the beginning of the privacy sage in the protocol. If πvid is a freshly-initialized s game. This function is not accessible by the client instance and msg is the string prompt, πvid s adversary. starts the protocol with πvid.pid. s – Reveal(πvid, key) returns to the adversary the key We further denote: s πvid.key, where key ∈ {C.htk, S.htk, C.tk, S.tk}, and s sets πvid.ρkey to 1. Lvid The list of active vids. A vid is active if it is the – Corrupt(Pi) is an oracle that returns Pi.sk and sets output of a DrawParty and it was not deactivated by Pi.corr to 1. This automatically updates any exist- a corresponding Free query. We detail these queries ing and future instances of a vid containing Pi: in the next section. A party can appear in at most s s ∀πvid, vid = Pi|Pj ∨ Pj|Pi, πvid.corr = 1. one active vid at a time. – Free(vid) allows the adversary to release the parties Lact The list of active parties. A party is active if it is from the binding of a vid and terminates any ses- part of an active vid. sions involving that vid. It removes vid from Lvid s Linst The list of all instances π ever created. vid and the corresponding parties from Lact. For all in- Lchg The challenge list contains the list of server in- stances of vid and all instances with pid = real(vid), stances such that their vid is binding distinct s s if πi .accept = ⊥, it sets πi .accept = 0 (session re- servers and they execute a full handshake. Oth- jected/aborted). s erwise said, it contains instances πvid such that vid = Sk|Sl, with Sk 6= Sl. 4.5 Privacy experiment

4.4 Adversarial oracles Roughly speaking, an adversary is capable of winning the privacy game if he is able to distinguish between The attack capabilities of a probabilistic polynomial two parties of his choice, either by identifying them or by time adversary A are modelled by providing him ac-

Unauthentifiziert | Heruntergeladen 17.02.20 20:33 UTC The privacy of the TLS 1.3 protocol 202

0 studying their behaviour. We formally define the privacy and at most qro queries to RO and q queries to all its game in Table 2. oracles is:

2 2 2 qi qi qro full.priv full.priv ≤ t + + r + qroCDH + 4qiprf + ExpΠ (A): 2 |G| 2 Setup(1λ); 1 $ + 2q  +  , b ← {0, 1} i stLHAE nrsv EUF-CMA b d ← ADrawParty (·,·),NewSession(·,·),Send(·,·),Reveal(·,·),Corrupt(·),Free(·)

∀vid ∈ Lvid, Free(vid) where CDH, prf , stLHAE, EUF-CMA represent the maxi- A wins if b = d and: mum advantage of an adversary against the CDH, prf, s t • ∀πvid ∈ Lchg ∃πvid0 ∈ Linst s.t. s t stLHAE, and EUF-CMA respectively. ◦ πvid.sid = πvid0 .sid s t ◦ πvid.accept = πvid0 .accept = 1 s t We provide the proof of Theorem 1 in the full version ◦ ∀key ∈ {S.htk}, πvid.ρkey = πvid0 .ρkey = 0 s t ◦ πvid.corr = πvid0 .corr = 0 of the paper [5]. Table 2. Privacy experiment.

5 TLS with session resumption The privacy game proceeds in the following way. λ First, the challenger runs Setup(1 ). He then uniformly Session resumption is an integral feature of the TLS samples a bit b. The adversary interacts with the chal- protocol. At the end of a handshake, a server can lenger, using the oracles that have been given to him. choose to send one or multiple tickets to a client. The Then the adversary outputs a bit d. The challenger Frees client may then use these tickest to “jumpstart” their all active vid, thus terminating any ongoing sessions if next sessions. In our extended model, we limit the ad- any still exist. The adversary wins the game if d = b versary to a single pair of clients or servers that he (he correctly determined b) and he fulfilled the winning can challenge in the game. Once he makes a valid conditions: query of the form DrawParty(Pi, Pj) with Pi 6= Pj and We require that for all server instances where the type(Pj) = type(Pj), we register the Pi, Pj parties as s vid binds distinct servers (∀πvid ∈ Lchg), there exists an “challenged”. The adversary is not allowed to compro- t honest client instance (∃πvid0 ∈ Linst) such that the two mise these parties, their instances or their partnering s instances have had a matching conversation (πvid.sid = parties/instances. He can fully compromise all other t πvid0 .sid), they were not trivially Revealed/opened by parties and sessions instead. s t the adversary (∀key ∈ {S.htk}, πvid.ρkey = πvid0 .ρkey = 0) Remember the trivial attack where Alice has a s and that they both accepted the session (πvid.accept = ticket, Bob does not, and an adversary can distinguish t πvid0 .accept = 1). This circumvents the first trivial at- them based on their (in)ability to resume a session. tack, where the adversary creates a session with a chal- For this reason, we make sure that parties have the lenge server and obtains its certificate. In addition, the same number of tickets given to/received from all par- adversary cannot corrupt the servers involved in the ties when creating a DrawParty query and when releasing s s t challenge (∀πvid ∈ Lchg, πvid.corr = πvid0 .corr = 0). This the challenge vid using Free. circumvents the second trivial attack, where the adver- sary impersonates one of the challenge servers to the users. 5.1 Global Lists

Definition 1. The advantage full.priv of an adversary In our model, we introduce two new lists, Lchg.pty and running in time t0 to win the game Expfull.priv is : ΠTLS Lchg.vid and modify the definition of Lchg.

full.priv 1 full.priv = P[A wins Exp ] − . L The list of parties the adversary queried as ΠTLS 2 chg.pty DrawParty(Pi, Pj) by the adversary, with Pi 6= t Theorem 1. Let G be a group of order |G|, let 2 be Pj. sessions. r the size of the nonce space, and let 2 be the size of Lchg.vid The list of vids to which particular winning con- the codomain of the RO. The advantage full.priv of an ditions apply. When the adversary queries for 0 adversary running in time t , interacting with at most the first time DrawParty(Pi, Pj) with Pi 6= Pj, nrsv servers, making at most qi queries to NewSession we register in this list Pi|Pj, Pj|Pi, Pi|Pi, Pj|Pj.

Unauthentifiziert | Heruntergeladen 17.02.20 20:33 UTC The privacy of the TLS 1.3 protocol 203

vid Lchg A subset of Linst, namely instances πs where – The handshake mode mode is an instance-specific vid ∈ Lchg.vid. attribute. There are three modes: mode ∈ {dhe, psk, psk + dhe}, corresponding to a full hand- shake mode, pre-shared key only mode, or a pre- 5.2 Local ticket management shared key with Diffie-Hellman key exchange. This attributes indicates which protocol the instance is Each party stores internally information about valid un- or will be following. used tickets. We refer to this data as Ltickets and call – k, a server party attribute, is the symmetric encryp- Pi.Ltickets the list associated to Pi. If any change oc- tion key that the server uses to encrypt and decrypt curs to the locally-stored list Pi.Ltickets, then all in- the tickets. This is ⊥ for clients. stances of Pi will instantly have access to the new list. – a (server) party attribute corrk. Initialized to 0, it The elements of Pi.Ltickets contain entries of the type becomes 1 when the adversary obtains the long term (STicket, rms, NT , S), detailed below. Server parties will encryption key of the server using a TCorrupt query store ⊥ for any attribute except the STicket. (defined below). For clients, this is ⊥.

STicket: the value of the ticket sent by the server to left(vid) If vid = Pi|Pj, returns Pi. the client. The client will resend this string when right(vid) If vid = Pi|Pj, returns Pj. resuming. The server will decrypt and authenticate count(Pi, Pj) Returns the number of tuples (tickets) in this string and, if this succeeds, he will use the in- Pi.Ltickets received from the Pj (if Pi is a formation stored inside to compute the pre-shared client and Pj is a server) or given to Pj key. (if Pi is a server and Pj is a client). rms: the value of the resumption master secret.

NT : the nonce used to compute the pre-shared key. We add one extra line to the Setup(·, ·) algorithm: S: The identity of the server who created the ticket (this chg = 0. This is a flag we will set once the adversary is used by the client to select the right ticket to makes a DrawParty query using two distinct parties (of resume). the same type).

Additionally, every instance stores two ticket tuples: the so called input ticket (in.STicket, in.rms, in.NT , psk) 5.4 Adversarial oracles referring to the ticket used in the resumption and out- put ticket (out.STicket, out.rms, out.NT ), the ticket cre- We define privacy in terms of a game similar to that ated/received at the end of the handshake. The prefixes one defined in the full mode. Indeed, the privacy game in and out distinguish between the two tuples. The psk is for resumption can be viewed as an extension of the part of the key scheduling, but we don’t need to com- much-simpler notion that we used on the full mode (cf. pute it at the end of session, so there is no need for an Section 4). The adversary interacts with the system via out.psk attribute. Also see Figure 11. oracles, as before. We briefly recall the purpose of each oracle and mention below only the changes and addi- tions we make to those oracles. We provide an extended s in.STicket t πvid πvid0 pseudocode form in Appendix B.

{..., out.STicket} b S.tk – DrawParty (Pi, Pj) outputs a vid binding two par- ties and activates it. In this model, the adversary Fig. 11. An intuitive figure to illustrate the in.STicket and s t is only allowed to query only one vid of the form out.STicket. πvid is a client instance and πvid0 is a server instance. Pi|Pj with Pi 6= Pj. We call this the challenge vid. We also allow creating the reverse of the challenge vid, namely P |P . When creating (or reactivating) 5.3 Additional attributes and lists j i a challenge vid, the query will return ⊥ if the par- ties do not have the same number of tickets. Succe- In addition to the previous lists, we also introduce the sive reactivations of the challenge vid or it reverse following attributes for both parties and instances. are permitted, as long as the condition regarding the number of tickets holds true. If chg = 0 and

Unauthentifiziert | Heruntergeladen 17.02.20 20:33 UTC The privacy of the TLS 1.3 protocol 204

P 6= P , we set chg to 1 and register P , P in L . Expres.priv (A): i j i j chg ΠTLS+res λ If chg = 1 and Pi 6= Pj, we abort if Pi ∨Pj ∈/ Lchg. If Setup(1 ); type (vid) = S, if there exists a client C such that b ←$ {0, 1} k b d ← ADrawParty (·,·),NewSession(·,·),Send(·,·),Reveal(·,·),Corrupt(·),TCorrupt(·),Free(·) count(left(vid), Ck) 6= count(right(vid), Ck), we abort. ∀vid ∈ Lact, Free(vid) If type (vid) = C, if there exists a server Sk such that A wins if b = d and: count(left(vid), Sk) 6= count(right(vid), Sk), we abort. • If Lchg.pty contains two clients: s 0 ◦ ∀πvid ∈ Lchg – NewSession(vid, vid , mode) serves to create a new s ∗ πvid.ρS.tk = 0 instance of a given active vid that will communicate t s s t ◦ ∀πvid0 ∈ Linst s.t.∃πvid ∈ Lchg, πvid.sid = πvid0 .sid 0 ∗ πt .ρ = πt .corr = πt .corr = 0 with a partner vid . If the vid is a client, type (vid ) vid0 S.tk vid0 vid0 k s • If Lchg.pty contains two servers: = C, we set πvid.mode=mode. If resuming, we also s s ◦ ∀πvid ∈ Lchg, πvid.ρS.tk = 0 t t t select a ticket from real (vid).Ltickets such that real ∗ πvid0 .ρS.tk = πvid0 .corr = πvid0 .corrk = 0 0 s s ∗ If πs .mode 6= dhe, πs .accept = 1 (vid )=S. We set π .in.rms , π .in.NT to the values vid vid vid vid ◦ ∀πt ∈ L s.t. ∃πs ∈ L , πs .sid = πt .sid s vid0 inst vid chg vid vid0 from the tuple and compute π .in.psk using the t vid ∗ πvid0 .ρS.tk = 0 s s t two values. We abort if resumption is demanded but ◦ ∀πvid ∈ Lchg s.t. πvid.mode = dhe∃πvid0 ∈ Linst s.t. ∗ πs .sid = πt .sid no ticket is available in (vid).Ltickets. vid vid0 ∗ πs .accept = πt .accept = 1 s vid vid0 – Send(π , msg) enables an adversary to send the s t vid ∗ ∀key ∈ {S.htk}, πvid.ρkey = πvid0 .ρkey = 0 s 0 message msg to πvid and outputs msg , the next Table 3. Resumption privacy experiment. message in the protocol. Also allows ticket creation. s If πvid is a server instance receiving its first mes- s s sage, we set πvid.mode accordingly. If πvid is a server instance that has accepted the session key The winning conditions can be described informally s as follows. We use Lchg to identify the sessions that are (πvid.accept = 1) and msg is the string prompt, then the server creates and sends a new session ticket to “challenged” and to which certain restrictions apply. For s the client, as defined by the protocol. example, for all sessions of challenge servers (∀πvid ∈ L ), we look for their matching client instances – TCorrupt(Pi) is a new, resumption-specific oracle. It chg t s s t allows the adversary to obtain the long-term ticket (∀πvid0 ∈ Linst s.t.∃πvid ∈ Lchg, πvid.sid = πvid0 .sid ). For client instances, the S.tk key must be fresh(πs .ρ = encryption key of a server. Therefore, it returns Pi.k vid S.tk 0). For server instances, their S.tk key must be fresh and and sets Pi.corrk to 1. s – Free(vid) Inactivates a vid. In case of a challenge their long term keys must be uncorrupted (πvid.corr = s vid or its reverse, we delete the minimum of tickets πvid.corrk = 0). If the adversary is trying to attack to dis- to make the parties indistinguishable by number of tinguish between two servers, two additional constraints tickets given to or received from another party. apply. First of all, the winning conditions from the first model apply (last white bullet point) to all challenge s full handshake sessions(πvid.mode = dhe). Additionally, 5.5 Privacy experiment all resuming challenge server instances must accept the s s session(If πvid.mode 6= dhe, πvid.accept = 1). This pre- Informally speaking, it should be impossible for an ad- vents ticket redirection attacks. versary to distinguish between two parties, even when Definition 2. The advantage  of an adversary adding the possibility of session resumption. We for- full.priv 0 full.priv res.priv running in time t to win the game Exp is : mally define the privacy experiment Exp (A) in ΠTLS+res ΠTLS+res Figure 3. The privacy game consists in an interaction full.priv 1 full.priv = P[A wins Exp ] − . between a challenger and an adversary as described be- ΠTLS+res 2 fore. t Theorem 2. Let G be a group of order |G|, let 2 be the size of the nonce space, and let 2r be the size of the

codomain of the RO. The advantage full.priv of an adver- sary running in time t0, interacting with at most nrsv

servers, making at most qi queries to NewSession,qSend 0 queries to Send, qro queries to RO and q queries to all

Unauthentifiziert | Heruntergeladen 17.02.20 20:33 UTC The privacy of the TLS 1.3 protocol 205 its oracles is: extension).TLS 1.3 is run as part of a stack of proto-

2 2 2 cols, not all of which are privacy-preserving. We discuss qi qi qro res.priv ≤ + + + qroCDH + 8qiprf + the limitations of our results in that sense both in Sec- 2t |G| 2r 1 tion 1.4 and in Section 1.5. One of the main problems + (3q + q ) +  , i Send stLHAE nrsv EUF-CMA of the encapsulation of TLS messages appears at the network layer. The best bet to achieve better privacy in where CDH, prf , stLHAE, EUF-CMA represent the maxi- this context is to use protocols such as Tor; however, to mum advantage of an adversary against the CDH, prf, our knowledge, no current result for Tor would allow for stLHAE, and EUF-CMA respectively. a composition with the type of property we are proving here. We provide the proof of Theorem 1 in the full version of the paper [5]. Acknowledgements 6 TLS 1.3 privacy in perspective The authors thank the anonymous reviewers of PETS for their helpful comments. This work was sup- Our results show that TLS 1.3, when considered in iso- ported in part by the French Agence Nationale lation, does provide some measure of privacy. For full de Recherche(ANR) through grant 16 CE39 0012 handshakes, the protocol provides a notion of server un- (SafeTLS). linkability, which must be relaxed in order to account for the server-only authentication of the protocol. By contrast, session resumption introduces a means of linking sessions between the same two parties. The References simple fact of possessing and using a resumption ticket already leaks out some information about a party (the [1] David Adrian, Kartihkeyan Bhargavan, Zakir Durumeric, existence of at least one session in the past). We showed Pierrick Gaudry, Matthew Green, J. Alex Halderman, Nadia Heninger, Drew Springall, Emmanuel Thomé, Benjamin in this paper that TLS 1.3 privacy does indeed suffer VanderSloot, Eric Wustrow, Santiago Zanella Béguelin, and when resumption is considered; however, this lack of Paul Zimmermann. Imperfect forward secrecy: How Diffie- privacy seems inherent to the use of session tickets. In Hellman fails in practice. In Proceedings of ACM CCS 2015, that sense, TLS 1.3 offers an optimal degree of privacy. pages 5–17. IEEE, 2015. The results we prove in this paper depend heav- [2] Nadhem J. AlFardan, Daniel J. Bernstein, Kenneth G. Pa- ily on how session tickets are implemented. In this pa- terson, Bertram Poettering, and Jacob C. N. Schuldt. On the security of RC4 in TLS and WPA. In USENIX Security per we included only one such implementation, which is Symposium, 2013. also featured in WolfSSL: namely, the server encrypts [3] Nadhem J. AlFardan and Kenneth G. Paterson. Lucky thir- the session resumption-state with a long-term symmet- teen: Breaking the TLS and DTLS record protocols. In IEEE ric key known only to itself. Alternative approaches are Symposium on Security and Privacy (SP’13), 2013. also possible. In our proof, we replace the session ticket [4] Antoine Delignat-Lavaud and Kartihkeyan Bhargavan. Network-based origin confusion attacks against HTTPS in question with a random string of the same length; es- virtual hosting. In Proceedings of WWW’15, pages 227–237. sentially any other implementation of session tickets for Springer, 2015. which this can still hold would provide the same degree [5] Ghada Arfaoui, Xavier Bultel, Pierre-Alain Fouque, Adina of privacy. Nedelcu, and Cristina Onete. The privacy of the tls 1.3 Interestingly, this rules out session tickets that in- protocol. Cryptology ePrint Archive, Report 2019/749, clude public information, such as the session identifier 2019. https://eprint.iacr.org/2019/749. [6] Nimrod Aviram, Sebastian Schinzel, Juraj Somorovsky, of the session in which we generated the ticket. This Nadia Heninger, Maik Dankel, Jens Steube, Luke Valenta, would allow the adversary to immediately link that ses- David Adrian, J. Alex Halderman, Viktor Dukhovni, Emilia sion with the resumed session, thus winning the game. Käsper, Shaanan Cohney, Susanne Engels, Christof Paar, Similarly, just using a counter that is incremented at and Yuval Shavitt. Drown: Breaking TLS using SSLv2. every session also leads to privacy breaches. https://drownattack.com, 2016. [7] Michael Backes, Aniket Kate, Praveen Manoharan, Sebas- Future work could explore either TLS in conjunc- tian Meiser, and Esfandiar Mohammadi. Anoa: A framework tion of protocols in the network layer, or features of the for analyzing anonymous communication protocols. In Pro- TLS that we did not model (more significantly, the SNI

Unauthentifiziert | Heruntergeladen 17.02.20 20:33 UTC The privacy of the TLS 1.3 protocol 206

ceedings of CSF. IEEE, 2013. tional Conference on Cryptology in India, Bangalore, India, [8] Mihir Bellare and Phillip Rogaway. Entity authentication and December 6-9, 2015, Proceedings, pages 85–102, 2015. key distribution. In CRYPTO, pages 232–249, 1993. [25] Hugo Krawczyk. SIGMA: the ’sign-and-mac’ approach to [9] Benjamin Berdouche, Kartikeyan Bhargavan, Antoine authenticated diffie-hellman and its use in the ike-protocols. Delignat-Lavaud, Cédric Fournet, Markulf Kohlweiss, Alfredo In Advances in Cryptology - CRYPTO 2003, 23rd Annual Pironti, Pierre Yves Strub, and Jean Karim Zinzindohoue. A International Cryptology Conference, Santa Barbara, Califor- messy state of the union: Taming the composite state ma- nia, USA, August 17-21, 2003, Proceedings, pages 400–425, chines of TLS. In Proceedings of IEEE S&P 2015, pages 2003. 535–552. IEEE, 2015. [26] Hugo Krawczyk. Cryptographic extraction and key deriva- [10] Benjamin Beurdouche, Karthikeyan Bhargavan, Antoine tion: The HKDF scheme. In Advances in Cryptology — Delignat-Lavaud, Cédric Fournet, Markulf Kohlweiss, Alfredo CRYPTO 2010, volume 6223 of LNCS. Springer, 2010. Pironti, Pierre-Yves Strub, and Jean Karim Zinzindohoue. [27] Kenneth G. Paterson, Thomas Ristenpart, and Thomas A messy state of the union: Taming the composite state Shrimpton. Tag size does matter: Attacks and proofs for machines of TLS. In Proceedings of IEEE S&P 2015, pages the TLS record protocol. In Advances in Cryptology — 535–552. IEEE, 2015. ASIACRYPT 2011, volume 7073 of LNCS, pages 372–389. [11] Karthikeyan Bhargavan, Antoine Delignat-Lavaud, Cédric Springer-Verlag, 2011. Fournet, Alfredo Pironti, and Pierre-Yves Strub. Triple [28] Angelo Prado, Neal Harris, and Yoel Gluck. SSL, gone in 30 handshakes and cookie cutters: Breaking and fixing authen- seconds: A BREACH beyond CRIME. Black Hat 2013, 2013. tication over TLS. In Proceedings of IEEE S&P 2014, pages [29] Eric Rescorla. The Transport Layer Security (TLS) Protocol 98–113. IEEE, 2014. Version 1.3. RFC 8446, August 2018. [12] Karthikeyan Bhargavan and Gaetan Leurent. Transcript [30] Juliano Rizzo and Thai Duong. The CRIME attack. collision attacks: Breaking authentication in TLS, IKE, and Ekoparty 2012, 2012. SSH. In Accepted at NDSS 2016, to appear, 2016. [31] J. Rosenberg, H. Schulzrinne, G. Camarillo, A. Johnston, [13] Daniel Bleichenbacher. Chosen ciphertext attacks against J. Peterson, R. Sparks, M. Handley, and E. Schooler. SIP: protocols based on the RSA encryption standard pkcs #1. Session Initiation Protocol. RFC 3261, June 2002. In Proceedings of (CRYPTO’98), volume 1462 of LNCS, [32] Serge Vaudenay. Security flaws induced by CBC padding pages 1–12, 1998. – applications to SSL, IPSEC, WTLS. In Proceedings of [14] Tim Dierks and Eric Rescorla. The transport layer security EUROCRYPT 2002, volume 2332 of LNCS, pages 534–545, (TLS) protocol version 1.2. RFC 5246, August 2008. 2002. [15] Benjamin Dowling, Marc Fischlin, Felix Günther, and Dou- [33] Serge Vaudenay. On privacy models for RFID. In Advances glas Stebila. A cryptographic analysis of the TLS 1.3 hand- in cryptology – ASIACRYPT, volume 4833 of LNCS, pages shake protocol candidates. In ACM CCS, pages 1197–1210, 68–87. Springer, 2007. 2015. [34] Wikipedia. Global surveillance disclosures (2013–present). [16] Nir Drucker and Shay Gueron. Selfie: reflections on tls 1.3 with psk. Cryptology ePrint Archive, Report 2019/347, 2019. https://eprint.iacr.org/2019/347. [17] EU. General Data Protection Regulation - GDPR. [18] EU. Regulation on Privacy and Electronic Communications. A TLS and privacy-preservation [19] Marc Fischlin and Felix Günther. Multi-stage key exchange and the case of google’s QUIC protocol. In ACM CCS, Please note that we only focus on aspects that concern pages 1193–1204, 2014. [20] Pierre-Alain Fouque, Cristina Onete, and Benjamin Richard. privacy, rather than giving a complete analysis of the Achieving better privacy for the 3gpp aka protocol. In Pro- entire TLS protocol. For more details about the latter, ceedings of PETS (PoPETS), volume 4, 2016. we refer the interested reader to the TLS specifications. [21] Christina Garman, Kenneth G. Paterson, and Thyla Van der The design of the TLS protocol up to, and including Merwe. Attacks only get better: Password recovery attacks TLS 1.2 was not privacy-centric. Its goal was to sim- against RC4 in TLS. In Proceedings of USENIX 2015, pages ply allow two parties, a client and a server, to securely 113–128. USENIX Association, 2015. [22] Alejandro Hevia and Daniele Micciancio. An establish session keys. In the following paragraphs we indistinguishability-based characterization of anonymous describe the elements of TLS 1.2 which are relevant to channels. In Proceedings of PETS, volume 5134 of LNCS, privacy, then underline the differences between how TLS pages 24–43. Springer, 2008. 1.2 and TLS 1.3 handled those elements. [23] Jens Hermans and Andreas Pashalidis and Frederik Ver- cauteren and Bart Preneel. A New RFID Privacy Model. In The full handshake. In the full TLS 1.2 hand- Computer Security - ESORICS 2011 - 16th European Sym- shake, the client and server compute keys from a se- posium on Research in Computer Security, Leuven, Belgium, cret value called a pre-master secret, which they can September 12-14, 2011. Proceedings, 2011. both compute. The standard gives a choice of using [24] Markulf Kohlweiss, Ueli Maurer, Cristina Onete, Björn Tack- mann, and Daniele Venturi. (de-)constructing TLS 1.3. In several types of key-exchange methods: RSA, static Progress in Cryptology - INDOCRYPT 2015 - 16th Interna- Diffie-Hellman, ephemeral Diffie-Hellman or Anony-

Unauthentifiziert | Heruntergeladen 17.02.20 20:33 UTC The privacy of the TLS 1.3 protocol 207 mous Diffie-Hellman. In all but the Anonymous Diffie- secret, post-authentication keys from the master se- Hellman key-exchange cipher suite, the server has to cret), but this is done via independent calls to the provide a certificate for a public key – either used for key-derivation function. This has a dual effect: first signatures, or used for public-key encryption. The cer- nothing is revealed about the master secret in the tificate is sent in clear, allowing sessions featuring the execution of both handshakes and session resump- same server to be linked. Moreover, although TLS 1.2 tion; and secondly, learning one computed key does is mostly used in practice with server-only authentica- not immediately imply the insecurity of the other tion, RFC 5246 does allow the handshake to use mutual keys computed in that session. authentication as well, in which case the client had to – In TLS 1.3 all session keys (including the psk) are also provide a certificate to be sent in clear. computed using the entire protocol transcript, and It is worth noting that although TLS 1.3 does revo- not just the session nonces. This bypasses attacks lutionize the design of modern key-exchange protocols, such as the Triple Handshake attack [11] or version- its core key-exchange algorithm is signed ephemeral downgrade problems like FREAK or LogJam [1, 10], Diffie-Hellman, which was also used by TLS 1.2. One which rely on a Man-in-the-Middle changing pro- key difference is that in TLS 1.3 the certificate is no tocol parameters such that the key remains unaf- longer sent in clear, but rather, it is AEAD-encrypted fected. with keys derived from the so-called handshake secret. – A ticket-nonce is added in the computation of a new This has two immediate consequences: ticket, to prevent replays.

– The certificate, hence server identity, remains con- In terms of privacy, the changes made to the com- fidential as long as the adversary cannot break the putation of the preshared key psk will allow us to prove AEAD security of the encrypted message. This al- stronger privacy statements, by allowing the adversary lows us to formulate some privacy properties for the better corruption and revelation capabilities. However, use of ephemeral Diffie-Hellman in TLS 1.3, how- as we show in this paper, session resumption inherently ever, no such properties can be formulated for TLS brings some session linkability. This is how resumption 1.2. was designed, since the only way to authenticate the – The handshake secret is computed before the au- resumed key is by linking it to a key established in a thentication step takes place. This, ironically, de- fully-authenticated handshake. In this sense, both TLS tracts from the privacy of the full handshake, as it 1.2 and TLS 1.3 session resumption present serious pri- opens the door to trivial Man-in-the-Middle attacks vacy flaws despite not using concrete authentication el- which do not harm the security of the keys, but do ements, such as certificates. affect privacy. This is reflected in our winning con- In addition to PSK-only resumption, TLS 1.3 also ditions for the full-handshake privacy game. allows session to resume by using PSK-DHE hand- shakes. In this case, additional freshness is injected, by We also note that in giving less choice regarding the using two Diffie-Hellman elements, which are in their key-exchange algorithm, TLS 1.3 actually gains one pro- own turn not authenticated. While this provides a mea- tocol move, reducing the full handshake to three moves sure of backward security, it does nothing to improve (or 1.5 rounds). privacy. Session resumption. Session resumption was intro- The extension. The SNI duced as an orthogonal mechanism that allows TLS 1.2 extension is indeed a very interesting feature of TLS 1.3, connections to bypass length authentication and derive which somehow expands the scope of the privacy game. fresh session keys based on previously-authenticated We did initially want to include this extension in our keys. In the case of TLS 1.2 the new keys are de- analysis; however, it soon became clear that the task rived from the resumed session nonces and the previous- of defining and quantifying privacy in that context is session’s master secret. In many ways, TLS 1.2 ses- far from being a trivial extension of our current result. sion resumption resembles TLS 1.3 PSK-only session First, note that although non-trivial, it would not be resumption, with a few key differences: overly hard to extended the model mechanics (syntax, oracles) to capture multiple domains. When defining – In TLS 1.3 all session keys (including the pre-shared privacy in that context, however, we would no longer be secret psk value) are computed from the same se- speaking of server- and client-, but rather server-, client- crets (early keys are computed from the handshake

Unauthentifiziert | Heruntergeladen 17.02.20 20:33 UTC The privacy of the TLS 1.3 protocol 208

, and domain-privacy. This raises serious complications in terms of the restrictions on the adversary’s actions in the winning conditions, since (a) not all domains exist on all servers(implicitly allowing an adversary to distin- guish between potential servers); (b) the fact that the domain name appears in cleartext in the full handshake may implicitly make that domain name traceable if the parties subsequently resume. In our opinion, this topic is relevant and deserves its own paper.

B Pseudocode oracles

In this section we provide a pseudocode version of the adversarial oracles appearing in Section 4 and Section 5. In particular, we abstract the features from the Send oracle that heavily depend on the description of the pro- tocol in Figure 12 and Figure 13.

– Update sid: Whenever we receive a message, if the message is valid, we concatenate it to sid. Two sids are equal if they coincide up to the last message re- ceived. To sid we concatenate the unencrypted mes- sage, not the one directly sent on the network. s – Update πvidLtickets: When the server sends or the client receives its ticket, we update its internal

Ltickets by adding it. When the client sends its ticket or server receives it, we update its internal Ltickets by deleting it. This models ticket anti-replay be- haviour.

– Update Ltickets (in Free): We delete the minimal number of tickets such that, at the end of the execu- tion of Free, the two parties have the same number of tickets with regards to all parties. This is done in a “first in, first out” manner.

Unauthentifiziert | Heruntergeladen 17.02.20 20:33 UTC The privacy of the TLS 1.3 protocol 209

λ Setup(1 ) DrawParty(Pi, Pj)

λ Compute nrcl, nrsv from 1 if Pi ∈ Lact ∨ Pj ∈ Lact

P = ∅, Lvid = ∅, Lact = ∅, Linst = ∅, Lchg = ∅ return ⊥

for i := 1 to nrcl do if type(Pi) 6= type(Pj )

Ci.pk = ⊥ return ⊥

Ci.sk = ⊥ if type(Pi) = type(Pj ) = C ∧ Pi 6= Pj

Ci.corr = 0 return ⊥

P = P ∪ {Ci} Lact ← Lact ∪ {Pi, Pj }

for k := 1 to nrsv do Lvid ← Lvid ∪ vid

(Sk.pk, Sk.sk) = Sign.Gen() vid ← Pi|Pj

Sk.corr = 0 return vid

P = P ∪ {Sk} s Send(πvid, msg) 0 NewSession(vid, vid ) s if πvid.freed = 1 0 if vid ∈/ Lvid ∨ vid ∈/ Lvid return ⊥ s return ⊥ if msg = prompt ∧ type(vid) = C ∧ πvid.sid = ⊥ s if type(vid) = type(vid) Update πvid.sid 0 s return ⊥ return msg (Start protocol with πvid.pid) s 0 πvid.pid ← real(vid ) if msg is valid s s πvid.sid ← ⊥ Update πvid.sid s 0 πvid.pk ← real(vid).pk return msg s πvid.sk ← real(vid).sk else return ⊥ s πvid.corr ← real(vid).corr

if vid = Si|Sj ∧ (Si.corr = 1 ∨ Sj .corr = 1) Free(vid) πs .corr = 1 vid Lvid = Lvid − vid; πs .freed ← 0 vid if vid = Pi|Pj πs .accept, πs .C.htk, πs .S.htk, πs .C.tk, πs .S.tk ← ⊥ vid vid vid vid vid Lact = Lact − {Pi, Pj } if vid = Sk|Sl ∧ Sk 6= Sl s for πvid ∈ Linst Lchg ← Lchg ∪ vid s if πvid.accept = ⊥ s Linst ← Linst ∪ πvid s πvid.accept = 0 s return πvid s πvid.freed = 1 t for πvid0 ∈ Linst s Reveal(π , key) s t t vid if πvid.sid = πvid0 .sid ∧ πvid0 .accept = ⊥ s t πvid.key = 1 πvid0 .accept = 0 s t return πvid.key πvid0 .freed = 1

Corrupt(Pi)

Pi.corr = 1 s ∀πvid, vid = Pi|Pj ∨ vid = Pj |Pi s πvid.corr = 1

return Pi.sk

Fig. 12. Adversarial oracles in the full handshake mode model.

Unauthentifiziert | Heruntergeladen 17.02.20 20:33 UTC The privacy of the TLS 1.3 protocol 210

λ Setup(1 ) DrawParty(Pi, Pj)

λ Compute nrcl, nrsv from 1 if Pi ∈ Lact ∨ Pj ∈ Lact

P = ∅, Lvid = ∅, Lact = ∅, Linst = ∅, Lchg = ∅ return ⊥

for i := 1 to nrcl do if type(Pi) 6= type(Pj )

Ci.pk = ⊥, Ci.sk = ⊥, Ci.corr = 0 return ⊥

P = P ∪ {Ci} if Pi 6= Pj ∧ chg = 0

for k := 1 to nrsv do chg = 1, Lchg.pty = {Pi, Pj }

(Sk.pk, Sk.sk) = Sig.Gen() if Pi 6= Pj ∧ chg = 1

Sk.corr = 0 if Pi ∈/ Lchg.pty ∨ Pj ∈/ Lchg.pty

P = P ∪ {Sk} if type(Pi) = type(Pj ) = C

chg = 0 if ∃Sk, count(left(vid), Sk) 6= count(right(vid), Sk) return ⊥ 0 NewSession(vid, vid , mode) if type(Pi) = type(Pj ) = S

0 if ∃Ck, count(left(vid), Ck) 6= count(right(vid), Ck) if vid ∈/ Lvid ∨ vid ∈/ Lvid return ⊥ return ⊥ if type(vid) = type(vid) Lact ← Lact ∪ {Pi, Pj }, Lvid ← Lvid ∪ vid return ⊥ return vid ← Pi|Pj s 0 πvid.pid ← real(vid ) s s Send(π , msg) πvid.sid ← ⊥ vid s s πvid.pk ← real(vid).pk if πvid.freed = 1 s πvid.sk ← real(vid).sk return ⊥ s s πvid.corr ← real(vid).corr if msg = prompt ∧ type(vid) = C ∧ πvid.sid = ⊥ s if vid = Si|Sj ∧ (Si.corr = 1 ∨ Sj .corr = 1) Update πvid.sid s 0 s πvid.corr = 1 return msg (Start protocol with πvid.pid) s πvid.freed ← 0 if msg is valid s s s s s s πvid.accept, πvid.C.htk, πvid.S.htk, πvid.C.tk, πvid.S.tk ← ⊥ Update πvid.Ltickets if/as needed s if vid = Sk|Sl ∧ Sk 6= Sl Update πvid.sid 0 Lchg ← Lchg ∪ vid return msg s Linst ← Linst ∪ πvid else return ⊥ if type(vid) = C s πvid.mode = mode Free(vid) if πs .mode 6= dhe ∧ count(real(vid), real(vid0) = 0 vid Lvid = Lvid − vid; return ⊥ if vid = Pi|Pj if πs .mode 6= dhe vid Lact = Lact − {Pi, Pj } 0 real(vid).Ltickets = real(vid).Ltickets − (STicket, rms, t, real(vid )) s for πvid ∈ Linst s s s πvid.in.STicket = STicket, πvid.in.rms = rms, πvid.in.NT = NT s if πvid.accept = ⊥ s return πvid s πvid.accept = 0 s πvid.freed = 1 TCorrupt(Pi) t for πvid0 ∈ Linst s t t Pi.corrk = 1 if πvid.sid = πvid0 .sid ∧ πvid0 .accept = ⊥ s t t ∀vid, real(vid) = Pi, πvid.corrk = 1 πvid0 .accept = 0, πvid0 .freed = 1

return Pi.k if vid ∈ Lchg.vid update Ltickets such that

∀Pk, count(left(vid), Pk) 6= count(right(vid), Pk)

Fig. 13. Adversarial oracles in the extended model. See Figure 12 for the Reveal and Corrupt oracles.

Unauthentifiziert | Heruntergeladen 17.02.20 20:33 UTC