Which key must sign the DPoP proof presented with a DPoP-bound access token?

Public key bound to the access token matches the DPoP proof keyRFC 9449 §4.3MUSTRoles: resource_server

Requirement as recorded in the ProtocolSoup registry

confirm that the public key to which the access token is bound matches the public key from the DPoP proof.

Read §4.3 in RFC 9449

Self-test verdict

PassCommit 49e2a4fEvaluated

This is ProtocolSoup's result against its own implementation at the commit shown. It is not a certification of ProtocolSoup or of any other product.

Captured from production

Not captured for this build.

Tests

Implementation

Explainer

What this requires

This is the second half of check 12 of RFC 9449 Section 4.3, which applies when a proof is "presented to a protected resource in conjunction with an access token". The list it belongs to opens with "the receiving server MUST ensure the following", so the check is a MUST. Section 6 states the same duty on its own: "Resource servers supporting DPoP MUST ensure that the public key from the DPoP proof matches the one bound to the access token."

The public key from the proof is the one in its jwk JOSE Header Parameter. The key the token is bound to is whatever the authorization server associated with it at issuance. For a JWT access token, Section 6.1 defines the jkt member of the cnf claim, whose value "MUST be the base64url encoding (as defined in [RFC7515]) of the JWK SHA-256 Thumbprint (according to [RFC7638]) of the DPoP public key (in JWK format) to which the access token is bound." The resource server computes the same thumbprint over the proof's jwk and compares the two.

Why it exists

Section 2 gives the aim of DPoP as "binding a token to a public key upon issuance and requiring that the client proves possession of the corresponding private key when using the token." This check is where that requirement is enforced. Checks 1 to 11 establish that the proof is well formed and signed by the key in its own header; the first half of check 12 ties the proof to this access token through ath. None of them asks whether the proof's key is the token's key.

What non-compliance looks like

A resource server that skips the comparison accepts a stolen DPoP-bound access token from anyone who can sign a proof with a key of their own: the attacker generates a key pair, puts its public key in jwk, computes ath over the stolen token, and every other check passes. The token then gives the "leaked or stolen access tokens" of Section 2 no more protection than a bearer token has.

The first half of check 12, that ath equals the hash of the access token, is a separate check.

How ProtocolSoup tests it

dpop.ValidateProof returns the RFC 7638 SHA-256 thumbprint of the proof's jwk once the proof has passed every other check, ath included. The OAuth 2.0 protected resource at /oauth2/resource compares that thumbprint with the cnf.jkt claim of the access token and, when they differ, answers HTTP 401 with invalid_token and the description DPoP proof key does not match the token's bound key. The OID4VCI Credential, deferred credential and notification endpoints compare it with the thumbprint stored with the access grant and answer HTTP 401 with invalid_dpop_proof. Both carry a WWW-Authenticate: DPoP challenge. The comparison runs before the server-provided nonce check and before the proof's jti is recorded.

TestJKTComputedFromProofMatchesCryptoThumbprint asserts that the thumbprint dpop.ValidateProof returns is the RFC 7638 thumbprint of the signing key. TestProtectedResourceRejectsWrongKeyProof obtains a token bound to one key, presents it to /oauth2/resource with a proof that a second key signed and that carries the right ath, asserts the 401 and its description, and then asserts that the same token is accepted with a proof from the first key. TestCredentialEndpointRejectsDPoPProofFromAnotherKey does the same at the OID4VCI Credential Endpoint and asserts invalid_dpop_proof with the same description.

The captured failing exchange presents a DPoP-bound access token to /oauth2/resource with a proof signed by a second key, carrying that key in jwk, the token's ath and the resource's DPoP-Nonce, so the key comparison is the only check it fails.

Related requirements

All RFC 9449 requirements · OID4VCI protocol page