Skip to main content
Menu
Advisories

DPoP proof key confusion in Duende.AspNetCore.Authentication.JwtBearer allows use of leaked DPoP access tokens

GHSA-RHCF-M7HH-VPM7Published Updated GitHub

Description

Impact

Duende.AspNetCore.Authentication.JwtBearer validates DPoP proofs and enforces the token's key binding (cnf.jkt). There is one case where the binding check is incomplete: a proof signed with an RSA key whose jwk header also carries X.509 certificate members (x5c, x5u, x5t or x5t#S256). Normal DPoP clients don't send these members.

An attacker can use a DPoP-bound access token without the client's private key only if all of these hold:

  • The attacker has already obtained the access token, for example from a leak.
  • The client the token was issued to uses an RSA DPoP key. Tokens bound to elliptic curve (EC) keys stay protected.
  • The token hasn't expired yet.

In every other case, DPoP keeps protecting tokens as intended.

Separately, an attacker with any valid access token for the API can make the API process reject a client's genuine requests until it restarts.

Are you affected?

You are affected if you use Duende.AspNetCore.Authentication.JwtBearer to accept DPoP-bound access tokens, and at least one client uses an RSA DPoP key (algorithms RS256, RS384, RS512, PS256, PS384 or PS512, all allowed by default). Vulnerable implementations have configuration code similar to the following:

builder.Services.ConfigureDPoPTokensForScheme(JwtBearerDefaults.AuthenticationScheme);

Workarounds

If upgrading is not possible:

  • If all your clients use EC DPoP keys, restrict the allowed proof algorithms to ES256, ES384 and ES512 with DPoPOptions.ProofTokenValidationParameters.ValidAlgorithms. Proofs signed with RSA algorithms are then rejected.
  • Reject requests whose DPoP proof contains a certificate before they reach authentication: in middleware registered before UseAuthentication(), read the DPoP request header, decode the proof's JOSE header (for example with JsonWebTokenHandler.ReadJsonWebToken), and return 401 if its jwk contains x5c, x5u, x5t or x5t#S256. DPoP clients have no reason to send these members.

Affected versions

References

GitHub · DuendeSoftware/products