idnits 2.17.1 draft-fett-oauth-dpop-00.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'SHOULD not' in this paragraph: o The header SHOULD not contain a "jwk" field. -- The document date (March 27, 2019) is 1849 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) -- Looks like a reference, but probably isn't: '1' on line 534 -- Looks like a reference, but probably isn't: '2' on line 536 -- Looks like a reference, but probably isn't: '3' on line 538 ** Downref: Normative reference to an Informational RFC: RFC 7253 == Outdated reference: A later version (-17) exists of draft-ietf-oauth-mtls-13 == Outdated reference: A later version (-25) exists of draft-ietf-oauth-security-topics-12 Summary: 1 error (**), 0 flaws (~~), 4 warnings (==), 4 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Web Authorization Protocol D. Fett 3 Internet-Draft yes.com 4 Intended status: Standards Track J. Bradley 5 Expires: September 28, 2019 Yubico 6 B. Campbell 7 Ping Identity 8 T. Lodderstedt 9 yes.com 10 M. Jones 11 Microsoft 12 March 27, 2019 14 OAuth 2.0 Demonstration of Proof-of-Possession at the Application Layer 15 draft-fett-oauth-dpop-00 17 Abstract 19 This document defines a sender-constraint mechanism for OAuth 2.0 20 access tokens and refresh tokens utilizing an application-level 21 proof-of-possession mechanism based on public/private key pairs. 23 Status of This Memo 25 This Internet-Draft is submitted in full conformance with the 26 provisions of BCP 78 and BCP 79. 28 Internet-Drafts are working documents of the Internet Engineering 29 Task Force (IETF). Note that other groups may also distribute 30 working documents as Internet-Drafts. The list of current Internet- 31 Drafts is at https://datatracker.ietf.org/drafts/current/. 33 Internet-Drafts are draft documents valid for a maximum of six months 34 and may be updated, replaced, or obsoleted by other documents at any 35 time. It is inappropriate to use Internet-Drafts as reference 36 material or to cite them other than as "work in progress." 38 This Internet-Draft will expire on September 28, 2019. 40 Copyright Notice 42 Copyright (c) 2019 IETF Trust and the persons identified as the 43 document authors. All rights reserved. 45 This document is subject to BCP 78 and the IETF Trust's Legal 46 Provisions Relating to IETF Documents 47 (https://trustee.ietf.org/license-info) in effect on the date of 48 publication of this document. Please review these documents 49 carefully, as they describe your rights and restrictions with respect 50 to this document. Code Components extracted from this document must 51 include Simplified BSD License text as described in Section 4.e of 52 the Trust Legal Provisions and are provided without warranty as 53 described in the Simplified BSD License. 55 Table of Contents 57 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 58 1.1. Conventions and Terminology . . . . . . . . . . . . . . . 3 59 2. Main Objective . . . . . . . . . . . . . . . . . . . . . . . 3 60 3. Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 61 4. Token Request (Binding Tokens to a Public Key) . . . . . . . 5 62 5. Resource Access (Proof of Possession for Access Tokens) . . . 7 63 6. Refresh Token Usage (Proof of Possession for Refresh Tokens) 8 64 7. Public Key Confirmation . . . . . . . . . . . . . . . . . . . 8 65 8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 9 66 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9 67 9.1. JWT Confirmation Methods Registration . . . . . . . . . . 9 68 9.2. OAuth Parameters Registry . . . . . . . . . . . . . . . . 10 69 9.3. JSON Web Signature and Encryption Type Values 70 Registration . . . . . . . . . . . . . . . . . . . . . . 10 71 10. Security Considerations . . . . . . . . . . . . . . . . . . . 10 72 10.1. Token Replay at the same authorization server . . . . . 11 73 10.2. Token Replay at the same resource server endpoint . . . 11 74 10.3. Signed JWT Swapping . . . . . . . . . . . . . . . . . . 11 75 10.4. Comparison to mTLS and OAuth Token Binding . . . . . . . 11 76 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 11 77 11.1. Normative References . . . . . . . . . . . . . . . . . . 11 78 11.2. Informative References . . . . . . . . . . . . . . . . . 11 79 11.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 12 80 Appendix A. Document History . . . . . . . . . . . . . . . . . . 13 81 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 13 83 1. Introduction 85 [I-D.ietf-oauth-mtls] describes methods to bind (sender-constrain) 86 access tokens using mutual Transport Layer Security (TLS) 87 authentication with X.509 certificates. 89 [I-D.ietf-oauth-token-binding] provides mechanisms to sender- 90 constrain access tokens using HTTP token binding. 92 Due to a sub-par user experience of TLS client authentication in user 93 agents and a lack of support for HTTP token binding, neither 94 mechanism can be used if an OAuth client is a Single Page Application 95 (SPA) running in a web browser. 97 This document defines an application-level sender-constraint 98 mechanism for OAuth 2.0 access tokens and refresh tokens that can be 99 applied when neither mTLS nor OAuth Token Binding are utilized. It 100 achieves proof-of-possession using a public/private key pair. 102 1.1. Conventions and Terminology 104 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 105 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 106 "OPTIONAL" in this document are to be interpreted as described in BCP 107 14 [RFC2119] [RFC8174] when, and only when, they appear in all 108 capitals, as shown here. 110 This specification uses the terms "access token", "refresh token", 111 "authorization server", "resource server", "authorization endpoint", 112 "authorization request", "authorization response", "token endpoint", 113 "grant type", "access token request", "access token response", and 114 "client" defined by The OAuth 2.0 Authorization Framework [RFC6749]. 116 2. Main Objective 118 Under the attacker model defined in [I-D.ietf-oauth-security-topics], 119 the mechanism defined by this specification tries to ensure *token 120 replay at a different endpoint is prevented*. 122 More precisely, if an adversary is able to get hold of an access 123 token because it set up a counterfeit authorization server or 124 resource server, the adversary is not able to replay the respective 125 access token at another authorization or resource server. 127 Secondary objectives are discussed in Section 10. 129 3. Concept 130 +--------+ +---------------+ 131 | | | | 132 | |--(A)- Authorization Request ->| Resource | 133 | | | Owner | 134 | |<-(B)-- Authorization Grant ---| | 135 | | +---------------+ 136 | | 137 | | +---------------+ 138 | |--(C)-- Token Request -------->| | 139 | Client | (DPop-Binding) | Authorization | 140 | | | Server | 141 | |<-(D)-- PoP Access Token ------| | 142 | | +---------------+ 143 | | PoP Refresh Token for public clients 144 | | 145 | | +---------------+ 146 | |--(E)-- PoP Access Token ----->| | 147 | | (DPoP-Proof) | Resource | 148 | | | Server | 149 | |<-(F)--- Protected Resource ---| | 150 | | +---------------+ 151 | | 152 | | public client refresh token usage: 153 | | +---------------+ 154 | |--(G)-- PoP Refresh Token ---->| | 155 | | (DPoP-Proof) | Authorization | 156 | | | Server | 157 | |<-(H)-- PoP Access Token ------| | 158 | | +---------------+ 159 | | 160 +--------+ 162 Figure 1: Basic DPoP Flow 164 The new elements introduced by this specification are shown in 165 Figure 1: 167 o In the Token Request (C), the client proves the possession of a 168 private key belonging to some public key by using the private key 169 to sign the authorization code. The matching public key is sent 170 in the same request. 172 o The AS binds (sender-constrains) the access token to the public 173 key claimed by the client; that is, the access token cannot be 174 used without proving possession of the respective private key. 175 This is signaled to the client by using the "token_type" value 176 "bearer+dpop". If a refresh token is issued to the client, it is 177 sender-constrained in the same way if the client is a public 178 client and thus is not able to authenticate requests to the token 179 endpoint. 181 o If the client wants to use the access token (E) or the (public) 182 client wants to use a refresh token, the client has to prove 183 possession of the private key by signing a message containing the 184 respective token, the endpoint URL, and the request method. This 185 signature is provided as a signed JWT. 187 o In the case of the refresh token, the AS can immediately check 188 that the JWT was signed using the matching private key claimed in 189 request (C). 191 o In the case of the access token, the resource server needs to 192 receive information about which public key to check against. This 193 information is either encoded directly into the access token, for 194 JWT structured access tokens, or provided at the token 195 introspection endpoint of the authorization server (request not 196 shown). 198 The mechanism presented herein is not a client authentication method. 199 In fact, a primary use case are public clients (single page 200 applications) that do not use client authentication. Nonetheless, 201 DPoP is designed such that it is compatible with "private_key_jwt" 202 and all other client authentication methods. 204 4. Token Request (Binding Tokens to a Public Key) 206 To bind an tokens to a public key in the token request, the client 207 MUST provide a public key and prove the possession of the 208 corresponding private key. The following HTTPS request illustrates 209 the protocol for this (with extra line breaks for display purposes 210 only): 212 POST /token HTTP/1.1 213 Host: server.example.com 214 Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW 215 Content-Type: application/x-www-form-urlencoded;charset=UTF-8 217 grant_type=authorization_code 218 &code=SplxlOBeZQQYbYS6WxSbIA 219 &redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb 220 &token_type=bearer+dpop 221 &dpop_binding=eyJhbGciOiJSU0ExXzUi ... 222 (remainder of JWK omitted for brevity) 224 Figure 2: Token Request for a DPoP bound token. 226 The parameter "dpop_binding" MUST contain a JWT signed using the 227 asymmetric key chosen by the client. The header of the JWT contains 228 the following fields: 230 o "typ": with value "dpop_binding+jwt" (REQUIRED). 232 o "jwk": The public key chosen by the client, in JWK format 233 (REQUIRED). 235 The body of the JWT contains the following fields: 237 o "http_method": The HTTP method used for the request (REQUIRED). 239 o "http_uri": The HTTP URI used for the request, without query and 240 fragment parts (REQUIRED). 242 o "exp": Expiration time of the JWT (REQUIRED). See Security 243 Considerations [1]. 245 o "jti": Unique, freshly chosen identifier for this JWT (REQUIRED). 246 SHOULD be used by the AS for replay detection and prevention. See 247 Security Considerations [2]. 249 An example JWT is shown in Figure 3. 251 { 252 "typ": "dpop_binding+jwt", 253 "alg": "ES512", 254 "jwk": { 255 "kty" : "EC", 256 "kid" : "11", 257 "crv" : "P-256", 258 "x" : "usWxHK2PmfnHKwXPS54m0kTcGJ90UiglWiGahtagnv8", 259 "y" : "3BttVivg+lSreASjpkttcsz+1rb7btKLv8EX4" 260 } 262 }.{ 263 "jti": "HK2PmfnHKwXP", 264 "http_method": "get", 265 "http_uri": "https://resource-server.example.com?path=something", 266 "exp": "..." 267 } 269 Figure 3: Example JWT for "dpop_binding" parameter. 271 If the authorization server receives a "dpop_binding" parameter in a 272 token request, the authorization server MUST check that: 274 o the parameter value is a well-formed JWT, 276 o all required claims are contained in the JWT, 278 o the algorithm in the header of the JWT is supported by the 279 application and deemed secure, 281 o the JWT is signed using the public key contained in the header of 282 the JWT, 284 o the "typ" field in the header has the correct value, 286 o the "http_method" and "http_uri" claims match the respective 287 values for the HTTP request in which the parameter was received, 289 o the token has not expired, and 291 o if replay protection is desired, that a JWT with the same "jti" 292 value has not been received previously. 294 If these checks are successful, the authorization server MUST 295 associate the access token with the public key. It then sets 296 "token_type" to "bearer+dpop" in the token response. 298 5. Resource Access (Proof of Possession for Access Tokens) 300 To make use of an access token that is token bound to a public key 301 using DPoP, a client MUST prove the possession of the corresponding 302 private key. More precisely, the client MUST create a JWT and sign 303 it using the previously chosen private key. 305 The JWT has the same format as above, except: 307 o The header MUST contain a "typ" claim with the value 308 "dpop_proof+jwt". 310 o The header SHOULD not contain a "jwk" field. 312 The signed JWT MUST then be sent in the "dpop_proof" request 313 parameter. 315 If a resource server detects that an access token that is to be used 316 for resource access is bound to a public key using DPoP (via the 317 methods described in Section 7) it MUST check that: 319 o a parameter "dpop_proof" was received in the HTTP request, 321 o the parameter's value is a well-formed JWT, 322 o all required claims are contained in the JWT, 324 o the algorithm in the header of the JWT is supported by the 325 application and deemed secure, 327 o the JWT is signed using the public key to which the access token 328 was bound, 330 o the "typ" field in the header has the correct value, 332 o the "http_method" and "http_uri" claims match the respective 333 values for the HTTP request in which the parameter was received, 335 o the token has not expired, and 337 o if replay protection is desired, that a JWT with the same "jti" 338 value has not been received previously. 340 If any of these checks fails, the resource server MUST NOT grant 341 access to the resource. 343 6. Refresh Token Usage (Proof of Possession for Refresh Tokens) 345 At the token endpoint, public clients MUST provide a proof of 346 possession in the same way as for access tokens. 348 7. Public Key Confirmation 350 It MUST be ensured that resource servers can reliably identify 351 whether a token is bound using DPoP and learn the public key to which 352 the token is bound. 354 Access tokens that are represented as JSON Web Tokens (JWT)[RFC7519] 355 MUST contain information about the DPoP public key (in JWK format) in 356 the member "dpop+jwk" of the "cnf" claim, as shown in Figure 4. 358 { 359 "iss": "https://server.example.com", 360 "sub": "something@example.com", 361 "exp": 1493726400, 362 "nbf": 1493722800, 363 "cnf":{ 364 "dpop+jwk": { 365 "kty" : "EC", 366 "kid" : "11", 367 "crv" : "P-256", 368 "x" : "usWxHK2PmfnHKwXPS54m0kTcGJ90UiglWiGahtagnv8", 369 "y" : "3BttVivg+lSreASjpkttcsz+1rb7btKLv8EX4" 370 } 371 } 372 } 374 Figure 4: Example access token with "cnf" claim. 376 When access token introspection is used, the same "cnf" claim as 377 above MUST be contained in the introspection response. 379 8. Acknowledgements 381 This document resulted from discussions at the 4th OAuth Security 382 Workshop in Stuttgart, Germany. We thank the organizers of this 383 workshop (Ralf Kuesters, Guido Schmitz). 385 9. IANA Considerations 387 9.1. JWT Confirmation Methods Registration 389 This specification requests registration of the following value in 390 the IANA "JWT Confirmation Methods" registry [IANA.JWT.Claims] for 391 JWT "cnf" member values established by [RFC7800]. 393 o Confirmation Method Value: "dpop+jwk" 395 o Confirmation Method Description: JWK encoded public key for dpop 396 proof token 398 o Change Controller: IESG 400 o Specification Document(s): [[ this specification ]] 402 9.2. OAuth Parameters Registry 404 This specification registers the following parameters in the IANA 405 "OAuth Parameters" registry defined in OAuth 2.0 [RFC6749]. 407 o Parameter name: dpop_binding 409 o Parameter usage location: token request 411 o Change controller: IESG 413 o Specification document(s): [[ this specification ]] 415 o Parameter name: dpop_proof 417 o Parameter usage location: token request 419 o Change controller: IESG 421 o Specification document(s): [[ this specification ]] 423 9.3. JSON Web Signature and Encryption Type Values Registration 425 This specification registers the "dpop+jwt" type value in the IANA 426 JSON Web Signature and Encryption Type Values registry [RFC7515]: 428 o "typ" Header Parameter Value: "dpop_proof+jwt" 430 o Abbreviation for MIME Type: None 432 o Change Controller: IETF 434 o Specification Document(s): [[ this specification ]] 436 o "typ" Header Parameter Value: "dpop_binding+jwt" 438 o Abbreviation for MIME Type: None 440 o Change Controller: IETF 442 o Specification Document(s): [[ this specification ]] 444 10. Security Considerations 446 The Prevention of Token Replay at a Different Endpoint [3] is 447 achieved through the binding of the DPoP JWT to a certain URI and 448 HTTP method. 450 10.1. Token Replay at the same authorization server 452 If an adversary is able to get hold of an DPoP-Binding JWT, it might 453 replay it at the authorization server's token endpoint with the same 454 or different payload. The issued access token is useless as long as 455 the adversary does not get hold of a valid DPoP-Binding JWT for the 456 corresponding resource server. 458 10.2. Token Replay at the same resource server endpoint 460 If an adversary is able to get hold of a DPoP-Proof JWT, the 461 adversary could replay that token later at the same endpoint (the 462 HTTP endpoint and method are enforced via the respective claims in 463 the JWTs). To prevent this, clients MUST limit the lifetime of the 464 JWTs, preferably to a brief period. Furthermore, the "jti" claim in 465 each JWT MUST contain a unique (incrementing or randomly chosen) 466 value, as proposed in [RFC7253]. Resource servers SHOULD store 467 values at least for the lifetime of the respective JWT and decline 468 HTTP requests by clients if a "jti" value has been seen before. 470 10.3. Signed JWT Swapping 472 Servers accepting signed DPoP JWTs MUST check the "typ" field in the 473 headers of the JWTs to ensure that adversaries cannot use JWTs 474 created for other purposes in the DPoP headers. 476 10.4. Comparison to mTLS and OAuth Token Binding 478 o mTLS stronger against intercepted connections 480 11. References 482 11.1. Normative References 484 [RFC7253] Krovetz, T. and P. Rogaway, "The OCB Authenticated- 485 Encryption Algorithm", RFC 7253, DOI 10.17487/RFC7253, May 486 2014, . 488 [RFC7519] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token 489 (JWT)", RFC 7519, DOI 10.17487/RFC7519, May 2015, 490 . 492 11.2. Informative References 494 [I-D.ietf-oauth-mtls] 495 Campbell, B., Bradley, J., Sakimura, N., and T. 496 Lodderstedt, "OAuth 2.0 Mutual TLS Client Authentication 497 and Certificate-Bound Access Tokens", draft-ietf-oauth- 498 mtls-13 (work in progress), February 2019. 500 [I-D.ietf-oauth-security-topics] 501 Lodderstedt, T., Bradley, J., Labunets, A., and D. Fett, 502 "OAuth 2.0 Security Best Current Practice", draft-ietf- 503 oauth-security-topics-12 (work in progress), March 2019. 505 [I-D.ietf-oauth-token-binding] 506 Jones, M., Campbell, B., Bradley, J., and W. Denniss, 507 "OAuth 2.0 Token Binding", draft-ietf-oauth-token- 508 binding-08 (work in progress), October 2018. 510 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 511 Requirement Levels", BCP 14, RFC 2119, 512 DOI 10.17487/RFC2119, March 1997, 513 . 515 [RFC6749] Hardt, D., Ed., "The OAuth 2.0 Authorization Framework", 516 RFC 6749, DOI 10.17487/RFC6749, October 2012, 517 . 519 [RFC7515] Jones, M., Bradley, J., and N. Sakimura, "JSON Web 520 Signature (JWS)", RFC 7515, DOI 10.17487/RFC7515, May 521 2015, . 523 [RFC7800] Jones, M., Bradley, J., and H. Tschofenig, "Proof-of- 524 Possession Key Semantics for JSON Web Tokens (JWTs)", 525 RFC 7800, DOI 10.17487/RFC7800, April 2016, 526 . 528 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 529 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 530 May 2017, . 532 11.3. URIs 534 [1] #Security 536 [2] #Security 538 [3] #Objective_Replay_Different_Endpoint 540 Appendix A. Document History 542 [[ To be removed from the final specification ]] 544 -00 546 o first draft 548 Authors' Addresses 550 Daniel Fett 551 yes.com 553 Email: mail@danielfett.de 555 John Bradley 556 Yubico 558 Email: ve7jtb@ve7jtb.com 560 Brian Campbell 561 Ping Identity 563 Email: bcampbell@pingidentity.com 565 Torsten Lodderstedt 566 yes.com 568 Email: torsten@lodderstedt.net 570 Michael Jones 571 Microsoft 573 Email: mbj@microsoft.com