The vulnerability is a PKCE bypass where an attacker could cause the PKCE check to be skipped. The provided patch in commit d954473f066f0daa3949717fd4d6e805d2ac618b addresses this by adding a specific check in src/oauth-provider.ts within the OAuthProviderImpl class.
The core of the vulnerability lies in a method within OAuthProviderImpl that handles the token exchange. This method, prior to the patch, did not validate whether PKCE was actually used in the authorization phase if a code_verifier was supplied in the token request. The patch adds a condition: if (!isPkceEnabled && codeVerifier), which explicitly rejects the request if a code_verifier is present but PKCE was not enabled for that authorization flow. The absence of this check is the vulnerability.
-
OAuthProviderImpl.[method_handling_token_request]: This represents the specific internal method within OAuthProviderImpl where the logical flaw existed and was patched. The exact method name is not visible in the provided diff hunk, but its role in handling token requests and PKCE logic is clear from the patch context (variables like isPkceEnabled, codeVerifier, and the error message code_verifier provided for a flow that did not use PKCE). This method is directly responsible for the vulnerable behavior.
-
OAuthProvider.fetch: This is the public method of the OAuthProvider class (which uses OAuthProviderImpl internally). As seen in the test files, oauthProvider.fetch is the entry point for all requests to the OAuth provider, including token requests. Therefore, an exploit attempt would target an endpoint handled by this fetch method. The fetch method would then call the vulnerable internal logic within OAuthProviderImpl. The fix to the internal logic ensures that OAuthProvider.fetch now behaves securely with respect to this PKCE downgrade attack vector.
Both functions are critical. The method in OAuthProviderImpl contains the actual flawed logic, and OAuthProvider.fetch is the exposed interface that would be called during an exploit, leading to the execution of that flawed logic.