The vulnerability lies in the IntrospectAccessToken function, which is responsible for validating access tokens. Before the patch, this function did not perform sufficient validation on the incoming JWT, allowing a Verifiable Presentation (VP) to be replayed as an access token. This is a classic type confusion vulnerability where the system cannot distinguish between two different types of JWTs.
The patch addresses this by adding three key validation checks to IntrospectAccessToken:
typ header validation: It now requires the typ header to be at+jwt, ensuring that only access tokens are processed.
- Required claims validation: It checks for the presence of
iss, sub, and service claims, which are essential for access control.
- Issuer-to-key binding: It verifies that the
iss claim matches the DID extracted from the kid header, preventing an attacker from using a token with a mismatched issuer and signing key.
The buildAccessToken function was also updated to set the typ header to at+jwt when creating new access tokens. This ensures that newly issued tokens are compliant with the new validation rules.