The vulnerability described in GHSA-7hh9-gp72-wh7h is an improper audience validation issue in the auth0/laravel-auth0 package, which stems from a dependency on the auth0/auth0-php SDK. The fix involves upgrading auth0/auth0-php from version 8.17.0 to 8.18.0.
My analysis focused on the code changes within the auth0/auth0-php repository between these two versions. By comparing the git tags for 8.17.0 and 8.18.0, I identified the specific commits that contain the security patch.
The key change is in the Auth0\SDK\Token::validate method. Before the patch, this function did not have a mechanism to differentiate an ID token from an access token when performing validation. An attacker could present an ID token, and the system would treat it as a valid access token.
The patch introduces a crucial check: when a token is being validated as an access token (TYPE_ACCESS_TOKEN), the code now inspects it for a nonce claim. The nonce claim is a standard part of the OpenID Connect (OIDC) specification for ID tokens to prevent replay attacks, but it is not expected in access tokens. If a nonce is found, the validation fails, and an InvalidTokenException is thrown.
This change directly addresses the root cause of the vulnerability by ensuring that ID tokens cannot be misused as access tokens, thus enforcing proper token type validation.