Description
NextAuth.js is a complete open source authentication solution for Next.js applications. In affected versions an attacker can send a request to an app using NextAuth.js with an invalid `callbackUrl` query parameter, which internally is converted to a `URL` object. The URL instantiation would fail due to a malformed URL being passed into the constructor, causing it to throw an unhandled error which led to the **API route handler timing out and logging in to fail**. This has been remedied in versions 3.29.5 and 4.5.0. If for some reason you cannot upgrade, the workaround requires you to rely on Advanced Initialization. Please see the documentation for more.
Remediation
References
https://github.com/nextauthjs/next-auth/commit/25517b73153332d948114bacdff3b5908de91d85
https://github.com/nextauthjs/next-auth/commit/e498483b23273d1bfc81be68339607f88d411bd6
https://github.com/nextauthjs/next-auth/security/advisories/GHSA-g5fm-jp9v-2432
https://next-auth.js.org/configuration/initialization#advanced-initialization