├── .gitignore
├── README.md
└── main.md
/.gitignore:
--------------------------------------------------------------------------------
1 | draft.html
2 | draft.xml
3 | draft.txt
4 | metadata.min.js
5 | draft-ietf-oauth-dpop-*.html
6 | draft-ietf-oauth-dpop-*.xml
7 | draft-ietf-oauth-dpop-*.txt
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # OAuth 2.0 Demonstration of Proof-of-Possession at the Application Layer
2 |
3 | This document defines an application-level sender-constraint mechanism for
4 | OAuth 2.0 access tokens and refresh tokens that can be applied when neither mTLS nor
5 | OAuth Token Binding are utilized. It achieves proof-of-possession using
6 | a public/private key pair.
7 |
8 | Written in markdown for the [mmark processor](https://github.com/mmarkdown/mmark).
9 |
10 | ## Compiling
11 |
12 | ### using Docker
13 | From the root of this repository, run
14 | ```bash
15 | docker run -v `pwd`:/data danielfett/markdown2rfc main.md
16 | ```
17 | (see https://github.com/oauthstuff/markdown2rfc)
18 |
19 | ### without Docker
20 | compile using mmark and xml2rfc: `mmark main.md > draft.xml; xml2rfc --html draft.xml`
21 |
--------------------------------------------------------------------------------
/main.md:
--------------------------------------------------------------------------------
1 | %%%
2 | title = "OAuth 2.0 Demonstrating Proof-of-Possession at the Application Layer (DPoP)"
3 | abbrev = "OAuth DPoP"
4 | ipr = "trust200902"
5 | area = "Security"
6 | workgroup = "Web Authorization Protocol"
7 | keyword = ["security", "oauth2"]
8 |
9 | [seriesInfo]
10 | name = "Internet-Draft"
11 | value = "draft-ietf-oauth-dpop-16"
12 | stream = "IETF"
13 | status = "standard"
14 |
15 | [[author]]
16 | initials="D."
17 | surname="Fett"
18 | fullname="Daniel Fett"
19 | organization="Authlete"
20 | [author.address]
21 | email = "mail@danielfett.de"
22 |
23 | [[author]]
24 | initials="B."
25 | surname="Campbell"
26 | fullname="Brian Campbell"
27 | organization="Ping Identity"
28 | [author.address]
29 | email = "bcampbell@pingidentity.com"
30 |
31 | [[author]]
32 | initials="J."
33 | surname="Bradley"
34 | fullname="John Bradley"
35 | organization="Yubico"
36 | [author.address]
37 | email = "ve7jtb@ve7jtb.com"
38 |
39 |
40 | [[author]]
41 | initials="T."
42 | surname="Lodderstedt"
43 | fullname="Torsten Lodderstedt"
44 | organization="yes.com"
45 | [author.address]
46 | email = "torsten@lodderstedt.net"
47 |
48 | [[author]]
49 | initials="M."
50 | surname="Jones"
51 | fullname="Michael Jones"
52 | organization="independent"
53 | [author.address]
54 | email = "michael_b_jones@hotmail.com"
55 | uri = "https://self-issued.info/"
56 |
57 | [[author]]
58 | initials="D."
59 | surname="Waite"
60 | fullname="David Waite"
61 | organization="Ping Identity"
62 | [author.address]
63 | email = "david@alkaline-solutions.com"
64 |
65 | %%%
66 |
67 | .# Abstract
68 |
69 | This document describes a mechanism for sender-constraining OAuth 2.0
70 | tokens via a proof-of-possession mechanism on the application level.
71 | This mechanism allows for the detection of replay attacks with access and refresh
72 | tokens.
73 |
74 | {mainmatter}
75 |
76 |
77 | # Introduction {#Introduction}
78 |
79 | DPoP (for Demonstrating Proof-of-Possession at the Application Layer)
80 | is an application-level mechanism for
81 | sender-constraining OAuth [@!RFC6749] access and refresh tokens. It enables a client to
82 | prove the possession of a public/private key pair by including
83 | a `DPoP` header in an HTTP request. The value of the header is a JSON Web Token
84 | (JWT) [@!RFC7519] that enables the authorization
85 | server to bind issued tokens to the public part of a client's
86 | key pair. Recipients of such tokens are then able to verify the binding of the
87 | token to the key pair that the client has demonstrated that it holds via
88 | the `DPoP` header, thereby providing some assurance that the client presenting
89 | the token also possesses the private key.
90 | In other words, the legitimate presenter of the token is constrained to be
91 | the sender that holds and can prove possession of the private part of the
92 | key pair.
93 |
94 | The mechanism specified herein can be used in cases where other
95 | methods of sender-constraining tokens that utilize elements of the underlying
96 | secure transport layer, such as [@RFC8705] or [@I-D.ietf-oauth-token-binding],
97 | are not available or desirable. For example, due to a sub-par user experience
98 | of TLS client authentication in user agents and a lack of support for HTTP token
99 | binding, neither mechanism can be used if an OAuth client is an application that
100 | is dynamically downloaded and executed in a web browser (sometimes referred to as a
101 | "single-page application"). Applications installed
102 | and run directly on a user's device are another example well positioned to benefit
103 | from DPoP-bound tokens to guard against misuse of tokens by a compromised
104 | or malicious resource. Such applications often have dedicated protected storage
105 | for cryptographic keys.
106 |
107 | DPoP can be used to sender-constrain access tokens regardless of the
108 | client authentication method employed, but DPoP itself is not used for client authentication.
109 | DPoP can also be used to sender-constrain refresh tokens issued to public clients
110 | (those without authentication credentials associated with the `client_id`).
111 |
112 | ## Conventions and Terminology
113 |
114 | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
115 | NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED",
116 | "MAY", and "OPTIONAL" in this document are to be interpreted as
117 | described in BCP 14 [@!RFC2119] [@!RFC8174] when, and only when, they
118 | appear in all capitals, as shown here.
119 |
120 | This specification uses the Augmented Backus-Naur Form (ABNF) notation
121 | of [@!RFC5234].
122 |
123 | This specification uses the terms "access token", "refresh token",
124 | "authorization server", "resource server", "authorization endpoint",
125 | "authorization request", "authorization response", "token endpoint",
126 | "grant type", "access token request", "access token response",
127 | "client", "public client", and "confidential client" defined by The OAuth 2.0 Authorization Framework [@!RFC6749].
128 |
129 | The terms "request", "response", "header field", and "target URI"
130 | are imported from [@!RFC9110].
131 |
132 | The terms "JOSE" and "JOSE header" are imported from [@!RFC7515].
133 |
134 | This document contains non-normative examples of partial and complete HTTP messages.
135 | Some examples use a single trailing backslash \ to indicate line wrapping for long values, as per [@RFC8792].
136 | The \ character and leading spaces on wrapped lines are not part of the value.
137 |
138 | # Objectives {#objective}
139 |
140 | The primary aim of DPoP is to prevent unauthorized or illegitimate
141 | parties from using leaked or stolen access tokens, by binding a token
142 | to a public key upon issuance and requiring that the client proves
143 | possession of the corresponding private key when using the token.
144 | This constrains the legitimate sender of the token to only the party with
145 | access to the private key and gives the server receiving the token added
146 | assurances that the sender is legitimately authorized to use it.
147 |
148 | Access tokens that are sender-constrained via DPoP thus stand in
149 | contrast to the typical bearer token, which can be used by any party in
150 | possession of such a token. Although protections generally exist to
151 | prevent unintended disclosure of bearer tokens, unforeseen vectors for
152 | leakage have occurred due to vulnerabilities and implementation issues
153 | in other layers in the protocol or software stack (CRIME [@CRIME], BREACH [@BREACH],
154 | Heartbleed [@Heartbleed], and the Cloudflare parser bug [@Cloudbleed] are some examples).
155 | There have also been numerous published token theft attacks on OAuth
156 | implementations themselves ([@GitHub.Tokens] as just one high profile example).
157 | DPoP provides a general defense in depth
158 | against the impact of unanticipated token leakage. DPoP is not, however,
159 | a substitute for a secure transport and MUST always be used in
160 | conjunction with HTTPS.
161 |
162 | The very nature of the typical OAuth protocol interaction
163 | necessitates that the client discloses the access token to the
164 | protected resources that it accesses. The attacker model
165 | in [@I-D.ietf-oauth-security-topics] describes cases where a
166 | protected resource might be counterfeit, malicious or compromised
167 | and plays received tokens against other protected resources to gain
168 | unauthorized access. Audience restricted access tokens
169 | (e.g., using the JWT [@!RFC7519] `aud` claim) can
170 | prevent such misuse, however, doing so in practice has proven to be
171 | prohibitively cumbersome for many deployments (even despite extensions such as [@RFC8707]).
172 | Sender-constraining access tokens is a more robust and straightforward
173 | mechanism to prevent such token replay at a different endpoint and DPoP
174 | is an accessible application layer means of doing so.
175 |
176 | Due to the potential for cross-site scripting (XSS), browser-based
177 | OAuth clients bring to bear added considerations with respect to protecting
178 | tokens. The most straightforward XSS-based attack is for an attacker to
179 | exfiltrate a token and use it themselves completely independent of the
180 | legitimate client. A stolen access token is used for protected
181 | resource access and a stolen refresh token for obtaining new access tokens.
182 | If the private key is non-extractable (as is possible with [@W3C.WebCryptoAPI]),
183 | DPoP renders exfiltrated tokens alone unusable.
184 |
185 | XSS vulnerabilities also allow an attacker to execute code in the context of
186 | the browser-based client application and maliciously use a token indirectly
187 | through the client. That execution context has access to utilize the signing
188 | key and thus can produce DPoP proofs to use in conjunction with the token.
189 | At this application layer there is most likely no feasible defense against
190 | this threat except generally preventing XSS, therefore it is considered
191 | out of scope for DPoP.
192 |
193 | Malicious XSS code executed in the context of the browser-based client
194 | application is also in a position to create DPoP proofs with timestamp values in
195 | the future and exfiltrate them in conjunction with a token. These stolen
196 | artifacts can later be used independent of the client application to
197 | access protected resources. To prevent this, servers can optionally require
198 | clients to include a server-chosen value into the proof that cannot be predicted
199 | by an attacker (nonce). In the absence of the optional nonce, the impact of
200 | pre-computed DPoP proofs is limited somewhat by the proof being bound to an
201 | access token on protected resource access. Because a proof covering an access
202 | token that does not yet exist cannot feasibly be created, access tokens obtained
203 | with an exfiltrated refresh token and pre-computed proofs will be unusable.
204 |
205 | Additional security considerations are discussed in (#Security).
206 |
207 | # Concept
208 |
209 | The main data structure introduced by this specification is a DPoP
210 | proof JWT, described in detail below, which is sent as a header in an
211 | HTTP request. A client uses a DPoP proof JWT to prove
212 | the possession of a private key corresponding to a certain public key.
213 |
214 | Roughly speaking, a DPoP proof is a signature over some
215 | data of the HTTP request to which it is attached, a timestamp, a unique identifier, an optional server-provided nonce,
216 | and a hash of the associated access token when an access token is present within the request.
217 |
218 | !---
219 | ~~~ ascii-art
220 | +--------+ +---------------+
221 | | |--(A)-- Token Request ------------------->| |
222 | | Client | (DPoP Proof) | Authorization |
223 | | | | Server |
224 | | |<-(B)-- DPoP-bound Access Token ----------| |
225 | | | (token_type=DPoP) +---------------+
226 | | |
227 | | |
228 | | | +---------------+
229 | | |--(C)-- DPoP-bound Access Token --------->| |
230 | | | (DPoP Proof) | Resource |
231 | | | | Server |
232 | | |<-(D)-- Protected Resource ---------------| |
233 | | | +---------------+
234 | +--------+
235 | ~~~
236 | !---
237 | Figure: Basic DPoP Flow {#basic-flow}
238 |
239 | The basic steps of an OAuth flow with DPoP (without the optional nonce) are shown in (#basic-flow):
240 |
241 | * (A) In the Token Request, the client sends an authorization grant
242 | (e.g., an authorization code, refresh token, etc.)
243 | to the authorization server in order to obtain an access token
244 | (and potentially a refresh token). The client attaches a DPoP
245 | proof to the request in an HTTP header.
246 | * (B) The authorization server binds (sender-constrains) the access token to the
247 | public key claimed by the client in the DPoP proof; that is, the access token cannot
248 | be used without proving possession of the respective private key.
249 | If a refresh token is issued to a public client, it too is
250 | bound to the public key of the DPoP proof.
251 | * (C) To use the access token, the client has to prove
252 | possession of the private key by, again, adding a header to the
253 | request that carries a DPoP proof for that request. The resource server needs to
254 | receive information about the public key to which the access token is bound. This
255 | information may be encoded directly into the access token (for
256 | JWT structured access tokens) or provided via token
257 | introspection endpoint (not shown).
258 | The resource server verifies that the public key to which the
259 | access token is bound matches the public key of the DPoP proof.
260 | It also verifies that the access token hash in the DPoP proof matches the
261 | access token presented in the request.
262 | * (D) The resource server refuses to serve the request if the
263 | signature check fails or the data in the DPoP proof is wrong,
264 | e.g., the target URI does not match the URI claim in the DPoP
265 | proof JWT. The access token itself, of course, must also be
266 | valid in all other respects.
267 |
268 | The DPoP mechanism presented herein is not a client authentication method.
269 | In fact, a primary use case of DPoP is for public clients (e.g., single page
270 | applications and applications on a user's device) that do not use client authentication. Nonetheless, DPoP
271 | is designed such that it is compatible with `private_key_jwt` and all
272 | other client authentication methods.
273 |
274 | DPoP does not directly ensure message integrity but relies on the TLS
275 | layer for that purpose. See (#Security) for details.
276 |
277 | # DPoP Proof JWTs {#the-proof}
278 |
279 | DPoP introduces the concept of a DPoP proof, which is a JWT created by
280 | the client and sent with an HTTP request using the `DPoP` header field.
281 | Each HTTP request requires a unique DPoP proof.
282 |
283 | A valid DPoP proof demonstrates to the server that the client holds the private
284 | key that was used to sign the DPoP proof JWT. This enables authorization servers to bind
285 | issued tokens to the corresponding public key (as described in (#access-token-request))
286 | and for resource servers to verify the key-binding of tokens that
287 | it receives (see (#http-auth-scheme)), which prevents said tokens from
288 | being used by any entity that does not have access to the private key.
289 |
290 | The DPoP proof demonstrates possession of a key and, by itself, is not
291 | an authentication or access control mechanism. When presented
292 | in conjunction with a key-bound access token as described in (#http-auth-scheme),
293 | the DPoP proof provides additional assurance about the legitimacy of the client
294 | to present the access token. However, a valid DPoP proof JWT is not sufficient alone
295 | to make access control decisions.
296 |
297 | ## The DPoP HTTP Header
298 |
299 | A DPoP proof is included in an HTTP request using the following request header field.
300 |
301 | `DPoP`
302 | : A JWT that adheres to the structure and syntax of (#DPoP-Proof-Syntax).
303 |
304 | (#dpop-proof-jwt) shows an example DPoP HTTP header field
305 | (with '\' line wrapping per RFC 8792).
306 |
307 | !---
308 | ```
309 | DPoP: eyJ0eXAiOiJkcG9wK2p3dCIsImFsZyI6IkVTMjU2IiwiandrIjp7Imt0eSI6Ik\
310 | VDIiwieCI6Imw4dEZyaHgtMzR0VjNoUklDUkRZOXpDa0RscEJoRjQyVVFVZldWQVdCR\
311 | nMiLCJ5IjoiOVZFNGpmX09rX282NHpiVFRsY3VOSmFqSG10NnY5VERWclUwQ2R2R1JE\
312 | QSIsImNydiI6IlAtMjU2In19.eyJqdGkiOiItQndDM0VTYzZhY2MybFRjIiwiaHRtIj\
313 | oiUE9TVCIsImh0dSI6Imh0dHBzOi8vc2VydmVyLmV4YW1wbGUuY29tL3Rva2VuIiwia\
314 | WF0IjoxNTYyMjYyNjE2fQ.2-GxA6T8lP4vfrg8v-FdWP0A0zdrj8igiMLvqRMUvwnQg\
315 | 4PtFLbdLXiOSsX0x7NVY-FNyJK70nfbV37xRZT3Lg
316 | ```
317 | !---
318 | Figure: Example `DPoP` header {#dpop-proof-jwt}
319 |
320 | Note that per [@RFC9110] header field names are case-insensitive;
321 | so `DPoP`, `DPOP`, `dpop`, etc., are all valid and equivalent header
322 | field names. Case is significant in the header field value, however.
323 |
324 | The `DPoP` HTTP header field value
325 | uses the `token68` syntax defined in Section 11.2 of [@!RFC9110]
326 | (repeated below in (#dpop-header-abnf) for ease of reference).
327 |
328 | !---
329 | ```
330 | DPoP = token68
331 | token68 = 1*( ALPHA / DIGIT /
332 | "-" / "." / "_" / "~" / "+" / "/" ) *"="
333 | ```
334 | !---
335 | Figure: DPoP header field ABNF {#dpop-header-abnf}
336 |
337 |
338 | ## DPoP Proof JWT Syntax {#DPoP-Proof-Syntax}
339 |
340 | A DPoP proof is a JWT ([@!RFC7519]) that is signed (using JSON Web Signature (JWS)
341 | [@!RFC7515]) with a private key chosen by the client (see below). The
342 | JOSE header of a DPoP JWT MUST contain at least the following parameters:
343 |
344 | * `typ`: with value `dpop+jwt`, which explicitly types the DPoP proof JWT as recommended in [@RFC8725, section 3.11].
345 | * `alg`: an identifier for a JWS asymmetric digital signature algorithm from [@IANA.JOSE.ALGS].
346 | MUST NOT be `none` or an identifier for a symmetric algorithm (MAC).
347 | * `jwk`: representing the public key chosen by the client, in JSON Web Key (JWK) [@!RFC7517]
348 | format, as defined in Section 4.1.3 of [@!RFC7515].
349 | MUST NOT contain a private key.
350 |
351 | The payload of a DPoP proof MUST contain at least the following claims:
352 |
353 | * `jti`: Unique identifier for the DPoP proof JWT.
354 | The value MUST be assigned such that there is a negligible
355 | probability that the same value will be assigned to any
356 | other DPoP proof used in the same context during the time window of validity.
357 | Such uniqueness can be accomplished by encoding (base64url or any other
358 | suitable encoding) at least 96 bits of
359 | pseudorandom data or by using a version 4 UUID string according to [@RFC4122].
360 | The `jti` can be used by the server for replay
361 | detection and prevention, see (#Token_Replay).
362 | * `htm`: The value of the HTTP method (Section 9.1 of [@!RFC9110]) of the
363 | request to which the JWT is attached.
364 | * `htu`: The HTTP target URI ([@RFC9110, section 7.1]), without query and fragment
365 | parts, of the request to which the JWT is attached.
366 | * `iat`: Creation timestamp of the JWT ([@!RFC7519], section 4.1.6]).
367 |
368 | When the DPoP proof is used in conjunction with the presentation of an access token in protected resource access, see
369 | (#protected-resource-access), the DPoP proof MUST also contain the following claim:
370 |
371 | * `ath`: hash of the access token.
372 | The value MUST be the result of a base64url encoding (as defined in [@!RFC7515, section 2]) the SHA-256 [@!SHS]
373 | hash of the ASCII encoding of the associated access token's value.
374 |
375 | When the authentication server or resource server provides a `DPoP-Nonce` HTTP header
376 | in a response (see (#ASNonce), (#RSNonce)), the DPoP proof MUST also contain
377 | the following claim:
378 |
379 | * `nonce`: A recent nonce provided via the `DPoP-Nonce` HTTP header.
380 |
381 | A DPoP proof MAY contain other JOSE header parameters or claims as defined by extension,
382 | profile, or deployment specific requirements.
383 |
384 | (#dpop-proof) is a conceptual example showing the decoded content of the DPoP
385 | proof in (#dpop-proof-jwt). The JSON of the JWT header and payload are shown,
386 | but the signature part is omitted. As usual, line breaks and extra spaces
387 | are included for formatting and readability.
388 |
389 | !---
390 | ```
391 | {
392 | "typ":"dpop+jwt",
393 | "alg":"ES256",
394 | "jwk": {
395 | "kty":"EC",
396 | "x":"l8tFrhx-34tV3hRICRDY9zCkDlpBhF42UQUfWVAWBFs",
397 | "y":"9VE4jf_Ok_o64zbTTlcuNJajHmt6v9TDVrU0CdvGRDA",
398 | "crv":"P-256"
399 | }
400 | }
401 | .
402 | {
403 | "jti":"-BwC3ESc6acc2lTc",
404 | "htm":"POST",
405 | "htu":"https://server.example.com/token",
406 | "iat":1562262616
407 | }
408 | ```
409 | !---
410 | Figure: Example JWT content of a `DPoP` proof {#dpop-proof}
411 |
412 | Of the HTTP request, only the HTTP method and URI are
413 | included in the DPoP JWT, and therefore only these two message parts
414 | are covered by the DPoP proof.
415 | The idea is sign just enough of the HTTP data to
416 | provide reasonable proof-of-possession with respect to the HTTP request.
417 | This design approach of using only a minimal subset of the HTTP header
418 | data is to avoid the substantial difficulties inherent in attempting to
419 | normalize HTTP messages.
420 | Nonetheless, DPoP proofs can be extended to contain other information of the
421 | HTTP request (see also (#request_integrity)).
422 |
423 |
424 |
425 | ## Checking DPoP Proofs {#checking}
426 |
427 | To validate a DPoP proof, the receiving server MUST ensure that
428 |
429 | 1. there is not more than one `DPoP` HTTP request header field,
430 | 2. the DPoP HTTP request header field value is a single well-formed JWT,
431 | 3. all required claims per (#DPoP-Proof-Syntax) are contained in the JWT,
432 | 4. the `typ` JOSE header parameter has the value `dpop+jwt`,
433 | 5. the `alg` JOSE header parameter indicates a registered asymmetric digital
434 | signature algorithm [@IANA.JOSE.ALGS], is not `none`, is supported by the
435 | application, and is acceptable per local policy,
436 | 6. the JWT signature verifies with the public key contained in the `jwk`
437 | JOSE header parameter,
438 | 7. the `jwk` JOSE header parameter does not contain a private key,
439 | 8. the `htm` claim matches the HTTP method of the current request,
440 | 9. the `htu` claim matches the HTTP URI value for the HTTP
441 | request in which the JWT was received, ignoring any query and
442 | fragment parts,
443 | 10. if the server provided a nonce value to the client,
444 | the `nonce` claim matches the server-provided nonce value,
445 | 11. the creation time of the JWT, as determined by either the `iat` claim or a server managed timestamp via the `nonce` claim, is within an acceptable window (see (#Token_Replay)),
446 | 12. if presented to a protected resource in conjunction with an access token,
447 | * ensure that the value of the `ath` claim equals the hash of that access token,
448 | * confirm that the public key to which the access token is bound matches the public key from the DPoP proof.
449 |
450 | To reduce the likelihood of false negatives,
451 | servers SHOULD employ Syntax-Based Normalization ([@!RFC3986, section 6.2.2]) and Scheme-Based
452 | Normalization ([@!RFC3986, section 6.2.3]) before comparing the `htu` claim.
453 |
454 | These checks may be performed in any order.
455 |
456 |
457 |
458 | # DPoP Access Token Request {#access-token-request}
459 |
460 | To request an access token that is bound to a public key using DPoP, the client MUST
461 | provide a valid DPoP proof JWT in a `DPoP` header when making an access token
462 | request to the authorization server's token endpoint. This is applicable for all
463 | access token requests regardless of grant type (including, for example,
464 | the common `authorization_code` and `refresh_token` grant types but also extension grants
465 | such as the JWT authorization grant [@RFC7523]). The HTTP request shown in
466 | (#token-request-code) illustrates such an access
467 | token request using an authorization code grant with a DPoP proof JWT
468 | in the `DPoP` header
469 | (with '\' line wrapping per RFC 8792).
470 |
471 | !---
472 | ~~~
473 | POST /token HTTP/1.1
474 | Host: server.example.com
475 | Content-Type: application/x-www-form-urlencoded
476 | DPoP: eyJ0eXAiOiJkcG9wK2p3dCIsImFsZyI6IkVTMjU2IiwiandrIjp7Imt0eSI6Ik\
477 | VDIiwieCI6Imw4dEZyaHgtMzR0VjNoUklDUkRZOXpDa0RscEJoRjQyVVFVZldWQVdCR\
478 | nMiLCJ5IjoiOVZFNGpmX09rX282NHpiVFRsY3VOSmFqSG10NnY5VERWclUwQ2R2R1JE\
479 | QSIsImNydiI6IlAtMjU2In19.eyJqdGkiOiItQndDM0VTYzZhY2MybFRjIiwiaHRtIj\
480 | oiUE9TVCIsImh0dSI6Imh0dHBzOi8vc2VydmVyLmV4YW1wbGUuY29tL3Rva2VuIiwia\
481 | WF0IjoxNTYyMjYyNjE2fQ.2-GxA6T8lP4vfrg8v-FdWP0A0zdrj8igiMLvqRMUvwnQg\
482 | 4PtFLbdLXiOSsX0x7NVY-FNyJK70nfbV37xRZT3Lg
483 |
484 | grant_type=authorization_code\
485 | &client_id=s6BhdRkqt\
486 | &code=SplxlOBeZQQYbYS6WxSbIA
487 | &redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb\
488 | &code_verifier=bEaL42izcC-o-xBk0K2vuJ6U-y1p9r_wW2dFWIWgjz-
489 | ~~~
490 | !---
491 | Figure: Token Request for a DPoP sender-constrained token using an authorization code {#token-request-code}
492 |
493 | The `DPoP` HTTP header field MUST contain a valid DPoP proof JWT.
494 | If the DPoP proof is invalid, the authorization server issues an error
495 | response per Section 5.2 of [@!RFC6749] with `invalid_dpop_proof` as the
496 | value of the `error` parameter.
497 |
498 | To sender-constrain the access token, after checking the validity of the
499 | DPoP proof, the authorization server associates the issued access token with the
500 | public key from the DPoP proof, which can be accomplished as described in (#Confirmation).
501 | A `token_type` of `DPoP` MUST be included in the access token
502 | response to signal to the client that the access token was bound to
503 | its DPoP key and can be used as described in (#http-auth-scheme).
504 | The example response shown in (#token-response) illustrates such a
505 | response.
506 |
507 | !---
508 | ~~~
509 | HTTP/1.1 200 OK
510 | Content-Type: application/json
511 | Cache-Control: no-store
512 |
513 | {
514 | "access_token": "Kz~8mXK1EalYznwH-LC-1fBAo.4Ljp~zsPE_NeO.gxU",
515 | "token_type": "DPoP",
516 | "expires_in": 2677,
517 | "refresh_token": "Q..Zkm29lexi8VnWg2zPW1x-tgGad0Ibc3s3EwM_Ni4-g"
518 | }
519 | ~~~
520 | !---
521 | Figure: Access Token Response {#token-response}
522 |
523 | The example response in (#token-response) includes a refresh token which the
524 | client can use to obtain a new access token when the previous one expires.
525 | Refreshing an access token is a token request using the `refresh_token`
526 | grant type made to the authorization server's token endpoint. As with
527 | all access token requests, the client makes it a DPoP request by including
528 | a DPoP proof, as shown in the (#token-request-rt) example
529 | (with '\' line wrapping per RFC 8792).
530 |
531 | !---
532 | ~~~
533 | POST /token HTTP/1.1
534 | Host: server.example.com
535 | Content-Type: application/x-www-form-urlencoded
536 | DPoP: eyJ0eXAiOiJkcG9wK2p3dCIsImFsZyI6IkVTMjU2IiwiandrIjp7Imt0eSI6Ik\
537 | VDIiwieCI6Imw4dEZyaHgtMzR0VjNoUklDUkRZOXpDa0RscEJoRjQyVVFVZldWQVdCR\
538 | nMiLCJ5IjoiOVZFNGpmX09rX282NHpiVFRsY3VOSmFqSG10NnY5VERWclUwQ2R2R1JE\
539 | QSIsImNydiI6IlAtMjU2In19.eyJqdGkiOiItQndDM0VTYzZhY2MybFRjIiwiaHRtIj\
540 | oiUE9TVCIsImh0dSI6Imh0dHBzOi8vc2VydmVyLmV4YW1wbGUuY29tL3Rva2VuIiwia\
541 | WF0IjoxNTYyMjY1Mjk2fQ.pAqut2IRDm_De6PR93SYmGBPXpwrAk90e8cP2hjiaG5Qs\
542 | GSuKDYW7_X620BxqhvYC8ynrrvZLTk41mSRroapUA
543 |
544 | grant_type=refresh_token\
545 | &client_id=s6BhdRkqt\
546 | &refresh_token=Q..Zkm29lexi8VnWg2zPW1x-tgGad0Ibc3s3EwM_Ni4-g
547 | ~~~
548 | !---
549 | Figure: Token Request for a DPoP-bound Token using a Refresh Token {#token-request-rt}
550 |
551 | When an authorization server supporting DPoP issues a
552 | refresh token to a public client that presents a valid DPoP proof at the
553 | token endpoint, the refresh token MUST be bound
554 | to the respective public key. The binding MUST be validated when the refresh
555 | token is later presented to get new access tokens. As a result, such a client
556 | MUST present a DPoP proof for the same key that was used to obtain the refresh
557 | token each time that refresh token is used to obtain a new access token.
558 | The implementation details of the binding of the refresh token are at the discretion of
559 | the authorization server. Since the authorization server both produces and
560 | validates its refresh tokens, there is no interoperability
561 | consideration in the specific details of the binding.
562 |
563 | An authorization server MAY elect to issue access tokens which are not DPoP bound,
564 | which is signaled to the client with a value of `Bearer` in the `token_type` parameter
565 | of the access token response per [@RFC6750]. For a public client that is
566 | also issued a refresh token, this has the effect of DPoP-binding the refresh token
567 | alone, which can improve the security posture even when protected resources are not
568 | updated to support DPoP.
569 |
570 | If the access token response contains a different `token_type` value than `DPoP`, the
571 | access token protection provided by DPoP is not given. The client MUST discard the response in this
572 | case, if this protection is deemed important for the security of the
573 | application; otherwise, it may continue as in a regular OAuth interaction.
574 |
575 | Refresh tokens issued to confidential clients (those having
576 | established authentication credentials with the authorization server)
577 | are not bound to the DPoP proof public key because they are already
578 | sender-constrained with a different existing mechanism. The OAuth 2.0 Authorization
579 | Framework [@!RFC6749] already requires that an authorization server bind
580 | refresh tokens to the client to which they were issued and that
581 | confidential clients authenticate to the authorization server when
582 | presenting a refresh token. As a result, such refresh tokens
583 | are sender-constrained by way of the client identifier and the associated
584 | authentication requirement. This existing sender-constraining mechanism
585 | is more flexible (e.g., it allows credential rotation for the client
586 | without invalidating refresh tokens) than binding directly to a particular public key.
587 |
588 | ## Authorization Server Metadata {#as-meta}
589 |
590 | This document introduces the following authorization server metadata
591 | [@RFC8414] parameter to signal support for DPoP in general and the specific
592 | JWS `alg` values the authorization server supports for DPoP proof JWTs.
593 |
594 | `dpop_signing_alg_values_supported`
595 | : A JSON array containing a list of the JWS `alg` values (from the [@IANA.JOSE.ALGS] registry) supported
596 | by the authorization server for DPoP proof JWTs.
597 |
598 | ## Client Registration Metadata {#client-meta}
599 |
600 | The Dynamic Client Registration Protocol [@RFC7591] defines an API
601 | for dynamically registering OAuth 2.0 client metadata with authorization servers.
602 | The metadata defined by [@RFC7591], and registered extensions to it,
603 | also imply a general data model for clients that is useful for authorization server implementations
604 | even when the Dynamic Client Registration Protocol isn't in play.
605 | Such implementations will typically have some sort of user interface available for managing client configuration.
606 |
607 | This document introduces the following client registration metadata
608 | [@RFC7591] parameter to indicate that the client always uses
609 | DPoP when requesting tokens from the authorization server.
610 |
611 | `dpop_bound_access_tokens`
612 | : Boolean value specifying whether the client always uses DPoP for token requests. If omitted, the default value is `false`.
613 |
614 | If `true`, the authorization server MUST reject token requests from this client that do not contain the DPoP header.
615 |
616 | # Public Key Confirmation {#Confirmation}
617 |
618 | Resource servers MUST be able to reliably identify whether
619 | an access token is DPoP-bound and ascertain sufficient information
620 | to verify the binding to the public key of the DPoP proof (see (#http-auth-scheme)).
621 | Such a binding is accomplished by associating the public key
622 | with the token in a way that can be
623 | accessed by the protected resource, such as embedding the JWK
624 | hash in the issued access token directly, using the syntax described
625 | in (#jwk-thumb-jwt), or through token introspection as described in
626 | (#jwk-thumb-intro). Other methods of associating a
627 | public key with an access token are possible, per agreement by the
628 | authorization server and the protected resource, but are beyond the
629 | scope of this specification.
630 |
631 | Resource servers supporting DPoP MUST ensure that the public key from
632 | the DPoP proof matches the one bound to the access token.
633 |
634 | ## JWK Thumbprint Confirmation Method {#jwk-thumb-jwt}
635 |
636 | When access tokens are represented as JWTs [@!RFC7519],
637 | the public key information is represented
638 | using the `jkt` confirmation method member defined herein.
639 | To convey the hash of a public key in a JWT, this specification
640 | introduces the following JWT Confirmation Method [@!RFC7800] member for
641 | use under the `cnf` claim.
642 |
643 | `jkt`
644 | : JWK SHA-256 Thumbprint Confirmation Method. The value of the `jkt` member
645 | MUST be the base64url encoding (as defined in [@!RFC7515])
646 | of the JWK SHA-256 Thumbprint (according to [@!RFC7638]) of the DPoP public key
647 | (in JWK format) to which the access token is bound.
648 |
649 | The following example JWT in (#cnf-claim-jwt) with decoded JWT payload shown in
650 | (#cnf-claim) contains a `cnf` claim with the `jkt` JWK Thumbprint confirmation
651 | method member. The `jkt` value in these examples is the hash of the public key
652 | from the DPoP proofs in the examples in (#access-token-request).
653 | (The example uses '\' line wrapping per RFC 8792.)
654 |
655 | !---
656 | ```
657 | eyJhbGciOiJFUzI1NiIsImtpZCI6IkJlQUxrYiJ9.eyJzdWIiOiJzb21lb25lQGV4YW1\
658 | wbGUuY29tIiwiaXNzIjoiaHR0cHM6Ly9zZXJ2ZXIuZXhhbXBsZS5jb20iLCJuYmYiOjE\
659 | 1NjIyNjI2MTEsImV4cCI6MTU2MjI2NjIxNiwiY25mIjp7ImprdCI6IjBaY09DT1JaTll\
660 | 5LURXcHFxMzBqWnlKR0hUTjBkMkhnbEJWM3VpZ3VBNEkifX0.3Tyo8VTcn6u_PboUmAO\
661 | YUY1kfAavomW_YwYMkmRNizLJoQzWy2fCo79Zi5yObpIzjWb5xW4OGld7ESZrh0fsrA
662 | ```
663 | !---
664 | Figure: JWT containing a JWK SHA-256 Thumbprint Confirmation {#cnf-claim-jwt}
665 |
666 | !---
667 | ```
668 | {
669 | "sub":"someone@example.com",
670 | "iss":"https://server.example.com",
671 | "nbf":1562262611,
672 | "exp":1562266216,
673 | "cnf":
674 | {
675 | "jkt":"0ZcOCORZNYy-DWpqq30jZyJGHTN0d2HglBV3uiguA4I"
676 | }
677 | }
678 | ```
679 | !---
680 | Figure: JWT Claims Set with a JWK SHA-256 Thumbprint Confirmation {#cnf-claim}
681 |
682 | ## JWK Thumbprint Confirmation Method in Token Introspection {#jwk-thumb-intro}
683 |
684 | OAuth 2.0 Token Introspection [@RFC7662] defines a method for a
685 | protected resource to query an authorization server about the active
686 | state of an access token as well as to determine metainformation
687 | about the token.
688 |
689 | For a DPoP-bound access token, the hash of the public key to which the token
690 | is bound is conveyed to the protected resource as metainformation in a token
691 | introspection response. The hash is conveyed using the same `cnf` content with
692 | `jkt` member structure as the JWK Thumbprint confirmation method, described in
693 | (#jwk-thumb-jwt), as a top-level member of the
694 | introspection response JSON. Note that the resource server
695 | does not send a DPoP proof with the introspection request and the authorization
696 | server does not validate an access token's DPoP binding at the introspection
697 | endpoint. Rather the resource server uses the data of the introspection response
698 | to validate the access token binding itself locally.
699 |
700 | If the `token_type` member is included in the introspection response, it MUST contain
701 | the value `DPoP`.
702 |
703 | The example introspection request in (#introspect-req) and corresponding response in
704 | (#introspect-resp) illustrate an introspection exchange for the example DPoP-bound
705 | access token that was issued in (#token-response).
706 |
707 | !---
708 | ```
709 | POST /as/introspect.oauth2 HTTP/1.1
710 | Host: server.example.com
711 | Content-Type: application/x-www-form-urlencoded
712 | Authorization: Basic cnM6cnM6TWt1LTZnX2xDektJZHo0ZnNON2tZY3lhK1Rp
713 |
714 | token=Kz~8mXK1EalYznwH-LC-1fBAo.4Ljp~zsPE_NeO.gxU
715 | ```
716 | !---
717 | Figure: Example Introspection Request {#introspect-req}
718 |
719 | !---
720 | ```
721 | HTTP/1.1 200 OK
722 | Content-Type: application/json
723 | Cache-Control: no-store
724 |
725 | {
726 | "active": true,
727 | "sub": "someone@example.com",
728 | "iss": "https://server.example.com",
729 | "nbf": 1562262611,
730 | "exp": 1562266216,
731 | "cnf":
732 | {
733 | "jkt": "0ZcOCORZNYy-DWpqq30jZyJGHTN0d2HglBV3uiguA4I"
734 | }
735 | }
736 | ```
737 | !---
738 | Figure: Example Introspection Response for a DPoP-Bound Access Token {#introspect-resp}
739 |
740 | # Protected Resource Access {#protected-resource-access}
741 |
742 | Requests to DPoP protected resources
743 | MUST include both a DPoP proof as per (#the-proof) and
744 | the access token as described in (#http-auth-scheme).
745 | The DPoP proof MUST include the `ath` claim with a valid hash of the
746 | associated access token.
747 |
748 | Binding the token value to the proof in this way prevents a proof
749 | to be used with multiple different access token values across different requests.
750 | For example, if a client holds tokens bound to two different resource owners, AT1 and AT2,
751 | and uses the same key when talking to the AS, it's possible that these tokens could be swapped.
752 | Without the `ath` field to bind it, a captured signature applied to AT1 could be
753 | replayed with AT2 instead, changing the rights and access of the intended request.
754 | This same substitution prevention remains for rotated access tokens within the same
755 | combination of client and resource owner -- a rotated token value would require the
756 | calculation of a new proof. This binding additionally ensures that a proof intended for use
757 | with the access token is not usable without an access token, or vice-versa.
758 |
759 | The resource server is required to calculate the hash of the token value presented
760 | and verify that it is the same as the hash value in the `ath` field as described in (#checking).
761 | Since the `ath` field value is covered by the DPoP proof's signature, its inclusion binds
762 | the access token value to the holder of the key used to generate the signature.
763 |
764 | Note that the `ath` field alone does not prevent replay of the DPoP proof or provide binding
765 | to the request in which the proof is presented, and it is still important to check the time
766 | window of the proof as well as the included message parameters such as `htm` and `htu`.
767 |
768 | ## The DPoP Authentication Scheme {#http-auth-scheme}
769 |
770 | A DPoP-bound access token is sent using the `Authorization` request
771 | header field per Section 11.6.2 of [@!RFC9110] using an
772 | authentication scheme of `DPoP`. The syntax of the `Authorization`
773 | header field for the `DPoP` scheme
774 | uses the `token68` syntax defined in Section 11.2 of [@!RFC9110]
775 | (repeated below for ease of reference) for credentials.
776 | The ABNF notation syntax for DPoP authentication scheme credentials is as follows:
777 |
778 | !---
779 | ```
780 | token68 = 1*( ALPHA / DIGIT /
781 | "-" / "." / "_" / "~" / "+" / "/" ) *"="
782 |
783 | credentials = "DPoP" 1*SP token68
784 | ```
785 | !---
786 | Figure: DPoP Authentication Scheme ABNF
787 |
788 | For such an access token, a resource server MUST check that a DPoP proof
789 | was also received in the `DPoP` header field of the HTTP request,
790 | check the DPoP proof according to the rules in (#checking),
791 | and check that the public key of the DPoP proof matches the public
792 | key to which the access token is bound per (#Confirmation).
793 |
794 | The resource server MUST NOT grant access to the resource unless all
795 | checks are successful.
796 |
797 | (#protected-resource-request) shows an example request to a protected
798 | resource with a DPoP-bound access token in the `Authorization` header
799 | and the DPoP proof in the `DPoP` header
800 | (with '\' line wrapping per RFC 8792).
801 | Following that is (#dpop-proof-pr), which shows the decoded content of that DPoP
802 | proof. The JSON of the JWT header and payload are shown
803 | but the signature part is omitted. As usual, line breaks and indentation
804 | are included for formatting and readability.
805 | !---
806 | ~~~
807 | GET /protectedresource HTTP/1.1
808 | Host: resource.example.org
809 | Authorization: DPoP Kz~8mXK1EalYznwH-LC-1fBAo.4Ljp~zsPE_NeO.gxU
810 | DPoP: eyJ0eXAiOiJkcG9wK2p3dCIsImFsZyI6IkVTMjU2IiwiandrIjp7Imt0eSI6Ik\
811 | VDIiwieCI6Imw4dEZyaHgtMzR0VjNoUklDUkRZOXpDa0RscEJoRjQyVVFVZldWQVdCR\
812 | nMiLCJ5IjoiOVZFNGpmX09rX282NHpiVFRsY3VOSmFqSG10NnY5VERWclUwQ2R2R1JE\
813 | QSIsImNydiI6IlAtMjU2In19.eyJqdGkiOiJlMWozVl9iS2ljOC1MQUVCIiwiaHRtIj\
814 | oiR0VUIiwiaHR1IjoiaHR0cHM6Ly9yZXNvdXJjZS5leGFtcGxlLm9yZy9wcm90ZWN0Z\
815 | WRyZXNvdXJjZSIsImlhdCI6MTU2MjI2MjYxOCwiYXRoIjoiZlVIeU8ycjJaM0RaNTNF\
816 | c05yV0JiMHhXWG9hTnk1OUlpS0NBcWtzbVFFbyJ9.2oW9RP35yRqzhrtNP86L-Ey71E\
817 | OptxRimPPToA1plemAgR6pxHF8y6-yqyVnmcw6Fy1dqd-jfxSYoMxhAJpLjA
818 | ~~~
819 | !---
820 | Figure: DPoP Protected Resource Request {#protected-resource-request}
821 |
822 | !---
823 | ```
824 | {
825 | "typ":"dpop+jwt",
826 | "alg":"ES256",
827 | "jwk": {
828 | "kty":"EC",
829 | "x":"l8tFrhx-34tV3hRICRDY9zCkDlpBhF42UQUfWVAWBFs",
830 | "y":"9VE4jf_Ok_o64zbTTlcuNJajHmt6v9TDVrU0CdvGRDA",
831 | "crv":"P-256"
832 | }
833 | }
834 | .
835 | {
836 | "jti":"e1j3V_bKic8-LAEB",
837 | "htm":"GET",
838 | "htu":"https://resource.example.org/protectedresource",
839 | "iat":1562262618,
840 | "ath":"fUHyO2r2Z3DZ53EsNrWBb0xWXoaNy59IiKCAqksmQEo"
841 | }
842 | ```
843 | !---
844 | Figure: Decoded Content of the `DPoP` Proof JWT in (#protected-resource-request) {#dpop-proof-pr}
845 |
846 | Upon receipt of a request to a protected resource within
847 | the protection space requiring DPoP authentication, if the request does
848 | not include valid credentials or does not contain an access
849 | token sufficient for access, the server
850 | can respond with a challenge to the client to provide DPoP authentication information.
851 | Such a challenge is made using the 401 (Unauthorized) response status code
852 | ([@!RFC9110], Section 15.5.2) and the `WWW-Authenticate` header field
853 | ([@!RFC9110], Section 11.6.1). The server MAY include the
854 | `WWW-Authenticate` header in response to other conditions as well.
855 |
856 | In such challenges:
857 |
858 | * The scheme name is `DPoP`.
859 | * The authentication parameter `realm` MAY be included to indicate the
860 | scope of protection in the manner described in [@!RFC9110], Section 11.5.
861 | * A `scope` authentication parameter MAY be included as defined in
862 | [@!RFC6750], Section 3.
863 | * An `error` parameter ([@!RFC6750], Section 3) SHOULD be included
864 | to indicate the reason why the request was declined,
865 | if the request included an access token but failed authentication.
866 | The error parameter values described in Section 3.1 of [@!RFC6750] are suitable
867 | as are any appropriate values defined by extension. The value `use_dpop_nonce` can be
868 | used as described in (#RSNonce) to signal that a nonce is needed in the DPoP proof of
869 | subsequent request(s). And `invalid_dpop_proof` is used to indicate that the DPoP proof
870 | itself was deemed invalid based on the criteria of (#checking).
871 | * An `error_description` parameter ([@!RFC6750], Section 3) MAY be included
872 | along with the `error` parameter to provide developers a human-readable
873 | explanation that is not meant to be displayed to end-users.
874 | * An `algs` parameter SHOULD be included to signal to the client the
875 | JWS algorithms that are acceptable for the DPoP proof JWT.
876 | The value of the parameter is a space-delimited list of JWS `alg` (Algorithm)
877 | header values ([@!RFC7515], Section 4.1.1).
878 | * Additional authentication parameters MAY be used and unknown parameters
879 | MUST be ignored by recipients.
880 |
881 |
882 | For example, in response to a protected resource request without
883 | authentication:
884 | !---
885 | ```
886 | HTTP/1.1 401 Unauthorized
887 | WWW-Authenticate: DPoP algs="ES256 PS256"
888 | ```
889 | !---
890 | Figure: HTTP 401 Response to a Protected Resource Request without Authentication
891 |
892 | And in response to a protected resource request that was rejected
893 | because the confirmation of the DPoP binding in the access token failed
894 | (with '\' line wrapping per RFC 8792):
895 |
896 | !---
897 | ```
898 | HTTP/1.1 401 Unauthorized
899 | WWW-Authenticate: DPoP error="invalid_token", \
900 | error_description="Invalid DPoP key binding", algs="ES256"
901 | ```
902 | !---
903 | Figure: HTTP 401 Response to a Protected Resource Request with an Invalid Token
904 |
905 | Note that browser-based client applications using CORS [@WHATWG.Fetch] only have access
906 | to CORS-safelisted response HTTP headers by default.
907 | In order for the application to obtain and use the `WWW-Authenticate` HTTP response header
908 | value, the server needs to make it available to the application by including
909 | `WWW-Authenticate` in the `Access-Control-Expose-Headers` response header list value.
910 |
911 | This authentication scheme is for origin-server authentication only.
912 | Therefore, this authentication scheme MUST NOT be used with the
913 | `Proxy-Authenticate` or `Proxy-Authorization` header fields.
914 |
915 | Note that the syntax of the `Authorization` header field for this authentication scheme
916 | follows the usage of the `Bearer` scheme defined in Section 2.1 of [@RFC6750].
917 | While not the preferred credential syntax of [@!RFC9110], it is compatible
918 | with the general authentication framework therein and was used for consistency
919 | and familiarity with the `Bearer` scheme.
920 |
921 | ## Compatibility with the Bearer Authentication Scheme
922 |
923 | Protected resources simultaneously supporting both the `DPoP` and `Bearer`
924 | schemes need to update how evaluation of bearer tokens is performed to prevent
925 | downgraded usage of a DPoP-bound access token.
926 | Specifically, such a protected resource MUST reject a DPoP-bound access
927 | token received as a bearer token per [@!RFC6750].
928 |
929 | Section 11.6.1 of [@!RFC9110] allows a protected resource to indicate support for
930 | multiple authentication schemes (i.e., `Bearer` and `DPoP`) with the
931 | `WWW-Authenticate` header field of a 401 (Unauthorized) response.
932 |
933 | A protected resource that supports only [@RFC6750] and is unaware of DPoP
934 | would most presumably accept a DPoP-bound access token as a bearer token
935 | (JWT [@!RFC7519] says to ignore unrecognized claims, Introspection [@RFC7662]
936 | says that other parameters might be present while placing no functional
937 | requirements on their presence, and [@RFC6750] is effectively silent on
938 | the content of the access token as it relates to validity). As such, a
939 | client can send a DPoP-bound access token using the `Bearer` scheme upon
940 | receipt of a `WWW-Authenticate: Bearer` challenge from a protected resource
941 | (or if it has prior such knowledge about the capabilities of the protected
942 | resource). The effect of this likely simplifies the logistics of phased
943 | upgrades to protected resources in their support DPoP or even
944 | prolonged deployments of protected resources with mixed token type support.
945 |
946 | If a protected resource supporting both `Bearer` and `DPoP` schemes elects to
947 | respond with multiple `WWW-Authenticate` challenges, attention should be paid to
948 | which challenge(s) should deliver the actual error information. It is
949 | RECOMMENDED that the following rules be adhered to:
950 |
951 | * If no authentication information has been included with the request, then the
952 | challenges SHOULD NOT include an error code or other error information, as per
953 | [@!RFC6750], Section 3.1 ((#multi-challenge-no-token)).
954 |
955 | * If the mechanism used to attempt authentication could be established
956 | unambiguously, then the corresponding challenge SHOULD be used to deliver error
957 | information ((#multi-challenge-invalid-token)).
958 |
959 | * Otherwise, both `Bearer` and `DPoP` challenged MAY be used to deliver error
960 | information ((#multi-challenge-ambiguous)).
961 |
962 | (Where needed, the following examples use '\' line wrapping per RFC 8792.)
963 |
964 | !---
965 | ```
966 | GET /protectedresource HTTP/1.1
967 | Host: resource.example.org
968 |
969 | HTTP/1.1 401 Unauthorized
970 | WWW-Authenticate: Bearer, DPoP algs="ES256 PS256"
971 | ```
972 | !---
973 | Figure: HTTP 401 Response to a Protected Resource Request without Authentication {#multi-challenge-no-token}
974 |
975 | !---
976 | ```
977 | GET /protectedresource HTTP/1.1
978 | Host: resource.example.org
979 | Authorization: Bearer INVALID_TOKEN
980 |
981 | HTTP/1.1 401 Unauthorized
982 | WWW-Authenticate: Bearer error="invalid_token", \
983 | error_description="Invalid token", DPoP algs="ES256 PS256"
984 | ```
985 | !---
986 | Figure: HTTP 401 Response to a Protected Resource Request with Invalid Authentication {#multi-challenge-invalid-token}
987 |
988 | !---
989 | ```
990 | GET /protectedresource HTTP/1.1
991 | Host: resource.example.org
992 | Authorization: Bearer Kz~8mXK1EalYznwH-LC-1fBAo.4Ljp~zsPE_NeO.gxU
993 | Authorization: DPoP Kz~8mXK1EalYznwH-LC-1fBAo.4Ljp~zsPE_NeO.gxU
994 |
995 | HTTP/1.1 400 Bad Request
996 | WWW-Authenticate: Bearer error="invalid_request", \
997 | error_description="Multiple methods used to include access token", \
998 | DPoP algs="ES256 PS256", error="invalid_request", \
999 | error_description="Multiple methods used to include access token"
1000 | ```
1001 | !---
1002 | Figure: HTTP 400 Response to a Protected Resource Request with Ambiguous Authentication {#multi-challenge-ambiguous}
1003 |
1004 | ## Client Considerations
1005 |
1006 | Authorization including a DPoP proof may not be idempotent (depending on server
1007 | enforcement of `jti`, `iat` and `nonce` claims). Consequently, all previously
1008 | idempotent requests for protected resources that were previously idempotent may
1009 | no longer be idempotent. It is RECOMMENDED that clients generate a unique DPoP
1010 | proof even when retrying idempotent requests in response to HTTP errors
1011 | generally understood as transient.
1012 |
1013 | Clients that encounter frequent network errors may experience additional
1014 | challenges when interacting with servers with more strict nonce validation
1015 | implementations.
1016 |
1017 | # Authorization Server-Provided Nonce {#ASNonce}
1018 |
1019 | This section specifies a mechanism using opaque nonces provided by the server
1020 | that can be used to limit the lifetime of DPoP proofs.
1021 | Without employing such a mechanism, a malicious party controlling the client
1022 | (including potentially the end-user)
1023 | can create DPoP proofs for use arbitrarily far in the future.
1024 |
1025 | Including a nonce value contributed by the authorization server in the DPoP proof
1026 | MAY be used by authorization servers to limit the lifetime of DPoP proofs.
1027 | The server determines when and if to issue a new DPoP nonce challenge
1028 | thereby requiring the use of the nonce value in subsequent DPoP proofs.
1029 | The logic through which the server makes that determination is out of scope of this document.
1030 |
1031 | An authorization server MAY supply a nonce value to be included by the client
1032 | in DPoP proofs sent. In this case, the authorization server responds to requests not including a nonce
1033 | with an HTTP `400` (Bad Request) error response per Section 5.2 of [@!RFC6749] using `use_dpop_nonce` as the
1034 | error code value. The authorization server includes a `DPoP-Nonce` HTTP header in the response supplying
1035 | a nonce value to be used when sending the subsequent request. Nonce values MUST be unpredictable.
1036 | This same error code is used when supplying a new nonce value when there was a nonce mismatch.
1037 | The client will typically retry the request with the new nonce value supplied
1038 | upon receiving a `use_dpop_nonce` error with an accompanying nonce value.
1039 |
1040 | For example, in response to a token request without a nonce when the authorization server requires one,
1041 | the authorization server can respond with a `DPoP-Nonce` value such as the following to provide
1042 | a nonce value to include in the DPoP proof:
1043 | !---
1044 | ```
1045 | HTTP/1.1 400 Bad Request
1046 | DPoP-Nonce: eyJ7S_zG.eyJH0-Z.HX4w-7v
1047 |
1048 | {
1049 | "error": "use_dpop_nonce",
1050 | "error_description":
1051 | "Authorization server requires nonce in DPoP proof"
1052 | }
1053 | ```
1054 | !---
1055 | Figure: HTTP 400 Response to a Token Request without a Nonce
1056 |
1057 | Other HTTP headers and JSON fields MAY also be included in the error response,
1058 | but there MUST NOT be more than one `DPoP-Nonce` header.
1059 |
1060 | Upon receiving the nonce, the client is expected to retry its token request
1061 | using a DPoP proof including the supplied nonce value in the `nonce` claim
1062 | of the DPoP proof.
1063 | An example unencoded JWT Payload of such a DPoP proof including a nonce is:
1064 | !---
1065 | ```
1066 | {
1067 | "jti": "-BwC3ESc6acc2lTc",
1068 | "htm": "POST",
1069 | "htu": "https://server.example.com/token",
1070 | "iat": 1562262616,
1071 | "nonce": "eyJ7S_zG.eyJH0-Z.HX4w-7v"
1072 | }
1073 | ```
1074 | !---
1075 | Figure: DPoP Proof Payload Including a Nonce Value
1076 |
1077 | The nonce is opaque to the client.
1078 |
1079 | If the `nonce` claim in the DPoP proof
1080 | does not exactly match a nonce recently supplied by the authorization server to the client,
1081 | the authorization server MUST reject the request.
1082 | The rejection response MAY include a `DPoP-Nonce` HTTP header
1083 | providing a new nonce value to use for subsequent requests.
1084 |
1085 | The intent is that clients need to keep only one nonce value and servers keep a
1086 | window of recent nonces.
1087 | That said, transient circumstances may arise in which the server's and client's
1088 | stored nonce values differ.
1089 | However, this situation is self-correcting;
1090 | with any rejection message,
1091 | the server can send the client the nonce value that the server wants it to use
1092 | and the client can store that nonce value and retry the request with it.
1093 | Even if the client and/or server discard their stored nonce values,
1094 | that situation is also self-correcting because new nonce values can be communicated
1095 | when responding to or retrying failed requests.
1096 |
1097 | Note that browser-based client applications using CORS [@WHATWG.Fetch] only have access
1098 | to CORS-safelisted response HTTP headers by default.
1099 | In order for the application to obtain and use the `DPoP-Nonce` HTTP response header
1100 | value, the server needs to make it available to the application by including
1101 | `DPoP-Nonce` in the `Access-Control-Expose-Headers` response header list value.
1102 |
1103 | ## Nonce Syntax {#NonceSyntax}
1104 |
1105 | The nonce syntax in ABNF as used by [@!RFC6749]
1106 | (which is the same as the `scope-token` syntax) is:
1107 |
1108 | !---
1109 | ```
1110 | nonce = 1*NQCHAR
1111 | ```
1112 | !---
1113 | Figure: Nonce ABNF
1114 |
1115 | ## Providing a New Nonce Value {#NewNonce}
1116 |
1117 | It is up to the authorization server when to supply a new nonce value
1118 | for the client to use.
1119 | The client is expected to use the existing supplied nonce in DPoP proofs
1120 | until the server supplies a new nonce value.
1121 |
1122 | The authorization server MAY supply the new nonce in the same way that
1123 | the initial one was supplied:
1124 | by using a `DPoP-Nonce` HTTP header in the response.
1125 | The `DPoP-Nonce` HTTP header field uses the nonce syntax defined in (#NonceSyntax).
1126 | Of course, each time this happens it requires an extra protocol round trip.
1127 |
1128 | A more efficient manner of supplying a new nonce value is also defined --
1129 | by including a `DPoP-Nonce` HTTP header
1130 | in the HTTP `200` (OK) response from the previous request.
1131 | The client MUST use the new nonce value supplied for the next token request,
1132 | and for all subsequent token requests until the authorization server
1133 | supplies a new nonce.
1134 |
1135 | Responses that include the `DPoP-Nonce` HTTP header should be uncacheable
1136 | (e.g., using `Cache-Control: no-store` in response to a `GET` request) to
1137 | prevent the response being used to serve a subsequent request and a stale
1138 | nonce value being used as a result.
1139 |
1140 | An example 200 OK response providing a new nonce value is:
1141 | !---
1142 | ```
1143 | HTTP/1.1 200 OK
1144 | Cache-Control: no-store
1145 | DPoP-Nonce: eyJ7S_zG.eyJbYu3.xQmBj-1
1146 | ```
1147 | !---
1148 | Figure: HTTP 200 Response Providing the Next Nonce Value
1149 |
1150 | # Resource Server-Provided Nonce {#RSNonce}
1151 |
1152 | Resource servers can also choose to provide a nonce value to be included
1153 | in DPoP proofs sent to them.
1154 | They provide the nonce using the `DPoP-Nonce` header in the same way that authorization servers do
1155 | as described in (#ASNonce) and (#NewNonce).
1156 | The error signaling is performed as described in (#http-auth-scheme).
1157 | Resource servers use an HTTP `401` (Unauthorized) error code
1158 | with an accompanying `WWW-Authenticate: DPoP` value
1159 | and `DPoP-Nonce` value to accomplish this.
1160 |
1161 | For example, in response to a resource request without a nonce when the resource server requires one,
1162 | the resource server can respond with a `DPoP-Nonce` value such as the following to provide
1163 | a nonce value to include in the DPoP proof
1164 | (with '\' line wrapping per RFC 8792):
1165 | !---
1166 | ```
1167 | HTTP/1.1 401 Unauthorized
1168 | WWW-Authenticate: DPoP error="use_dpop_nonce", \
1169 | error_description="Resource server requires nonce in DPoP proof"
1170 | DPoP-Nonce: eyJ7S_zG.eyJH0-Z.HX4w-7v
1171 | ```
1172 | !---
1173 | Figure: HTTP 401 Response to a Resource Request without a Nonce
1174 |
1175 | Note that the nonces provided by an authorization server and a resource server are different
1176 | and should not be confused with one another,
1177 | since nonces will be only accepted by the server that issued them.
1178 | Likewise, should a client use multiple authorization servers and/or resource servers,
1179 | a nonce issued by any of them should be used only at the issuing server.
1180 | Developers should also take care to not confuse DPoP nonces with the
1181 | OpenID Connect [@OpenID.Core] ID Token nonce.
1182 |
1183 | # Authorization Code Binding to DPoP Key {#dpop_jkt}
1184 |
1185 | Binding the authorization code issued to the client's proof-of-possession key
1186 | can enable end-to-end binding of the entire authorization flow.
1187 | This specification defines the `dpop_jkt` authorization request parameter for this purpose.
1188 | The value of the `dpop_jkt` authorization request parameter is the
1189 | JSON Web Key (JWK) Thumbprint [@!RFC7638] of the proof-of-possession public key
1190 | using the SHA-256 hash function -
1191 | the same value as used for the `jkt` confirmation method defined in (#jwk-thumb-jwt).
1192 |
1193 | When a token request is received, the authorization server computes the
1194 | JWK thumbprint of the proof-of-possession public key in the DPoP proof
1195 | and verifies that it matches the `dpop_jkt` parameter value in the authorization request.
1196 | If they do not match, it MUST reject the request.
1197 |
1198 | An example authorization request using the `dpop_jkt` authorization request parameter follows
1199 | (with '\' line wrapping per RFC 8792):
1200 | !---
1201 | ```
1202 | GET /authorize?response_type=code&client_id=s6BhdRkqt3&state=xyz\
1203 | &redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb\
1204 | &code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM\
1205 | &code_challenge_method=S256\
1206 | &dpop_jkt=NzbLsXh8uDCcd-6MNwXF4W_7noWXFZAfHkxZsRGC9Xs HTTP/1.1
1207 | Host: server.example.com
1208 | ```
1209 | !---
1210 | Figure: Authorization Request using the `dpop_jkt` Parameter
1211 |
1212 | Use of the `dpop_jkt` authorization request parameter is OPTIONAL.
1213 | Note that the `dpop_jkt` authorization request parameter MAY also be used
1214 | in combination with PKCE [@RFC7636], which is recommended by [@I-D.ietf-oauth-security-topics]
1215 | as a countermeasure to authorization code injection. The `dpop_jkt` authorization
1216 | request parameter only provides similar protections when a unique DPoP key is
1217 | used for each authorization request.
1218 |
1219 | ## DPoP with Pushed Authorization Requests
1220 |
1221 | When Pushed Authorization Requests (PAR, [@RFC9126]) are used in conjunction with DPoP, there are two ways in which the DPoP key can be communicated in the PAR request:
1222 |
1223 | * The `dpop_jkt` parameter can be used as described in (#dpop_jkt) to bind the issued
1224 | authorization code to a specific key. In this case, `dpop_jkt` MUST be included alongside other authorization request parameters in the POST body of the PAR request.
1225 | * Alternatively, the `DPoP` header can be added to the PAR request. In this
1226 | case, the authorization server MUST check the provided DPoP proof JWT as
1227 | defined in (#checking). It MUST further behave as if the contained public key's
1228 | thumbprint was provided using `dpop_jkt`, i.e., reject the subsequent token
1229 | request unless a DPoP proof for the same key is provided. This can help to
1230 | simplify the implementation of the client, as it can "blindly" attach the
1231 | `DPoP` header to all requests to the authorization server regardless of the
1232 | type of request. Additionally, it provides a stronger binding, as the `DPoP`
1233 | header contains a proof of possession of the private key.
1234 |
1235 | Both mechanisms MUST be supported by an authorization server that supports PAR and DPoP. If both mechanisms are used at the same time, the authorization server MUST reject the request if the JWK Thumbprint in `dpop_jkt` does not match the public key in the `DPoP` header.
1236 |
1237 | Allowing both mechanisms ensures that clients that use `dpop_jkt` do not need to
1238 | distinguish between front-channel and pushed authorization requests, and at the
1239 | same time, clients that only have one code path for protecting all calls to authorization server
1240 | endpoints do not need to distinguish between requests to the PAR endpoint and
1241 | the token endpoint.
1242 |
1243 | # Security Considerations {#Security}
1244 |
1245 | In DPoP, the prevention of token replay at a different endpoint (see
1246 | (#objective)) is achieved through authentication of the server per [@!RFC6125] and
1247 | binding of the DPoP proof to a certain URI and HTTP method. DPoP, however,
1248 | has a somewhat different nature of protection than TLS-based
1249 | methods such as OAuth Mutual TLS [@RFC8705] or OAuth Token
1250 | Binding [@I-D.ietf-oauth-token-binding] (see also (#Token_Replay) and (#request_integrity)).
1251 | TLS-based mechanisms can leverage a tight integration
1252 | between the TLS layer and the application layer to achieve strong
1253 | message integrity, authenticity,
1254 | and replay protection.
1255 |
1256 | ## DPoP Proof Replay {#Token_Replay}
1257 |
1258 | If an adversary is able to get hold of a DPoP proof JWT, the adversary
1259 | could replay that token at the same endpoint (the HTTP endpoint
1260 | and method are enforced via the respective claims in the JWTs). To
1261 | limit this, servers MUST only accept DPoP proofs for a limited time
1262 | after their creation (preferably only for a relatively brief period
1263 | on the order of seconds or minutes).
1264 |
1265 | To prevent multiple uses of the same DPoP proof, servers can store, in
1266 | the context of the target URI, the `jti` value of each DPoP proof for the
1267 | time window in which the respective DPoP proof JWT would be accepted.
1268 | HTTP requests to the same URI for which the `jti` value has been seen before
1269 | would be declined. Such a single-use check,
1270 | when strictly enforced, provides a very strong protection against DPoP
1271 | proof replay, but may not always be feasible in practice, e.g., when
1272 | multiple servers behind a single endpoint have no shared state.
1273 |
1274 | In order to guard against
1275 | memory exhaustion attacks, a server that is tracking `jti` values should reject
1276 | DPoP proof JWTs with unnecessarily large `jti` values or store only a hash thereof.
1277 |
1278 | Note: To accommodate for clock offsets, the server MAY accept DPoP
1279 | proofs that carry an `iat` time in the reasonably near future (on the order of seconds or minutes).
1280 | Because clock skews between servers
1281 | and clients may be large, servers MAY limit DPoP proof lifetimes by using
1282 | server-provided nonce values containing the time at the server rather than
1283 | comparing the client-supplied `iat` time to the time at the server. Nonces
1284 | created in this way yield the same result even in the face of arbitrarily
1285 | large clock skews.
1286 |
1287 | Server-provided nonces are an effective means for further reducing the chances for successful DPoP proof replay.
1288 | Unlike cryptographic nonces, it is acceptable for clients to use the same
1289 | `nonce` multiple times, and for the server to accept the same nonce multiple
1290 | times. As long as the `jti` value is tracked and duplicates rejected for the lifetime of the `nonce`, there
1291 | is no additional risk of token replay.
1292 |
1293 | ## DPoP Proof Pre-Generation {#Pre-Generation}
1294 |
1295 | An attacker in control of the client can pre-generate DPoP proofs for
1296 | specific endpoints arbitrarily far into the future by choosing the
1297 | `iat` value in the DPoP proof to be signed by the proof-of-possession key.
1298 | Note that one such attacker is the person who is the legitimate user of the client.
1299 | The user may pre-generate DPoP proofs to exfiltrate
1300 | from the machine possessing the proof-of-possession key
1301 | upon which they were generated
1302 | and copy them to another machine that does not possess the key.
1303 | For instance, a bank employee might pre-generate DPoP proofs
1304 | on a bank computer and then copy them to another machine
1305 | for use in the future, thereby bypassing bank audit controls.
1306 | When DPoP proofs can be pre-generated and exfiltrated,
1307 | all that is actually being proved in DPoP protocol interactions
1308 | is possession of a DPoP proof -- not of the proof-of-possession key.
1309 |
1310 | Use of server-provided nonce values that are not predictable by attackers can prevent this attack.
1311 | By providing new nonce values at times of its choosing,
1312 | the server can limit the lifetime of DPoP proofs,
1313 | preventing pre-generated DPoP proofs from being used.
1314 | When server-provided nonces are used, possession
1315 | of the proof-of-possession key is being demonstrated --
1316 | not just possession of a DPoP proof.
1317 |
1318 | The `ath` claim limits the use of pre-generated DPoP proofs to the lifetime
1319 | of the access token. Deployments that do not utilize the nonce mechanism
1320 | SHOULD NOT issue long-lived DPoP constrained access tokens,
1321 | preferring instead to use short-lived access tokens and refresh tokens.
1322 | Whilst an attacker could pre-generate DPoP proofs to use the refresh token
1323 | to obtain a new access token, they would be unable to realistically
1324 | pre-generate DPoP proofs to use a newly issued access token.
1325 |
1326 | ## DPoP Nonce Downgrade {#Nonce-Downgrade}
1327 |
1328 | A server MUST NOT accept any DPoP proofs without the `nonce` claim when a DPoP nonce has been provided to the client.
1329 |
1330 | ## Untrusted Code in the Client Context
1331 |
1332 | If an adversary is able to run code in the client's execution context,
1333 | the security of DPoP is no longer guaranteed. Common issues in web
1334 | applications leading to the execution of untrusted code are cross-site
1335 | scripting and remote code inclusion attacks.
1336 |
1337 | If the private key used for DPoP is stored in such a way that it
1338 | cannot be exported, e.g., in a hardware or software security module,
1339 | the adversary cannot exfiltrate the key and use it to create arbitrary
1340 | DPoP proofs. The adversary can, however, create new DPoP proofs as
1341 | long as the client is online, and use these proofs (together with the
1342 | respective tokens) either on the victim's device or on a device under
1343 | the attacker's control to send arbitrary requests that will be
1344 | accepted by servers.
1345 |
1346 | To send requests even when the client is offline, an adversary can try
1347 | to pre-compute DPoP proofs using timestamps in the future and
1348 | exfiltrate these together with the access or refresh token.
1349 |
1350 | An adversary might further try to associate tokens issued from the
1351 | token endpoint with a key pair under the adversary's control. One way
1352 | to achieve this is to modify existing code, e.g., by replacing
1353 | cryptographic APIs. Another way is to launch a new authorization grant
1354 | between the client and the authorization server in an iframe. This
1355 | grant needs to be "silent", i.e., not require interaction with the
1356 | user. With code running in the client's origin, the adversary has
1357 | access to the resulting authorization code and can use it to associate
1358 | their own DPoP keys with the tokens returned from the token endpoint.
1359 | The adversary is then able to use the resulting tokens on their own
1360 | device even if the client is offline.
1361 |
1362 | Therefore, protecting clients against the execution of untrusted code
1363 | is extremely important even if DPoP is used. Besides secure coding
1364 | practices, Content Security Policy [@W3C.CSP] can be used as a second
1365 | layer of defense against cross-site scripting.
1366 |
1367 | ## Signed JWT Swapping
1368 |
1369 | Servers accepting signed DPoP proof JWTs MUST verify that the `typ` field is `dpop+jwt` in the
1370 | headers of the JWTs to ensure that adversaries cannot use JWTs created
1371 | for other purposes.
1372 |
1373 | ## Signature Algorithms
1374 |
1375 | Implementers MUST ensure that only asymmetric digital signature algorithms (such as `ES256`) that
1376 | are deemed secure can be used for signing DPoP proofs. In particular,
1377 | the algorithm `none` MUST NOT be allowed.
1378 |
1379 | ## Request Integrity {#request_integrity}
1380 |
1381 | DPoP does not ensure the integrity of the payload or headers of
1382 | requests. The DPoP proof only contains claims for the HTTP URI and
1383 | method, but not, for example, the message body or general request
1384 | headers.
1385 |
1386 | This is an intentional design decision intended to keep DPoP simple to use, but
1387 | as described, makes DPoP potentially susceptible to replay attacks
1388 | where an attacker is able to modify message contents and headers. In
1389 | many setups, the message integrity and confidentiality provided by TLS
1390 | is sufficient to provide a good level of protection.
1391 |
1392 | Note: While signatures covering other parts of requests are out of the scope of
1393 | this specification, additional information to be signed can be
1394 | added into DPoP proofs.
1395 |
1396 | ## Access Token and Public Key Binding
1397 |
1398 | The binding of the access token to the DPoP public key, which is
1399 | specified in (#Confirmation), uses a cryptographic hash of the JWK
1400 | representation of the public key. It relies
1401 | on the hash function having sufficient second-preimage resistance so
1402 | as to make it computationally infeasible to find or create another
1403 | key that produces to the same hash output value. The SHA-256
1404 | hash function was used because it meets the aforementioned
1405 | requirement while being widely available.
1406 |
1407 | Similarly, the binding of the DPoP proof to the access token uses a
1408 | hash of that access token as the value of the `ath` claim
1409 | in the DPoP proof (see (#DPoP-Proof-Syntax)). This relies on the value
1410 | of the hash being sufficiently unique so as to reliably identify the
1411 | access token. The collision resistance of SHA-256 meets that requirement.
1412 |
1413 | ## Authorization Code and Public Key Binding
1414 |
1415 | Cryptographic binding of the authorization code to the DPoP public key,
1416 | is specified in (#dpop_jkt).
1417 | This binding prevents attacks in which the attacker captures the authorization code
1418 | and creates a DPoP proof using a proof-of-possession key
1419 | other than that held by the client
1420 | and redeems the authorization code using that DPoP proof.
1421 | By ensuring end-to-end that only the client's DPoP key can be used,
1422 | this prevents captured authorization codes from being exfiltrated and used
1423 | at locations other than the one to which the authorization code was issued.
1424 |
1425 | Authorization codes can, for instance, be harvested by attackers
1426 | from places that the HTTP messages containing them are logged.
1427 | Even when efforts are made to make authorization codes one-time-use,
1428 | in practice, there is often a time window during which attackers can replay them.
1429 | For instance, when authorization servers are implemented as scalable replicated services,
1430 | some replicas may temporarily not yet have the information needed to prevent replay.
1431 | DPoP binding of the authorization code solves these problems.
1432 |
1433 | If an authorization server does not (or cannot) strictly enforce the single-use limitation for authorization codes
1434 | and an attacker can access the authorization code (and if PKCE is used, the `code_verifier`),
1435 | the attacker can create a forged token request, binding the resulting token to an attacker-controlled key.
1436 | For example, using cross-site scripting, attackers might obtain access to the authorization code and PKCE parameters.
1437 | Use of the `dpop_jkt` parameter prevents this attack.
1438 |
1439 | The binding of the authorization code to the DPoP public key
1440 | uses a JWK Thumbprint of the public key, just as the access token binding does.
1441 | The same JWK Thumbprint considerations apply.
1442 |
1443 | ## Hash Algorithm Agility
1444 |
1445 | The `jkt` confirmation method member, the `ath` JWT claim, and the `dpop_jkt` authorization
1446 | request parameter defined herein all use the output of the SHA-256 hash function as their value.
1447 | The use of a single hash function by this specification was intentional and aimed at
1448 | simplicity and avoidance of potential security and interoperability issues arising from
1449 | common mistakes implementing and deploying parameterized algorithm agility schemes.
1450 | The use of a different hash function is not precluded, however, if future circumstances
1451 | change making SHA-256 insufficient for the requirements of this specification.
1452 | Should that need arise, it is expected that a short specification be produced that
1453 | updates this one. That specification will likely define, using the output of a then appropriate
1454 | hash function as the value, a new confirmation method member, a new JWT claim,
1455 | and a new authorization request parameter. These items will be used in place of, or alongside, their
1456 | respective counterparts in the same message structures and flows of the larger protocol defined
1457 | by this specification.
1458 |
1459 | ## Binding to Client Identity
1460 |
1461 | In cases where DPoP is used with client authentication, it is only bound to authentication by being
1462 | coincident in the same TLS tunnel. Since the DPoP proof is not directly cryptographically bound
1463 | to the authentication, it's possible that the authentication or the DPoP messages were copied into
1464 | the tunnel. While including the URI in the DPoP can partially mitigate some of this risk, modifying
1465 | the authentication mechanism to provide cryptographic binding between authentication and DPoP could
1466 | provide better protection. However, providing additional binding with authentication through the
1467 | modification of authentication mechanisms or other means is beyond the scope of this specification.
1468 |
1469 | # IANA Considerations {#IANA}
1470 |
1471 | ## OAuth Access Token Type Registration
1472 |
1473 | This specification requests registration of the following access token
1474 | type in the "OAuth Access Token Types" registry [@IANA.OAuth.Params]
1475 | established by [@!RFC6749].
1476 |
1477 | * Type name: `DPoP`
1478 | * Additional Token Endpoint Response Parameters: (none)
1479 | * HTTP Authentication Scheme(s): `DPoP`
1480 | * Change controller: IETF
1481 | * Specification document(s): [[ this specification ]]
1482 |
1483 | ## OAuth Extensions Error Registration
1484 |
1485 | This specification requests registration of the following error values
1486 | in the "OAuth Extensions Error" registry [@IANA.OAuth.Params]
1487 | established by [@!RFC6749].
1488 |
1489 | Invalid DPoP proof:
1490 |
1491 | * Name: `invalid_dpop_proof`
1492 | * Usage Location: token error response, resource access error response
1493 | * Protocol Extension: Demonstrating Proof of Possession (DPoP)
1494 | * Change controller: IETF
1495 | * Specification document(s): [[ this specification ]]
1496 |
1497 | Use DPoP nonce:
1498 |
1499 | * Name: `use_dpop_nonce`
1500 | * Usage Location: token error response, resource access error response
1501 | * Protocol Extension: Demonstrating Proof of Possession (DPoP)
1502 | * Change controller: IETF
1503 | * Specification document(s): [[ this specification ]]
1504 |
1505 | ## OAuth Parameters Registration
1506 |
1507 | This specification requests registration of the following
1508 | authorization request parameter
1509 | in the "OAuth Parameters" registry [@IANA.OAuth.Params]
1510 | established by [@!RFC6749].
1511 |
1512 | * Name: `dpop_jkt`
1513 | * Parameter Usage Location: authorization request
1514 | * Change Controller: IETF
1515 | * Reference: [[ (#dpop_jkt) of this specification ]]
1516 |
1517 | ## HTTP Authentication Scheme Registration
1518 |
1519 | This specification requests registration of the following scheme in the
1520 | "Hypertext Transfer Protocol (HTTP) Authentication Scheme Registry" [@RFC9110;@IANA.HTTP.AuthSchemes]:
1521 |
1522 | * Authentication Scheme Name: `DPoP`
1523 | * Reference: [[ (#http-auth-scheme) of this specification ]]
1524 |
1525 | ## Media Type Registration
1526 |
1527 | This section registers the `application/dpop+jwt` media type [@RFC2046]
1528 | in the IANA "Media Types" registry [@IANA.MediaTypes] in the manner described in [@RFC6838],
1529 | which is used to indicate that the content is a DPoP JWT.
1530 |
1531 | * Type name: application
1532 | * Subtype name: dpop+jwt
1533 | * Required parameters: n/a
1534 | * Optional parameters: n/a
1535 | * Encoding considerations: binary; A DPoP JWT is a JWT; JWT values are encoded as a series of base64url-encoded values (some of which may be the empty string) separated by period ('.') characters.
1536 | * Security considerations: See (#Security) of [[ this specification ]]
1537 | * Interoperability considerations: n/a
1538 | * Published specification: [[ this specification ]]
1539 | * Applications that use this media type: Applications using [[ this specification ]] for application-level proof of possession
1540 | * Fragment identifier considerations: n/a
1541 | * Additional information:
1542 | * File extension(s): n/a
1543 | * Macintosh file type code(s): n/a
1544 | * Person & email address to contact for further information: Michael B. Jones, mbj@microsoft.com
1545 | * Intended usage: COMMON
1546 | * Restrictions on usage: none
1547 | * Author: Michael B. Jones, mbj@microsoft.com
1548 | * Change controller: IETF
1549 | * Provisional registration? No
1550 |
1551 | ## JWT Confirmation Methods Registration
1552 |
1553 | This specification requests registration of the following value
1554 | in the IANA "JWT Confirmation Methods" registry [@IANA.JWT]
1555 | for JWT `cnf` member values established by [@!RFC7800].
1556 |
1557 | * Confirmation Method Value: `jkt`
1558 | * Confirmation Method Description: JWK SHA-256 Thumbprint
1559 | * Change Controller: IETF
1560 | * Specification Document(s): [[ (#Confirmation) of this specification ]]
1561 |
1562 | ## JSON Web Token Claims Registration
1563 |
1564 | This specification requests registration of the following Claims in the
1565 | IANA "JSON Web Token Claims" registry [@IANA.JWT] established by [@!RFC7519].
1566 |
1567 | HTTP method:
1568 |
1569 | * Claim Name: `htm`
1570 | * Claim Description: The HTTP method of the request
1571 | * Change Controller: IETF
1572 | * Specification Document(s): [[ (#DPoP-Proof-Syntax) of this specification ]]
1573 |
1574 | HTTP URI:
1575 |
1576 | * Claim Name: `htu`
1577 | * Claim Description: The HTTP URI of the request (without query and fragment parts)
1578 | * Change Controller: IETF
1579 | * Specification Document(s): [[ (#DPoP-Proof-Syntax) of this specification ]]
1580 |
1581 | Access token hash:
1582 |
1583 | * Claim Name: `ath`
1584 | * Claim Description: The base64url encoded SHA-256 hash of the ASCII encoding of the associated access token's value
1585 | * Change Controller: IETF
1586 | * Specification Document(s): [[ (#DPoP-Proof-Syntax) of this specification ]]
1587 |
1588 | ### "nonce" Registry Update
1589 |
1590 | The Internet Security Glossary [@RFC4949] provides a useful definition of nonce
1591 | as a random or non-repeating value that is included in data
1592 | exchanged by a protocol, usually for the purpose of guaranteeing
1593 | liveness and thus detecting and protecting against replay attacks.
1594 |
1595 | However, the initial registration of the `nonce` claim by [@OpenID.Core]
1596 | used language that was contextually specific to that application,
1597 | which was potentially limiting to its general applicability.
1598 |
1599 | This specification therefore requests that the entry for `nonce` in the
1600 | IANA "JSON Web Token Claims" registry [@IANA.JWT] be updated as follows to
1601 | reflect that the claim can be used appropriately in other contexts.
1602 |
1603 | * Claim Name: `nonce`
1604 | * Claim Description: Value used to associate a Client session with an ID Token (MAY also be used for nonce values in other applications of JWTs)
1605 | * Change Controller: OpenID Foundation Artifact Binding Working Group - openid-specs-ab@lists.openid.net
1606 | * Specification Document(s): [@OpenID.Core, section 2] and [[ this specification ]]
1607 |
1608 |
1609 | ## HTTP Message Header Field Names Registration
1610 |
1611 | This document specifies the following HTTP header fields,
1612 | registration of which is requested in the "Hypertext Transfer Protocol (HTTP) Field Name Registry"
1613 | registry [@RFC9110;@IANA.HTTP.Fields]:
1614 |
1615 | * Field name: `DPoP`
1616 | * Status: permanent
1617 | * Specification document: [[ this specification ]]
1618 |
1619 |
1620 | * Field name: `DPoP-Nonce`
1621 | * Status: permanent
1622 | * Specification document: [[ this specification ]]
1623 |
1624 | ## OAuth Authorization Server Metadata Registration
1625 |
1626 | This specification requests registration of the following value
1627 | in the IANA "OAuth Authorization Server Metadata" registry [@IANA.OAuth.Params]
1628 | established by [@RFC8414].
1629 |
1630 | * Metadata Name: `dpop_signing_alg_values_supported`
1631 | * Metadata Description: JSON array containing a list of the JWS algorithms supported for DPoP proof JWTs
1632 | * Change Controller: IETF
1633 | * Specification Document(s): [[ (#as-meta) of this specification ]]
1634 |
1635 | ## OAuth Dynamic Client Registration Metadata
1636 |
1637 | This specification requests registration of the following value
1638 | in the IANA "OAuth Dynamic Client Registration Metadata" registry [@IANA.OAuth.Params]
1639 | established by [@RFC7591].
1640 |
1641 | * Metadata Name: `dpop_bound_access_tokens`
1642 | * Metadata Description: Boolean value specifying whether the client always uses DPoP for token requests
1643 | * Change Controller: IETF
1644 | * Specification Document(s): [[ (#client-meta) of this specification ]]
1645 |
1646 | {backmatter}
1647 |
1648 | # Acknowledgements {#Acknowledgements}
1649 |
1650 | We would like to thank
1651 | Brock Allen,
1652 | Annabelle Backman,
1653 | Spencer Balogh,
1654 | Dominick Baier,
1655 | Vittorio Bertocci,
1656 | Jeff Corrigan,
1657 | Domingos Creado,
1658 | Andrii Deinega,
1659 | William Denniss,
1660 | Vladimir Dzhuvinov,
1661 | Mike Engan,
1662 | Nikos Fotiou,
1663 | Mark Haine,
1664 | Dick Hardt,
1665 | Joseph Heenan,
1666 | Bjorn Hjelm,
1667 | Jacob Ideskog,
1668 | Jared Jennings,
1669 | Benjamin Kaduk,
1670 | Pieter Kasselman,
1671 | Neil Madden,
1672 | Rohan Mahy,
1673 | Karsten Meyer zu Selhausen,
1674 | Nicolas Mora,
1675 | Steinar Noem,
1676 | Mark Nottingham,
1677 | Rob Otto,
1678 | Aaron Parecki,
1679 | Michael Peck,
1680 | Roberto Polli,
1681 | Paul Querna,
1682 | Justin Richer,
1683 | Joseph Salowey,
1684 | Rifaat Shekh-Yusef,
1685 | Filip Skokan,
1686 | Dmitry Telegin,
1687 | Dave Tonge,
1688 | Jim Willeke,
1689 | Philippe De Ryck,
1690 | and others (please let us know, if you've been mistakenly omitted)
1691 | for their valuable input, feedback and general support of this work.
1692 |
1693 | This document originated from discussions at the 4th OAuth Security
1694 | Workshop in Stuttgart, Germany. We thank the organizers of this
1695 | workshop (Ralf Kusters, Guido Schmitz).
1696 |
1697 | # Document History
1698 |
1699 | [[ To be removed from the final specification ]]
1700 |
1701 | -16
1702 |
1703 | * Per suggestion of the registry's designated expert, change "resource error response" to "resource access error response" for location of the two items in the "OAuth Extensions Error Registration" section
1704 |
1705 | -15
1706 |
1707 | * Editorial updates from IESG review/ballot
1708 | * Mike Jones and Daniel Fett with new email/organization info
1709 |
1710 | -14
1711 |
1712 | * Add sec considerations sub-section about binding to client identity
1713 | * Explicitly say that nonces must be unpredictable
1714 | * Change to a numbered list in 'Checking DPoP Proofs'
1715 | * Editorial adjustments
1716 | * Incorporated HTTP header field definition and RFC 8792 '\' line wrapping suggestions by Mark Nottingham
1717 |
1718 | -13
1719 |
1720 | * Editorial updates/fixes
1721 | * Make sure RFC7519 is a normative reference
1722 |
1723 | -12
1724 |
1725 | * Updates from Roman Danyliw's AD review
1726 | * DPoP-Nonce now included in HTTP header field registration request
1727 | * Fixed section reference to URI Scheme-Based Normalization
1728 | * Attempt to better describe the rationale for SHA-256 only and expectations for how hash algorithm agility would be achieved if needed in the future
1729 | * Elaborate on the use of multiple WWW-Authenticate challenges by protected resources
1730 | * Fix access token request examples that were missing a client_id
1731 |
1732 | -11
1733 |
1734 | * Updates addressing outstanding shepherd review comments per side meeting discussions at IETF 114
1735 | * Added more explanation of the PAR considerations
1736 | * Added parenthetical remark "(such as ES256)" to Signature Algorithms subsection
1737 | * Added more explanation for ath
1738 | * Added a reference to RFC8725 in mention of explicit JWT typing
1739 |
1740 | -10
1741 |
1742 | * Updates addressing some shepherd review comments
1743 | * Update HTTP references as RFCs 723x have been superseded by RFC 9110
1744 | * Editorial fixes
1745 | * Added some clarifications, etc. around nonce
1746 | * Added client considerations subsection
1747 | * Use bullets rather than numbers in Checking DPoP Proofs so as not to imply specific order
1748 | * Added notes/reminders about browser-based client applications using CORS needing access to response headers
1749 | * Added a JWT claims registry update request for "nonce" to (better) allow for more general use in other contexts
1750 |
1751 | -09
1752 |
1753 | * Add note/reminder about browser-based client applications using CORS needing access to response headers.
1754 | * Fixed typo
1755 |
1756 | -08
1757 |
1758 | * Lots of editorial updates from WGLC feedback
1759 | * Further clarify that either iat or nonce can be used alone in validating the timeliness of the proof and somewhat de-emphasize jti tracking
1760 |
1761 | -07
1762 |
1763 | * Registered the `application/dpop+jwt` media type.
1764 | * Editorial updates/clarifications based on review feedback.
1765 | * Added "(on the order of seconds or minutes)" to somewhat qualify "relatively brief period" and "reasonably near future" and give a general idea of expected timeframe without being overly prescriptive.
1766 | * Added a step to (#checking) to reiterate that the jwk header cannot have a private key.
1767 |
1768 | -06
1769 |
1770 | * Editorial updates and fixes
1771 | * Changed name of client metadata parameter to `dpop_bound_access_tokens`
1772 |
1773 | -05
1774 |
1775 | * Added Authorization Code binding via the `dpop_jkt` parameter.
1776 | * Described the authorization code reuse attack and how `dpop_jkt` mitigates it.
1777 | * Enhanced description of DPoP proof expiration checking.
1778 | * Described nonce storage requirements and how nonce mismatches and missing nonces are self-correcting.
1779 | * Specified the use of the `use_dpop_nonce` error for missing and mismatched nonce values.
1780 | * Specified that authorization servers use `400 (Bad Request)` errors to supply nonces and resource servers use `401 (Unauthorized)` errors to do so.
1781 | * Added a bit more about `ath` and pre-generated proofs to the security considerations.
1782 | * Mentioned confirming the DPoP binding of the access token in the list in (#checking).
1783 | * Added the `always_uses_dpop` client registration metadata parameter.
1784 | * Described the relationship between DPoP and Pushed Authorization Requests (PAR).
1785 | * Updated references for drafts that are now RFCs.
1786 |
1787 | -04
1788 |
1789 | * Added the option for a server-provided nonce in the DPoP proof.
1790 | * Registered the `invalid_dpop_proof` and `use_dpop_nonce` error codes.
1791 | * Removed fictitious uses of `realm` from the examples, as they added no value.
1792 | * State that if the introspection response has a `token_type`, it has to be `DPoP`.
1793 | * Mention that RFC7235 allows multiple authentication schemes in `WWW-Authenticate` with a 401.
1794 | * Editorial fixes.
1795 |
1796 | -03
1797 |
1798 | * Add an access token hash (`ath`) claim to the DPoP proof when used in conjunction with the presentation of an access token for protected resource access
1799 | * add Untrusted Code in the Client Context section to security considerations
1800 | * Editorial updates and fixes
1801 |
1802 | -02
1803 |
1804 | * Lots of editorial updates and additions including expanding on the objectives,
1805 | better defining the key confirmation representations, example updates and additions,
1806 | better describing mixed bearer/dpop token type deployments, clarify RT binding only being
1807 | done for public clients and why, more clearly allow for a bound RT but with bearer AT,
1808 | explain/justify the choice of SHA-256 for key binding, and more
1809 | * Require that a protected resource supporting bearer and DPoP at the same time
1810 | must reject an access token received as bearer, if that token is DPoP-bound
1811 | * Remove the case-insensitive qualification on the `htm` claim check
1812 | * Relax the jti tracking requirements a bit and qualify it by URI
1813 |
1814 |
1815 | -01
1816 |
1817 | * Editorial updates
1818 | * Attempt to more formally define the DPoP Authorization header scheme
1819 | * Define the 401/WWW-Authenticate challenge
1820 | * Added `invalid_dpop_proof` error code for DPoP errors in token request
1821 | * Fixed up and added to the IANA section
1822 | * Added `dpop_signing_alg_values_supported` authorization server metadata
1823 | * Moved the Acknowledgements into an Appendix and added a bunch of names (best effort)
1824 |
1825 | -00 [[ Working Group Draft ]]
1826 |
1827 | * Working group draft
1828 |
1829 | -04
1830 |
1831 | * Update OAuth MTLS reference to RFC 8705
1832 | * Use the newish RFC v3 XML and HTML format
1833 |
1834 | -03
1835 |
1836 | * rework the text around uniqueness requirements on the jti claim in the DPoP proof JWT
1837 | * make tokens a bit smaller by using `htm`, `htu`, and `jkt` rather than `http_method`, `http_uri`, and `jkt#S256` respectively
1838 | * more explicit recommendation to use mTLS if that is available
1839 | * added David Waite as co-author
1840 | * editorial updates
1841 |
1842 | -02
1843 |
1844 | * added normalization rules for URIs
1845 | * removed distinction between proof and binding
1846 | * "jwk" header again used instead of "cnf" claim in DPoP proof
1847 | * renamed "Bearer-DPoP" token type to "DPoP"
1848 | * removed ability for key rotation
1849 | * added security considerations on request integrity
1850 | * explicit advice on extending DPoP proofs to sign other parts of the HTTP messages
1851 | * only use the jkt#S256 in ATs
1852 | * iat instead of exp in DPoP proof JWTs
1853 | * updated guidance on token_type evaluation
1854 |
1855 |
1856 | -01
1857 |
1858 | * fixed inconsistencies
1859 | * moved binding and proof messages to headers instead of parameters
1860 | * extracted and unified definition of DPoP JWTs
1861 | * improved description
1862 |
1863 |
1864 | -00
1865 |
1866 | * first draft
1867 |
1868 |
1869 |
1870 |
1871 | OAuth Parameters
1872 | IANA
1873 |
1874 |
1875 |
1876 |
1877 |
1878 | Structured Syntax Suffix Registry
1879 | IANA
1880 |
1881 |
1882 |
1883 |
1884 |
1885 | Media Types
1886 | IANA
1887 |
1888 |
1889 |
1890 |
1891 |
1892 | Hypertext Transfer Protocol (HTTP) Authentication Scheme Registry
1893 | IANA
1894 |
1895 |
1896 |
1897 |
1898 |
1899 | JSON Web Token Claims
1900 | IANA
1901 |
1902 |
1903 |
1904 |
1905 |
1906 |
1907 | Hypertext Transfer Protocol (HTTP) Field Name Registry
1908 | IANA
1909 |
1910 |
1911 |
1912 |
1913 |
1914 |
1915 | Web Cryptography API
1916 |
1917 |
1918 |
1919 |
1920 |
1921 |
1922 |
1923 |
1924 |
1925 | JSON Web Signature and Encryption Algorithms
1926 | IANA
1927 |
1928 |
1929 |
1930 |
1931 |
1932 |
1933 | Content Security Policy Level 3
1934 |
1935 |
1936 |
1937 |
1938 |
1939 |
1940 |
1941 |
1942 |
1943 | OpenID Connect Core 1.0
1944 |
1945 |
1946 |
1947 |
1948 |
1949 |
1950 |
1951 |
1952 |
1953 |
1954 |
1955 |
1956 |
1957 |
1958 |
1959 |
1960 |
1961 |
1962 |
1963 |
1964 |
1965 | Secure Hash Standard (SHS)
1966 |
1967 | National Institute of Standards and Technology
1968 |
1969 |
1970 |
1971 |
1972 |
1973 |
1974 |
1975 |
1976 |
1977 | Fetch Living Standard
1978 |
1979 | WHATWG
1980 |
1981 |
1982 |
1983 |
1984 |
1985 |
1986 | CVE-2012-4929
1987 |
1988 |
1989 |
1990 | CVE-2013-3587
1991 |
1992 |
1993 |
1994 | CVE-2014-0160
1995 |
1996 |
1997 |
1998 | Incident report on memory leak caused by Cloudflare parser bug
1999 |
2000 |
2001 |
2002 | Security alert: Attack campaign involving stolen OAuth user tokens issued to two third-party integrators
2003 |
2004 |
2005 |
--------------------------------------------------------------------------------