The core of the vulnerability lies in the OAuthStrategy.getRedirect function, which performed an insecure origin validation using startsWith. This allowed an attacker to craft a malicious domain that shared a prefix with a legitimate one, thereby bypassing the security check. An attacker could then initiate the OAuth authentication flow from their own domain. While the token would still be redirected to the legitimate application's configured callback URL, this flaw, combined with other misconfigurations or vulnerabilities, could allow the attacker to exfiltrate the access token and gain control of the user's account. The patch addresses this by replacing the flawed startsWith check with a strict origin comparison using the URL API to parse the referer and compare its origin. Additionally, a related security hardening was applied in OAuthService.create to prevent the leakage of sensitive request headers into the session cookie, reducing the overall attack surface.