Web Authorization Protocol | D. Fett |
Internet-Draft | yes.com |
Intended status: Standards Track | J. Bradley |
Expires: October 4, 2019 | Yubico |
B. Campbell | |
Ping Identity | |
T. Lodderstedt | |
yes.com | |
M. Jones | |
Microsoft | |
April 2, 2019 |
OAuth 2.0 Demonstration of Proof-of-Possession at the Application Layer
draft-fett-oauth-dpop-01
This document describes a mechanism for sender-constraining OAuth 2.0 tokens via a proof-of-possession mechanism on the application level. This mechanism allows to detect replay attacks with access and refresh tokens.
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on October 4, 2019.
Copyright (c) 2019 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
[I-D.ietf-oauth-mtls] describes methods to bind (sender-constrain) access tokens using mutual Transport Layer Security (TLS) authentication with X.509 certificates.
[I-D.ietf-oauth-token-binding] provides mechanisms to sender-constrain access tokens using HTTP token binding.
Due to a sub-par user experience of TLS client authentication in user agents and a lack of support for HTTP token binding, neither mechanism can be used if an OAuth client is a Single Page Application (SPA) running in a web browser.
This document outlines an application-level sender-constraining for access tokens and refresh tokens that can be used if neither mTLS nor OAuth Token Binding are available. It uses proof-of-possession based on a public/private key pair and application-level signing.
DPoP can be used with public clients and, in case of confidential clients, can be combined with any client authentication method.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.
This specification uses the terms "access token", "refresh token", "authorization server", "resource server", "authorization endpoint", "authorization request", "authorization response", "token endpoint", "grant type", "access token request", "access token response", and "client" defined by The OAuth 2.0 Authorization Framework [RFC6749].
Under the attacker model defined in [I-D.ietf-oauth-security-topics], the mechanism defined by this specification tries to ensure that token replay at a different endpoint is prevented.
More precisely, if an adversary is able to get hold of an access token because it set up a counterfeit authorization server or resource server, the adversary is not able to replay the respective access token at another authorization or resource server.
Secondary objectives are discussed in Section 11.
+--------+ +---------------+ | |--(A)-- Token Request ------------------->| | | Client | (DPop-Binding/Proof) | Authorization | | | | Server | | |<-(B)-- PoP Access Token -----------------| | | | (token_type=Bearer+DPoP) +---------------+ | | PoP Refresh Token for public clients | | | | +---------------+ | |--(C)-- PoP Access Token ---------------->| | | | (DPoP-Proof) | Resource | | | | Server | | |<-(D)-- Protected Resource ---------------| | | | +---------------+ +--------+
Figure 1: Basic DPoP Flow
The new elements introduced by this specification are shown in Figure 1:
The mechanism presented herein is not a client authentication method. In fact, a primary use case are public clients (single page applications) that do not use client authentication. Nonetheless, DPoP is designed such that it is compatible with private_key_jwt and all other client authentication methods.
Note: DPoP does not directly ensure message integrity but relies on the TLS layer for that purpose.
DPoP uses so-called DPoP JWTs for binding public keys (DPoP Binding JWT) and proving knowledge about private keys (DPoP Proof JWT).
A DPoP JWT is a JWT ([RFC7519]) that is signed (using JWS, [RFC7515]) using a private key chosen by the client (see below). The header of a DPoP JWT contains the following fields:
The body of a DPoP JWT contains the following fields:
An example DPoP JWT is shown in Figure 2.
{ "typ": "dpop_binding+jwt", "alg": "ES512", }.{ "jti": "HK2PmfnHKwXP", "http_method": "POST", "http_uri": "https://server.example.com/token", "exp": "..." "cnf":{ "dpop+jwk": { "kty" : "EC", "kid" : "11", "crv" : "P-256", "x" : "usWxHK2PmfnHKwXPS54m0kTcGJ90UiglWiGahtagnv8", "y" : "3BttVivg+lSreASjpkttcsz+1rb7btKLv8EX4" } } }
Figure 2: Example JWT contents for DPoP-Binding header.
To bind a token to a public key in the token request, the client MUST provide a public key and prove the possession of the corresponding private key. The HTTPS request shown in Figure 3 illustrates the protocol for this (with extra line breaks for display purposes only).
POST /token HTTP/1.1 Host: server.example.com Content-Type: application/x-www-form-urlencoded;charset=UTF-8 DPoP-Binding: eyJhbGciOiJSU0ExXzUi ... grant_type=authorization_code &code=SplxlOBeZQQYbYS6WxSbIA &redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb (remainder of JWK omitted for brevity)
Figure 3: Token Request for a DPoP bound token.
The HTTP header DPoP-Binding MUST contain a DPoP Binding JWT signed using the private key chosen by the client.
It is RECOMMENDED that clients reuse the same JWT if possible to improve the performance of the client, the data transfer (caching), and the authorization server.
If the authorization server receives a DPoP-Binding header in a token request, the authorization server MUST check that:
If these checks are successful, the authorization server MUST associate the access token with the public key. It then sets token_type to Bearer+DPoP in the token response. The client MAY use the value of the token_type parameter to determine whether the server supports the mechanisms specified in this document.
To make use of an access token that is token-bound to a public key using DPoP, a client MUST prove the possession of the corresponding private key. More precisely, the client MUST create a DPoP Proof JWT and sign it using the previously chosen private key. The signed JWT MUST then be sent in the DPoP-Proof request header.
If a resource server detects that an access token that is to be used for resource access is bound to a public key using DPoP (via the methods described in Section 8) it MUST check that:
If any of these checks fails, the resource server MUST NOT grant access to the resource.
At the token endpoint, public clients using a refresh token MUST provide a proof of possession in the same way as for access tokens.
It MUST be ensured that resource servers can reliably identify whether a token is bound using DPoP and learn the public key to which the token is bound.
Access tokens that are represented as JSON Web Tokens (JWT)[RFC7519] MUST contain information about the DPoP public key (in JWK format) in the member dpop+jwk of the cnf claim, as shown in Figure 4.
{ "iss": "https://server.example.com", "sub": "something@example.com", "exp": 1493726400, "nbf": 1493722800, "cnf":{ "dpop+jwk": { "kty" : "EC", "kid" : "11", "crv" : "P-256", "x" : "usWxHK2PmfnHKwXPS54m0kTcGJ90UiglWiGahtagnv8", "y" : "3BttVivg+lSreASjpkttcsz+1rb7btKLv8EX4" } } }
Figure 4: Example access token body with cnf claim.
When access token introspection is used, the same cnf claim as above MUST be contained in the introspection response.
This document resulted from discussions at the 4th OAuth Security Workshop in Stuttgart, Germany. We thank the organizers of this workshop (Ralf Küsters, Guido Schmitz).
This specification registers the following access token type in the OAuth Access Token Types registry defined in [RFC6749].
This specification requests registration of the following value in the IANA "JWT Confirmation Methods" registry [IANA.JWT.Claims] for JWT "cnf" member values established by [RFC7800].
This specification registers the dpop_proof+jwt and dpop_binding+jwt type values in the IANA JSON Web Signature and Encryption Type Values registry [RFC7515]:
The Prevention of Token Replay at a Different Endpoint is achieved through the binding of the DPoP JWT to a certain URI and HTTP method.
If an adversary is able to get hold of an DPoP-Binding JWT, it might replay it at the authorization server's token endpoint with the same or different payload. The issued access token is useless as long as the adversary does not get hold of a valid DPoP-Binding JWT for the corresponding resource server.
If an adversary is able to get hold of a DPoP-Proof JWT, the adversary could replay that token later at the same endpoint (the HTTP endpoint and method are enforced via the respective claims in the JWTs). To prevent this, clients MUST limit the lifetime of the JWTs, preferably to a brief period. Furthermore, the jti claim in each JWT MUST contain a unique (incrementing or randomly chosen) value, as proposed in [RFC7253]. Resource servers SHOULD store values at least for the lifetime of the respective JWT and decline HTTP requests by clients if a jti value has been seen before.
Servers accepting signed DPoP JWTs MUST check the typ field in the headers of the JWTs to ensure that adversaries cannot use JWTs created for other purposes in the DPoP headers.
[RFC6749] | Hardt, D., "The OAuth 2.0 Authorization Framework", RFC 6749, DOI 10.17487/RFC6749, October 2012. |
[RFC7231] | Fielding, R. and J. Reschke, "Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content", RFC 7231, DOI 10.17487/RFC7231, June 2014. |
[RFC7253] | Krovetz, T. and P. Rogaway, "The OCB Authenticated-Encryption Algorithm", RFC 7253, DOI 10.17487/RFC7253, May 2014. |
[RFC7518] | Jones, M., "JSON Web Algorithms (JWA)", RFC 7518, DOI 10.17487/RFC7518, May 2015. |
[RFC7519] | Jones, M., Bradley, J. and N. Sakimura, "JSON Web Token (JWT)", RFC 7519, DOI 10.17487/RFC7519, May 2015. |
[I-D.ietf-oauth-mtls] | Campbell, B., Bradley, J., Sakimura, N. and T. Lodderstedt, "OAuth 2.0 Mutual TLS Client Authentication and Certificate-Bound Access Tokens", Internet-Draft draft-ietf-oauth-mtls-13, February 2019. |
[I-D.ietf-oauth-security-topics] | Lodderstedt, T., Bradley, J., Labunets, A. and D. Fett, "OAuth 2.0 Security Best Current Practice", Internet-Draft draft-ietf-oauth-security-topics-12, March 2019. |
[I-D.ietf-oauth-token-binding] | Jones, M., Campbell, B., Bradley, J. and W. Denniss, "OAuth 2.0 Token Binding", Internet-Draft draft-ietf-oauth-token-binding-08, October 2018. |
[RFC2119] | Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997. |
[RFC7515] | Jones, M., Bradley, J. and N. Sakimura, "JSON Web Signature (JWS)", RFC 7515, DOI 10.17487/RFC7515, May 2015. |
[RFC7800] | Jones, M., Bradley, J. and H. Tschofenig, "Proof-of-Possession Key Semantics for JSON Web Tokens (JWTs)", RFC 7800, DOI 10.17487/RFC7800, April 2016. |
[RFC8174] | Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017. |
[[ To be removed from the final specification ]]
-00
-01