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