The vulnerability lies in the JWT (JSON Web Token) verification process within the Google, Apple, and Facebook authentication adapters of Parse Server. The core issue, known as algorithm confusion, is in the verifyIdToken function in each of these adapters. The vulnerable code extracted the signing algorithm directly from the alg field of the JWT header and used it for verification. An attacker could craft a JWT with the alg header set to "none", which would cause the jsonwebtoken library to skip the signature verification step entirely. This would allow an unauthenticated attacker to forge a token for any user and gain unauthorized access to their account.
The patch addresses this by removing the code that reads the algorithm from the token header. Instead, it hardcodes the expected signing algorithm to ['RS256'] during the jwt.verify call. This ensures that only tokens signed with the correct and expected algorithm are accepted. Additionally, the key fetching mechanism in the Google adapter was replaced with the more secure jwks-rsa library to better handle JSON Web Key Sets (JWKS) and reject tokens with unknown key IDs (kid).