idnits 2.17.1 draft-ietf-tokbind-https-07.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 : ---------------------------------------------------------------------------- ** There is 1 instance of too long lines in the document, the longest one being 2 characters in excess of 72. ** The abstract seems to contain references ([RFC5246], [I-D.ietf-tokbind-protocol]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (November 23, 2016) is 2711 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) == Unused Reference: 'RFC6750' is defined on line 944, but no explicit reference was found in the text == Outdated reference: A later version (-14) exists of draft-ietf-tokbind-negotiation-05 == Outdated reference: A later version (-19) exists of draft-ietf-tokbind-protocol-10 ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Obsolete normative reference: RFC 7230 (Obsoleted by RFC 9110, RFC 9112) ** Obsolete normative reference: RFC 7231 (Obsoleted by RFC 9110) -- Obsolete informational reference (is this intentional?): RFC 7540 (Obsoleted by RFC 9113) Summary: 5 errors (**), 0 flaws (~~), 4 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Internet Engineering Task Force A. Popov 3 Internet-Draft M. Nystroem 4 Intended status: Standards Track Microsoft Corp. 5 Expires: May 27, 2017 D. Balfanz, Ed. 6 A. Langley 7 Google Inc. 8 J. Hodges 9 Paypal 10 November 23, 2016 12 Token Binding over HTTP 13 draft-ietf-tokbind-https-07 15 Abstract 17 This document describes a collection of mechanisms that allow HTTP 18 servers to cryptographically bind authentication tokens (such as 19 cookies and OAuth tokens) to TLS [RFC5246] connections. 21 We describe both _first-party_ and _federated_ scenarios. In a 22 first-party scenario, an HTTP server is able to cryptographically 23 bind the security tokens it issues to a client, and which the client 24 subsequently returns to the server, to the TLS connection between the 25 client and server. Such bound security tokens are protected from 26 misuse since the server can generally detect if they are replayed 27 inappropriately, e.g., over other TLS connections. 29 Federated token bindings, on the other hand, allow servers to 30 cryptographically bind security tokens to a TLS connection that the 31 client has with a _different_ server than the one issuing the token. 33 This Internet-Draft is a companion document to The Token Binding 34 Protocol [I-D.ietf-tokbind-protocol] 36 Status of This Memo 38 This Internet-Draft is submitted in full conformance with the 39 provisions of BCP 78 and BCP 79. 41 Internet-Drafts are working documents of the Internet Engineering 42 Task Force (IETF). Note that other groups may also distribute 43 working documents as Internet-Drafts. The list of current Internet- 44 Drafts is at http://datatracker.ietf.org/drafts/current/. 46 Internet-Drafts are draft documents valid for a maximum of six months 47 and may be updated, replaced, or obsoleted by other documents at any 48 time. It is inappropriate to use Internet-Drafts as reference 49 material or to cite them other than as "work in progress." 51 This Internet-Draft will expire on May 27, 2017. 53 Copyright Notice 55 Copyright (c) 2016 IETF Trust and the persons identified as the 56 document authors. All rights reserved. 58 This document is subject to BCP 78 and the IETF Trust's Legal 59 Provisions Relating to IETF Documents 60 (http://trustee.ietf.org/license-info) in effect on the date of 61 publication of this document. Please review these documents 62 carefully, as they describe your rights and restrictions with respect 63 to this document. Code Components extracted from this document must 64 include Simplified BSD License text as described in Section 4.e of 65 the Trust Legal Provisions and are provided without warranty as 66 described in the Simplified BSD License. 68 Table of Contents 70 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 71 1.1. Requirements Language . . . . . . . . . . . . . . . . . . 3 72 2. The Sec-Token-Binding Header Field . . . . . . . . . . . . . 4 73 2.1. HTTPS Token Binding Key Pair Scoping . . . . . . . . . . 5 74 3. TLS Renegotiation . . . . . . . . . . . . . . . . . . . . . . 5 75 4. First-party Use Cases . . . . . . . . . . . . . . . . . . . . 6 76 5. Federation Use Cases . . . . . . . . . . . . . . . . . . . . 6 77 5.1. Introduction . . . . . . . . . . . . . . . . . . . . . . 6 78 5.2. Overview . . . . . . . . . . . . . . . . . . . . . . . . 6 79 5.3. HTTP Redirects . . . . . . . . . . . . . . . . . . . . . 8 80 5.4. Negotiated Key Parameters . . . . . . . . . . . . . . . . 10 81 5.5. Federation Example . . . . . . . . . . . . . . . . . . . 10 82 6. Implementation Considerations . . . . . . . . . . . . . . . . 13 83 7. Security Considerations . . . . . . . . . . . . . . . . . . . 13 84 7.1. Security Token Replay . . . . . . . . . . . . . . . . . . 13 85 7.2. Triple Handshake Vulnerability in TLS 1.2 and Older TLS 86 Versions . . . . . . . . . . . . . . . . . . . . . . . . 13 87 7.3. Sensitivity of the Sec-Token-Binding Header . . . . . . . 14 88 7.4. Securing Federated Sign-On Protocols . . . . . . . . . . 15 89 8. Privacy Considerations . . . . . . . . . . . . . . . . . . . 17 90 8.1. Scoping of Token Binding Keys . . . . . . . . . . . . . . 17 91 8.2. Life Time of Token Binding Keys . . . . . . . . . . . . . 17 92 8.3. Correlation . . . . . . . . . . . . . . . . . . . . . . . 18 93 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 18 94 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 19 95 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 19 96 11.1. Normative References . . . . . . . . . . . . . . . . . . 19 97 11.2. Informative References . . . . . . . . . . . . . . . . . 20 98 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 21 100 1. Introduction 102 The Token Binding Protocol [I-D.ietf-tokbind-protocol] defines a 103 Token Binding ID for a TLS connection between a client and a server. 104 The Token Binding ID of a TLS connection is related to a private key, 105 that the client proves possession of to the server, and is long-lived 106 (i.e., subsequent TLS connections between the same client and server 107 have the same Token Binding ID). When issuing a security token (e.g. 108 an HTTP cookie or an OAuth token) to a client, the server can include 109 the Token Binding ID in the token, thus cryptographically binding the 110 token to TLS connections between that particular client and server, 111 and inoculating the token against abuse (re-use, attempted 112 impersonation, etc.) by attackers. 114 While the Token Binding Protocol [I-D.ietf-tokbind-protocol] defines 115 a message format for establishing a Token Binding ID, it does not 116 specify how this message is embedded in higher-level protocols. The 117 purpose of this specification is to define how TokenBindingMessages 118 are embedded in HTTP (both versions 1.1 [RFC7230] and 2 [RFC7540]). 119 Note that TokenBindingMessages are only defined if the underlying 120 transport uses TLS. This means that Token Binding over HTTP is only 121 defined when the HTTP protocol is layered on top of TLS (commonly 122 referred to as HTTPS). 124 HTTP clients establish a Token Binding ID with a server by including 125 a special HTTP header field in HTTP requests. The HTTP header field 126 value is a base64url-encoded TokenBindingMessage. 128 TokenBindingMessages allow clients to establish multiple Token 129 Binding IDs with the server, by including multiple TokenBinding 130 structures in the TokenBindingMessage. By default, a client will 131 establish a _provided_ Token Binding ID with the server, indicating a 132 Token Binding ID that the client will persistently use with the 133 server. Under certain conditions, the client can also include a 134 _referred_ Token Binding ID in the TokenBindingMessage, indicating a 135 Token Binding ID that the client is using with a _different_ server 136 than the one that the TokenBindingMessage is sent to. This is useful 137 in federation scenarios. 139 1.1. Requirements Language 141 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 142 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 143 document are to be interpreted as described in [RFC2119]. 145 2. The Sec-Token-Binding Header Field 147 Once a client and server have negotiated the Token Binding Protocol 148 with HTTP/1.1 or HTTP/2 (see [I-D.ietf-tokbind-protocol] and 149 [I-D.ietf-tokbind-negotiation]), clients MUST include the Sec-Token- 150 Binding header field in their HTTP requests. The ABNF of the Sec- 151 Token-Binding header field is (in [RFC7230] style, see also [RFC7231] 152 Section 8.3): 154 Sec-Token-Binding = EncodedTokenBindingMessage 156 The header field name is "Sec-Token-Binding" and its value is a 157 base64url encoding of the TokenBindingMessage defined in 158 [I-D.ietf-tokbind-protocol] using the URL- and filename-safe 159 character set described in Section 5 of [RFC4648], with all trailing 160 pad characters '=' omitted and without the inclusion of any line 161 breaks, whitespace, or other additional characters. 163 For example: 165 Sec-Token-Binding: 167 The TokenBindingMessage MUST contain one TokenBinding structure with 168 TokenBindingType of provided_token_binding, which MUST be signed with 169 the Token Binding private key used by the client for connections 170 between itself and the server that the HTTP request is sent to 171 (clients use different Token Binding keys for different servers, see 172 Section 2.1 below). The Token Binding ID established by this 173 TokenBinding is called a _Provided Token Binding ID_. 175 The TokenBindingMessage MAY also contain one TokenBinding structure 176 with TokenBindingType of referred_token_binding, as specified in 177 Section 5.3. In addition to the latter, or rather than the latter, 178 the TokenBindingMessage MAY contain other TokenBinding structures. 179 This is use case-specific, and such use cases are outside the scope 180 of this specification. 182 A TokenBindingMessage is validated by the server as described in 183 Section 4.2. "Server Processing Rules" of 184 [I-D.ietf-tokbind-protocol]. If validaion fails and a Token Binding 185 is rejected, any associated bound tokens MUST also be rejected by the 186 server. HTTP requests containing invalid tokens MUST be rejected. 187 In this case, the server application may return HTTP status code 400 188 (Bad Request) or proceed with an application-specific invalid token 189 response (e.g. directing the client to re-authenticate and present a 190 different token), or terminate the connection. 192 In HTTP/2, the client SHOULD use Header Compression [RFC7541] to 193 avoid the overhead of repeating the same header field in subsequent 194 HTTP requests. 196 2.1. HTTPS Token Binding Key Pair Scoping 198 HTTPS is used in conjunction with various application protocols, and 199 application contexts, in various ways. For example, general purpose 200 Web browsing is one such HTTP-based application context. Within the 201 latter context, HTTP cookies [RFC6265] are typically utilized for 202 state management, including client authentication. A related, though 203 distinct, example of other HTTP-based application contexts is where 204 OAuth tokens [RFC6749] are utilized to manage authorization for 205 third-party application access to resources. The token scoping rules 206 of these two examples can differ: the scoping rules for cookies are 207 concisely specified in [RFC6265], whereas OAuth is a framework and 208 defines various token types with various scopings, some of which are 209 determined by the encompassing application. 211 The Token Binding key pair scoping for those key pairs generated by 212 Web browsers in the context of the first-party and federation use 213 cases defined in this specification (below), and to be used for 214 binding HTTP cookies MUST be at the granularity of "effective top- 215 level domain (public suffix) + 1" (eTLD+1), i.e., at the same 216 granularity at which cookies can be set (see [RFC6265]). Key pairs 217 used to bind other application tokens, such as OAuth tokens or Open 218 ID Connect "ID Tokens", SHOULD generally adhere to the above eTLD+1 219 scoping requirement for those tokens being employed in first-party or 220 federation scenarios as described below. Applications other than Web 221 browsers MAY use different key scoping rules. See also Section 8.1, 222 below. 224 Scoping rules for other HTTP-based application contexts are outside 225 the scope of this specification. 227 3. TLS Renegotiation 229 Token Binding over HTTP/1.1 [RFC7230] can be performed in combination 230 with TLS renegotiation. In this case, renegotiation MUST only occur 231 between a client's HTTP request and the server's response, the client 232 MUST NOT send any pipelined requests, and the client MUST NOT 233 initiate renegotiation (i.e. the client may only send a renegotiation 234 ClientHello in response to the server's HelloRequest). These 235 conditions ensure that both the client and the server can clearly 236 identify which TLS Exported Keying Material value [RFC5705] to use 237 when generating or verifying the TokenBindingMessage. This also 238 prevents a TokenBindingMessage from being split across TLS 239 renegotiation(s). 241 4. First-party Use Cases 243 In a first-party use case, an HTTP server issues a security token 244 such as a cookie (or similar) to a client, and expects the client to 245 return the security token at a later time, e.g., in order to 246 authenticate. Binding the security token to the TLS connection 247 between client and server protects the security token from misuse 248 since the server can detect if the security token is replayed 249 inappropriately, e.g., over other TLS connections. 251 See [I-D.ietf-tokbind-protocol] Section 6 for general guidance 252 regarding binding of security tokens and their subsequent validation. 254 5. Federation Use Cases 256 5.1. Introduction 258 For privacy reasons, clients use different private keys to establish 259 Provided Token Binding IDs with different servers. As a result, a 260 server cannot bind a security token (such as an OAuth token or an 261 OpenID Connect identity token) to a TLS connection that the client 262 has with a different server. This is, however, a common requirement 263 in federation scenarios: For example, an Identity Provider may wish 264 to issue an identity token to a client and cryptographically bind 265 that token to the TLS connection between the client and a Relying 266 Party. 268 In this section we describe mechanisms to achieve this. The common 269 idea among these mechanisms is that a server (called the _Token 270 Consumer_ in this document) signals to the client that it should 271 reveal the Provided Token Binding ID that is used between the client 272 and itself, to another server (called the _Token Provider_ in this 273 document). Also common across the mechanisms is how the Token 274 Binding ID is revealed to the Token Provider: The client uses the 275 Token Binding Protocol [I-D.ietf-tokbind-protocol], and includes a 276 TokenBinding structure in the Sec-Token-Binding HTTP header field 277 defined above. What differs between the various mechanisms is _how_ 278 the Token Consumer signals to the client that it should reveal the 279 Token Binding ID to the Token Provider. Below we specify one such 280 mechanism, which is suitable for redirect-based interactions between 281 Token Consumers and Token Providers. 283 5.2. Overview 285 In a Federated Sign-On protocol, an Identity Provider issues an 286 identity token to a client, which sends the identity token to a 287 Relying Party to authenticate itself. Examples of this include 288 OpenID Connect (where the identity token is called "ID Token") and 289 SAML (where the identity token is a SAML assertion). 291 To better protect the security of the identity token, the Identity 292 Provider may wish to bind the identity token to the TLS connection 293 between the client and the Relying Party, thus ensuring that only 294 said client can use the identity token: The Relying Party will 295 compare the Token Binding ID in the identity token with the Token 296 Binding ID of the TLS connection between it and the client. 298 This is an example of a federation scenario, which more generally can 299 be described as follows: 301 o A Token Consumer causes the client to issue a token request to the 302 Token Provider. The goal is for the client to obtain a token and 303 then use it with the Token Consumer. 305 o The client delivers the token request to the Token Provider. 307 o The Token Provider issues the token. The token is issued for the 308 specific Token Consumer who requested it (thus preventing 309 malicious Token Consumers from using tokens with other Token 310 Consumers). The token is, however, typically a bearer token, 311 meaning that any client can use it with the Token Consumer, not 312 just the client to which it was issued. 314 o Therefore, in the previous step, the Token Provider may want to 315 include in the token the Token-Binding public key that the client 316 uses when communicating with the Token Consumer, thus _binding_ 317 the token to client's Token-Binding keypair. The client proves 318 possession of the private key when communicating with the Token 319 Consumer through the Token Binding Protocol 320 [I-D.ietf-tokbind-protocol], and reveals the corresponding public 321 key of this keypair as part of the Token Binding ID. Comparing 322 the public key from the token with the public key from the Token 323 Binding ID allows the Token Consumer to verify that the token was 324 sent to it by the legitimate client. 326 o To allow the Token Provider to include the Token-Binding public 327 key in the token, the Token Binding ID (between client and Token 328 Consumer) must therefore be communicated to the Token Provider 329 along with the token request. Communicating a Token Binding ID 330 involves proving possession of a private key and is described in 331 the Token Binding Protocol [I-D.ietf-tokbind-protocol]. 333 The client will perform this last operation (proving possession of a 334 private key that corresponds to a Token Binding ID between the client 335 and the Token Consumer while delivering the token request to the 336 Token Provider) only if the Token Consumer requests the client to do 337 so. 339 Below, we specify how Token Consumers can signal this request in 340 redirect-based federation protocols. Note that this assumes that the 341 federated sign-on flow starts at the Token Consumer, or at the very 342 least include a redirect from Token Consumer to Token Provider. It 343 is outside the scope of this document to specify similar mechanisms 344 for flows that do not include such redirects. 346 5.3. HTTP Redirects 348 When a Token Consumer redirects the client to a Token Provider as a 349 means to deliver the token request, it SHOULD include a Include- 350 Referred-Token-Binding-ID HTTP response header field in its HTTP 351 response. The ABNF of the Include-Referred-Token-Binding-ID header 352 is (in [RFC7230] style, see also [RFC7231] Section 8.3): 354 Include-Referred-Token-Binding-ID = "true" 356 Where the header field name is "Include-Referred-Token-Binding-ID", 357 and the field-value of "true" is case-insensitive. For example: 359 Include-Referred-Token-Binding-ID: true 361 Including this response header field signals to the client that it 362 should reveal, to the Token Provider, the Token Binding ID used 363 between itself and the Token Consumer. In the absence of this 364 response header field, the client will not disclose any information 365 about the Token Binding used between the client and the Token 366 Consumer to the Token Provider. 368 As illustrated in Section 5.5, when a client receives this header 369 field, it should take the TokenBindingID of the provided TokenBinding 370 from the referrer and create a referred TokenBinding with it to 371 include in the TokenBindingMessage on the redirect request. In other 372 words, the Token Binding message in the redirect request to the Token 373 Provider now includes one provided binding and one referred binding, 374 the latter constructed from the binding between the client and the 375 Token Consumer. 377 When a client receives the Include-Referred-Token-Binding-ID header, 378 it includes the referred token binding even if both the Token 379 Provider and the Token Consumer fall under the same eTLD+1 and the 380 provided and referred token binding IDs are the same. Note that the 381 referred token binding is sent only on the request resulting from the 382 redirect and not on any subsequent requests to the Token Provider. 384 If the Include-Referred-Token-Binding-ID header field is received in 385 response to a request that did not include the Token-Binding header 386 field, the client MUST ignore the Include-Referred-Token-Binding-ID 387 header field. 389 This header field has only meaning if the HTTP status code is 301, 390 302, 303, 307 or 308, and MUST be ignored by the client for any other 391 status codes. If the client supports the Token Binding Protocol, and 392 has negotiated the Token Binding Protocol with both the Token 393 Consumer and the Token Provider, it already sends the Sec-Token- 394 Binding header field to the Token Provider with each HTTP request 395 (see above). 397 The TokenBindingMessage SHOULD contain a TokenBinding with 398 TokenBindingType referred_token_binding. If included, this 399 TokenBinding MUST be signed with the Token Binding key used by the 400 client for connections between itself and the Token Consumer (more 401 specifically, the web origin that issued the Include-Referred-Token- 402 Binding-ID response header field). The Token Binding ID established 403 by this TokenBinding is called a _Referred Token Binding ID_. 405 As described above, the TokenBindingMessage MUST additionally contain 406 a Provided Token Binding ID, i.e., a TokenBinding structure with 407 TokenBindingType provided_token_binding, which MUST be signed with 408 the Token Binding key used by the client for connections between 409 itself and the Token Provider (more specifically, the web origin that 410 the token request is being sent to). 412 If for some deployment-specific reason the initial Token Provider 413 ("TP1") needs to redirect the client to another Token Provider 414 ("TP2"), rather than directly back to the Token Consumer, it can be 415 accomodated using the header fields defined in this specification in 416 the following fashion ("the redirect-chain approach"): 418 Initially, the client is redirected to TP1 by the Token Consumer 419 ("TC"), as described above. Upon receiving the client's request, 420 containing a TokenBindingMessage which contains both provided and 421 referred TokenBindings (for TP1 and TC, respectively), TP1 422 responds to the client with a redirect response containing the 423 Include-Referred-Token-Binding-ID header field and directing the 424 client to send a request to TP2. This causes the client to follow 425 the same pattern and send a request containing a 426 TokenBindingMessage which contains both provided and referred 427 TokenBindings (for TP2 and TP1, respectively) to TP2. Note that 428 this pattern can continue to further Token Providers. In this 429 case, TP2 issues a security token, bound to the client's 430 TokenBinding with TP1, and sends a redirect response to the client 431 pointing to TP1. TP1 in turn constructs a security token for the 432 Token Consumer, bound to the TC's referred TokenBinding which had 433 been conveyed earlier, and sends a redirect response pointing to 434 the TC, containing the bound security token, to the client. 436 The above is intended as only a non-normative example. Details are 437 specific to deployment contexts. Other approaches are possible, but 438 are outside the scope of this specification. 440 5.4. Negotiated Key Parameters 442 The TLS Extension for Token Binding Protocol Negotiation 443 [I-D.ietf-tokbind-negotiation] allows the server and client to 444 negotiate the parameters (signature algorithm, length) of the Token 445 Binding key. It is possible that the Token Binding ID used between 446 the client and the Token Consumer, and the Token Binding ID used 447 between the client and Token Provider, use different key parameters. 448 The client MUST use the key parameters negotiated with the Token 449 Consumer in the referred_token_binding TokenBinding of the 450 TokenBindingMessage, even if those key parameters are different from 451 the ones negotiated with the origin that the header field is sent to. 453 Token Providers SHOULD support all the Token Binding key parameters 454 specified in the [I-D.ietf-tokbind-protocol]. If a token provider 455 does not support the key parameters specified in the 456 referred_token_binding TokenBinding in the TokenBindingMessage, it 457 MUST NOT issue a bound token. 459 5.5. Federation Example 461 The diagram below shows a typical HTTP Redirect-based Web Browser SSO 462 Profile (no artifact, no callbacks), featuring binding of, e.g., a 463 TLS Token Binding ID into an OpenID Connect "ID Token". 465 Legend: 467 +------------+------------------------------------------------------+ 468 | EKM: | TLS Exported Keying Material [RFC5705] | 469 | {EKMn}Ksm: | EKM for server "n", signed by private key of TBID | 470 | | "m", where "n" must represent server receiving the | 471 | | ETBMSG, if a conveyed TB's type is | 472 | | provided_token_binding, then m = n, else if TB's | 473 | | type is referred_token_binding, then m != n. E.g., | 474 | | see step 1b in diagram below. | 475 | ETBMSG: | "Sec-Token-Binding" HTTP header field conveying an | 476 | | EncodedTokenBindingMessage, in turn conveying | 477 | | TokenBinding (TB)struct(s), e.g.: ETBMSG[[TB]] or | 478 | | ETBMSG[[TB1],[TB2]] | 479 | ID Token: | the "ID Token" in OIDC, it is the semantic | 480 | | equivalent of a SAML "authentication assertion". "ID | 481 | | Token w/TBIDn" denotes a "token bound" ID Token | 482 | | containing TBIDn. | 483 | Ks & Kp: | private (aka secret) key, and public key, | 484 | | respectively, of client-side Token Binding key pair | 485 | OIDC: | Open ID Connect | 486 | TB: | TokenBinding struct containing signed EKM, TBID, and | 487 | | TB type, e.g.: | 488 | | [{EKM1}Ks1,TBID1,provided_token_binding] | 489 | TBIDn: | Token Binding ID for client and server n's token- | 490 | | bound TLS association. TBIDn contains Kpn. | 491 +------------+------------------------------------------------------+ 493 Client, Token Consumer, Token Provider, 494 aka: aka: aka: 495 User Agent OpenID Client, OpenID Provider, 496 OIDC Relying Party, OIDC Provider, 497 SAML Relying Party SAML Identity Provider 498 [ server "1" ] [ server "2" ] 499 +--------+ +----+ +-----+ 500 | Client | | TC | | TP | 501 +--------+ +----+ +-----+ 502 | | | 503 | | | 504 | | | 505 | 0. Client interacts w/TC | | 506 | over HTTPS, establishes Ks1 & Kp1, TBID1 | 507 | ETBMSG[[{EKM1}Ks1,TBID1,provided_token_binding]] | 508 |------------------------------>| | 509 | | | 510 | | | 511 | | | 512 | 1a. OIDC ID Token request, aka| | 513 | "Authentication Request", conveyed with | 514 | HTTP response header field of: | 515 | Include-Referred-Token-Binding-ID:true | 516 | any security-relevant cookies | | 517 | should contain TBID1 | | 518 +<- - - - - - - - - - - - - - - - | | 519 . | (redirect to TP via 301, 302, | | 520 . | 303, 307, or 308) | | 521 . | | | 522 +------------------------------------------------------->| 523 | 1b. opens HTTPS w/TP, | 524 | establishes Ks2, Kp2, TBID2; | 525 | sends GET or POST with | 526 | ETBMSG[[{EKM2}Ks2,TBID2,provided_token_binding], | 527 | [{EKM2}Ks1,TBID1,referred_token_binding]] | 528 | as well as the ID Token request | 529 | | | 530 | | | 531 | | | 532 | 2. user authentication (if applicable, | 533 | methods vary, particulars are out of scope) | 534 |<====================================================>| 535 | (TP generates ID Token for TC containing TBID1, may | 536 | also set cookie(s) containing TBID2 and/or TBID1, | 537 | details vary, particulars are out of scope) | 538 | | | 539 | | | 540 | | | 541 | 3a. ID Token containing Kp1, issued for TC, | 542 | conveyed via OIDC "Authentication Response" | 543 +<- - - - - - - - - - - - - - - - - - - - - - - - - - - -| 544 . | (redirect to TC) | | 545 . | | | 546 . | | | 547 +-------------------------------->| | 548 | 3b. HTTPS GET or POST with | 549 | ETBMSG[[{EKM1}Ks1,TBID1,provided_token_binding]] | 550 | conveying Authn Reponse containing | 551 | ID Token w/TBID1, issued for TC | 552 | | | 553 | | | 554 | | | 555 | 4. user is signed-on, any security-relevant cookie(s)| 556 | that are set SHOULD contain TBID1 | 557 |<------------------------------| | 558 | | | 559 | | | 561 6. Implementation Considerations 563 HTTPS-based applications may have multi-party use cases other than, 564 or in addition to, the HTTP redirect-based signaling-and-conveyance 565 of referred token bindings, as presented above in Section 5.3. 567 Thus, generic Token Binding implementations intended to support any 568 HTTPS-based client-side application (e.g., so-called "native 569 applications"), should provide means for applications to have Token 570 Binding messages, containing Token Binding IDs of various 571 application-specified Token Binding types and for application- 572 specified TLS connections, conveyed over an application-specified 573 HTTPS connection, i.e., within the TokenBindingMessage conveyed by 574 the Sec-Token-Binding header field. 576 However, such implementations MUST only convey Token Binding IDs to 577 servers if signaled to do so by an application. For example, a 578 server can return an Include-Referred-Token-Binding-ID HTTP response 579 header field to a Web browser, thus signaling to the Token Binding 580 implementation in the Web browser that the Web application associated 581 with the server's origin intents to convey the Web browser's Token 582 Binding ID to another server. Other signaling mechanisms are 583 possible, but are outside the scope of this specification. 585 NOTE: See Section 8 "Privacy Considerations", for privacy guidance 586 regarding the use of this functionality. 588 7. Security Considerations 590 7.1. Security Token Replay 592 The goal of the Federated Token Binding mechanisms is to prevent 593 attackers from exporting and replaying tokens used in protocols 594 between the client and Token Consumer, thereby impersonating 595 legitimate users and gaining access to protected resources. Bound 596 tokens can still be replayed by malware present in the client. In 597 order to export the token to another machine and successfully replay 598 it, the attacker also needs to export the corresponding private key. 599 The Token Binding private key is therefore a high-value asset and 600 MUST be strongly protected, ideally by generating it in a hardware 601 security module that prevents key export. 603 7.2. Triple Handshake Vulnerability in TLS 1.2 and Older TLS Versions 605 The Token Binding protocol relies on the exported key material (EKM) 606 value [RFC5705] to associate a TLS connection with a TLS Token 607 Binding. The triple handshake attack [TRIPLE-HS] is a known 608 vulnerability in TLS 1.2 and older TLS versions, allowing the 609 attacker to synchronize keying material between TLS connections. The 610 attacker can then successfully replay bound tokens. For this reason, 611 the Token Binding protocol MUST NOT be negotiated with these TLS 612 versions, unless the Extended Master Secret [RFC7627] and 613 Renegotiation Indication [RFC5746] TLS extensions have also been 614 negotiated. 616 7.3. Sensitivity of the Sec-Token-Binding Header 618 The purpose of the Token Binding protocol is to convince the server 619 that the client that initiated the TLS connection controls a certain 620 key pair. For the server to correctly draw this conclusion after 621 processing the Sec-Token-Binding header field, certain secrecy and 622 integrity requirements must be met. 624 For example, the client's private Token Binding key must be kept 625 secret by the client. If the private key is not secret, then another 626 actor in the system could create a valid Token Binding header field, 627 impersonating the client. This can render the main purpose of the 628 protocol - to bind bearer tokens to certain clients - moot: Consider, 629 for example, an attacker who obtained (perhaps through a network 630 intrusion) an authentication cookie that a client uses with a certain 631 server. Consider further that the server bound that cookie to the 632 client's Token Binding ID precisely to thwart misuse of the cookie. 633 If the attacker were to come into possession of the client's private 634 key, he could then establish a TLS connection with the server and 635 craft a Sec-Token-Binding header field that matches the binding 636 present in the cookie, thus successfully authenticating as the 637 client, and gaining access to the client's data at the server. The 638 Token Binding protocol, in this case, did not successfully bind the 639 cookie to the client. 641 Likewise, we need integrity protection of the Sec-Token-Binding 642 header field: A client should not be tricked into sending a Sec- 643 Token-Binding header field to a server that contains Token Binding 644 messages about key pairs that the client does not control. Consider 645 an attacker A that somehow has knowledge of the exported keying 646 material (EKM) for a TLS connection between a client C and a server 647 S. (While that is somewhat unlikely, it is also not entirely out of 648 the question, since the client might not treat the EKM as a secret - 649 after all, a pre-image-resistant hash function has been applied to 650 the TLS master secret, making it impossible for someone knowing the 651 EKM to recover the TLS master secret. Such considerations might lead 652 some clients to not treat the EKM as a secret.) Such an attacker A 653 could craft a Sec-Token-Binding header field with A's key pair over 654 C's EKM. If the attacker could now trick C to send such a header 655 field to S, it would appear to S as if C controls a certain key pair 656 when in fact it does not (the attacker A controls the key pair). 658 If A has a pre-existing relationship with S (perhaps has an account 659 on S), it now appears to the server S as if A is connecting to it, 660 even though it is really C. (If the server S does not simply use 661 Token Binding keys to identify clients, but also uses bound 662 authentication cookies, then A would also have to trick C into 663 sending one of A's cookies to S, which it can do through a variety of 664 means - inserting cookies through Javascript APIs, setting cookies 665 through related-domain attacks, etc.) In other words, A tricked C 666 into logging into A's account on S. This could lead to a loss of 667 privacy for C, since A presumably has some other way to also access 668 the account, and can thus indirectly observe A's behavior (for 669 example, if S has a feature that lets account holders see their 670 activity history on S). 672 Therefore, we need to protect the integrity of the Sec-Token-Binding 673 header field. One origin should not be able to set the Sec-Token- 674 Binding header field (through a DOM API or otherwise) that the User 675 Agent uses with another origin. Employing the "Sec-" header field 676 prefix helps to meet this requirement by denoting the header field 677 name to be a "forbidden header name", see [fetch-spec]. 679 7.4. Securing Federated Sign-On Protocols 681 As explained above, in a federated sign-in scenario a client will 682 prove possession of two different key pairs to a Token Provider: One 683 key pair is the "provided" Token Binding key pair (which the client 684 normally uses with the Token Provider), and the other is the 685 "referred" Token Binding key pair (which the client normally uses 686 with the Token Consumer). The Token Provider is expected to issue a 687 token that is bound to the referred Token Binding key. 689 Both proofs (that of the provided Token Binding key and that of the 690 referred Token Binding key) are necessary. To show this, consider 691 the following scenario: 693 o The client has an authentication token with the Token Provider 694 that is bound to the client's Token Binding key. 696 o The client wants to establish a secure (i.e., free of men-in-the- 697 middle) authenticated session with the Token Consumer, but has not 698 done so yet (in other words, we are about to run the federated 699 sign-on protocol). 701 o A man-in-the-middle is allowed to intercept the connection between 702 client and Token Consumer or between Client and Token Provider (or 703 both). 705 The goal is to detect the presence of the man-in-the-middle in these 706 scenarios. 708 First, consider a man-in-the-middle between the client and the Token 709 Provider. Recall that we assume that the client possesses a bound 710 authentication token (e.g., cookie) for the Token Provider. The man- 711 in-the-middle can intercept and modify any message sent by the client 712 to the Token Provider, and any message sent by the Token Provider to 713 the client. (This means, among other things, that the man-in-the- 714 middle controls the Javascript running at the client in the origin of 715 the Token Provider.) It is not, however, in possession of the 716 client's Token Binding key. Therefore, it can either choose to 717 replace the Token Binding key in requests from the client to the 718 Token Provider, and create a Sec-Token-Binding header field that 719 matches the TLS connection between the man-in-the-middle and the 720 Token Provider; or it can choose to leave the Sec-Token-Binding 721 header field unchanged. If it chooses the latter, the signature in 722 the Token Binding message (created by the original client on the 723 exported keying material (EKM) for the connection between client and 724 man-in-the-middle) will not match the EKM between man-in-the-middle 725 and the Token Provider. If it chooses the former (and creates its 726 own signature, with its own Token Binding key, over the EKM for the 727 connection between man-in-the-middle and Token Provider), then the 728 Token Binding message will match the connection between man-in-the- 729 middle and Token Provider, but the Token Binding key in the message 730 will not match the Token Binding key that the client's authentication 731 token is bound to. Either way, the man-in-the-middle is detected by 732 the Token Provider, but only if the proof of key possession of the 733 provided Token Binding key is required in the protocol (as we do 734 above). 736 Next, consider the presence of a man-in-the-middle between client and 737 Token Consumer. That man-in-the-middle can intercept and modify any 738 message sent by the client to the Token Consumer, and any message 739 sent by the Token Consumer to the client. The Token Consumer is the 740 party that redirects the client to the Token Provider. In this case, 741 the man-in-the-middle controls the redirect URL, and can tamper with 742 any redirect URL issued by the Token Consumer (as well as with any 743 Javascript running in the origin of the Token Consumer). The goal of 744 the man-in-the-middle is to trick the Token Issuer to issue a token 745 bound to _its_ Token Binding key, not to the Token Binding key of the 746 legitimate client. To thwart this goal of the man-in-the-middle, the 747 client's referred Token Binding key must be communicated to the Token 748 Producer in a manner that can not be affected by the man-in-the- 749 middle (who, as we recall, can modify redirect URLs and Javascript at 750 the client). Including the referred Token Binding message in the 751 Sec-Token-Binding header field (as opposed to, say, including the 752 referred Token Binding key in an application-level message as part of 753 the redirect URL) is one way to assure that the man-in-the-middle 754 between client and Token Consumer cannot affect the communication of 755 the referred Token Binding key to the Token Provider. 757 Therefore, the Sec-Token-Binding header field in the federated sign- 758 on use case contains both, a proof of possession of the provided 759 Token Binding key, as well as a proof of possession of the referred 760 Token Binding key. 762 8. Privacy Considerations 764 8.1. Scoping of Token Binding Keys 766 Clients use different Token Binding key pairs for different servers, 767 so as to not allow Token Binding to become a tracking tool across 768 different servers. However, the scoping of the Token Binding key 769 pairs to servers varies according to the scoping rules of the 770 application protocol ([I-D.ietf-tokbind-protocol] section 4.1). 772 In the case of HTTP cookies, servers may use Token Binding to secure 773 their cookies. These cookies can be attached to any sub-domain of 774 effective top-level domains, and clients therefore should use the 775 same Token Binding key across such subdomains. This will ensure that 776 any server capable of receiving the cookie will see the same Token 777 Binding ID from the client, and thus be able to verify the token 778 binding of the cookie. See Section 2.1, above. 780 If the client application is not a Web browser, it may have 781 additional knowledge about the relationship between different 782 servers. For example, the client application might be aware of the 783 fact that two servers play the role of Relying Party and Identity 784 Provider in a federated sign-on protocol, and that they therefore 785 share the identity of the user. In such cases, it is permissible to 786 use different Token Binding key scoping rules, such as using the same 787 Token Binding key for both the Relying Party and the Identity 788 Provider. Absent such special knowledge, conservative key-scoping 789 rules should be used, assuring that clients use different Token 790 Binding keys with different servers. 792 8.2. Life Time of Token Binding Keys 794 Token Binding keys do not have an expiration time. This means that 795 they can potentially be used by a server to track a user across an 796 extended period of time (similar to a long-lived cookie). HTTPS 797 clients such as web user agents should therefore provide a user 798 interface for discarding Token Binding keys (similar to the 799 affordances provided to delete cookies). 801 If a user agent provides modes such as private browsing mode in which 802 the user is promised that browsing state such as cookies are 803 discarded after the session is over, the user agent should also 804 discard Token Binding keys from such modes after the session is over. 805 Generally speaking, users should be given the same level of control 806 over life time of Token Binding keys as they have over cookies or 807 other potential tracking mechanisms. 809 8.3. Correlation 811 An application's various communicating endpoints, that receive Token 812 Binding IDs for TLS connections other than their own, obtain 813 information about the application's other TLS connections (in this 814 context, "an application" is a combination of client-side and server- 815 side components, communicating over HTTPS, where the client side may 816 be either or both web browser-based or native application-based). 817 These other Token Binding IDs can serve as correlation handles for 818 the endpoints of the other connections. If the receiving endpoints 819 are otherwise aware of these other connections, then no additional 820 information is being exposed. For instance, if in a redirect-based 821 federation protocol, the Identity Provider and Relying Party already 822 possess URLs for one another, also having Token Binding IDs for these 823 connections does not provide additional correlation information. If 824 not, then, by providing the other Token Binding IDs, additional 825 information is exposed that can be used to correlate the other 826 endpoints. In such cases, a privacy analysis of enabled correlations 827 and their potential privacy impacts should be performed as part of 828 the application design decisions of how, and whether, to utilize 829 Token Binding. 831 Also, Token Binding implementations must take care to only reveal 832 Token Binding IDs to other endpoints if the application associated 833 with a Token Binding ID signals to do so, see Section 6 834 "Implementation Considerations". 836 Finally, care should be taken to ensure that unrelated applications 837 do not obtain information about each other's Token Bindings. For 838 instance, a Token Binding implementation shared between multiple 839 applications on a given system should prevent unrelated applications 840 from obtaining each other's Token Binding information. This may be 841 accomplished by using techniques such as application isolation and 842 key segregation, depending upon system capabilities. 844 9. IANA Considerations 846 Below are the Internet Assigned Numbers Authority (IANA) Permanent 847 Message Header Field registration information per [RFC3864]. 849 Header field name: Sec-Token-Binding 850 Applicable protocol: HTTP 851 Status: standard 852 Author/Change controller: IETF 853 Specification document(s): this one 855 Header field name: Include-Referred-Token-Binding-ID 856 Applicable protocol: HTTP 857 Status: standard 858 Author/Change controller: IETF 859 Specification document(s): this one 861 [[TODO: possibly add further considerations wrt the behavior of the 862 above header fields, per ]] 865 10. Acknowledgements 867 This document incorporates comments and suggestions offered by Eric 868 Rescorla, Gabriel Montenegro, Martin Thomson, Vinod Anupam, Anthony 869 Nadalin, Michael B. Jones, Bill Cox, Nick Harper, Brian Campbell, 870 and others. 872 11. References 874 11.1. Normative References 876 [fetch-spec] 877 WhatWG, "Fetch", Living Standard , 878 . 880 [I-D.ietf-tokbind-negotiation] 881 Popov, A., Nystrom, M., Balfanz, D., and A. Langley, 882 "Transport Layer Security (TLS) Extension for Token 883 Binding Protocol Negotiation", draft-ietf-tokbind- 884 negotiation-05 (work in progress), September 2016. 886 [I-D.ietf-tokbind-protocol] 887 Popov, A., Nystrom, M., Balfanz, D., Langley, A., and J. 888 Hodges, "The Token Binding Protocol Version 1.0", draft- 889 ietf-tokbind-protocol-10 (work in progress), September 890 2016. 892 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 893 Requirement Levels", BCP 14, RFC 2119, 894 DOI 10.17487/RFC2119, March 1997, 895 . 897 [RFC3864] Klyne, G., Nottingham, M., and J. Mogul, "Registration 898 Procedures for Message Header Fields", BCP 90, RFC 3864, 899 DOI 10.17487/RFC3864, September 2004, 900 . 902 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 903 Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006, 904 . 906 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 907 (TLS) Protocol Version 1.2", RFC 5246, 908 DOI 10.17487/RFC5246, August 2008, 909 . 911 [RFC5705] Rescorla, E., "Keying Material Exporters for Transport 912 Layer Security (TLS)", RFC 5705, DOI 10.17487/RFC5705, 913 March 2010, . 915 [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, 916 DOI 10.17487/RFC6265, April 2011, 917 . 919 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 920 Protocol (HTTP/1.1): Message Syntax and Routing", 921 RFC 7230, DOI 10.17487/RFC7230, June 2014, 922 . 924 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 925 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 926 DOI 10.17487/RFC7231, June 2014, 927 . 929 [RFC7541] Peon, R. and H. Ruellan, "HPACK: Header Compression for 930 HTTP/2", RFC 7541, DOI 10.17487/RFC7541, May 2015, 931 . 933 11.2. Informative References 935 [RFC5746] Rescorla, E., Ray, M., Dispensa, S., and N. Oskov, 936 "Transport Layer Security (TLS) Renegotiation Indication 937 Extension", RFC 5746, DOI 10.17487/RFC5746, February 2010, 938 . 940 [RFC6749] Hardt, D., Ed., "The OAuth 2.0 Authorization Framework", 941 RFC 6749, DOI 10.17487/RFC6749, October 2012, 942 . 944 [RFC6750] Jones, M. and D. Hardt, "The OAuth 2.0 Authorization 945 Framework: Bearer Token Usage", RFC 6750, 946 DOI 10.17487/RFC6750, October 2012, 947 . 949 [RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 950 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 951 DOI 10.17487/RFC7540, May 2015, 952 . 954 [RFC7627] Bhargavan, K., Ed., Delignat-Lavaud, A., Pironti, A., 955 Langley, A., and M. Ray, "Transport Layer Security (TLS) 956 Session Hash and Extended Master Secret Extension", 957 RFC 7627, DOI 10.17487/RFC7627, September 2015, 958 . 960 [TRIPLE-HS] 961 Bhargavan, K., Delignat-Lavaud, A., Fournet, C., Pironti, 962 A., and P. Strub, "Triple Handshakes and Cookie Cutters: 963 Breaking and Fixing Authentication over TLS. IEEE 964 Symposium on Security and Privacy", 2014. 966 Authors' Addresses 968 Andrei Popov 969 Microsoft Corp. 970 USA 972 Email: andreipo@microsoft.com 974 Magnus Nystroem 975 Microsoft Corp. 976 USA 978 Email: mnystrom@microsoft.com 980 Dirk Balfanz (editor) 981 Google Inc. 982 USA 984 Email: balfanz@google.com 985 Adam Langley 986 Google Inc. 987 USA 989 Email: agl@google.com 991 Jeff Hodges 992 Paypal 993 USA 995 Email: Jeff.Hodges@paypal.com