{"id":"CVE-2022-29214","aliases":["CVE-2022-29214","GHSA-q2mx-j4x2-2h74"],"related":[],"kind":"vulnerability","state":"published","title":"URL Redirection to Untrusted Site ('Open Redirect') in next-auth","summary":"NextAuth.js (next-auth) is am open source authentication solution for Next.js applications. Prior to versions 3.29.3 and 4.3.3, an open redirect vulnerability is present when the developer is implementing an OAuth 1 provider. Versions 3.29.3 and 4.3.3 contain a patch for this issue. The maintainers recommend adding a certain configuration to one's `callbacks` option as a workaround for those unable to upgrade.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"NextAuth.js (next-auth) is am open source authentication solution for Next.js applications. Prior to versions 3.29.3 and 4.3.3, an open redirect vulnerability is present when the developer is implementing an OAuth 1 provider. Versions 3.29.3 and 4.3.3 contain a patch for this issue. The maintainers recommend adding a certain configuration to one's `callbacks` option as a workaround for those unable to upgrade.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nWe found that this vulnerability is present when the developer is implementing an OAuth 1 provider (by extension, it means Twitter, which is the only built-in provider using OAuth 1), but **upgrading** is **still recommended**.\n\n`next-auth` v3 users before version 3.29.3 are impacted. (We recommend upgrading to v4, as v3 is considered unmaintained. See our [migration guide](https://next-auth.js.org/getting-started/upgrade-v4))\n\n`next-auth` v4 users before version 4.3.3 are impacted.\n\n### Patches\n\nWe've released patches for this vulnerability in:\n  \n- v3 - `3.29.3`\n- v4 - `4.3.3`\n\nYou can do:\n\n```sh\nnpm i next-auth@latest\n```\n\nor\n\n```sh\nyarn add next-auth@latest\n```\n\nor\n\n```sh\npnpm add next-auth@latest\n```\n\n(This will update to the latest v4 version, but you can change  `latest` to `3` if you want to stay on v3.)\n\n### Workarounds\n\nIf you are not able to upgrade for any reason, you can add the following configuration to your `callbacks` option:\n\n```ts\n// async redirect(url, baseUrl) { // v3\nasync redirect({ url, baseUrl }) { // v4\n    // Allows relative callback URLs\n    if (url.startsWith(\"/\")) return `${baseUrl}${url}`\n    // Allows callback URLs on the same origin\n    else if (new URL(url).origin === baseUrl) return url\n    return baseUrl\n}\n```\n\n### References\n\nThis vulnerability was discovered right after https://github.com/nextauthjs/next-auth/security/advisories/GHSA-f9wg-5f46-cjmw was published and is very similar in nature.\n\nRead more about the `callbacks.redirect` option in the documentation: https://next-auth.js.org/configuration/callbacks#redirect-callback\n\n### For more information\n\nIf you have any concerns, we request responsible disclosure, outlined here: https://next-auth.js.org/security#reporting-a-vulnerability\n\n### Timeline\n\nThe issue was reported 2022 April 20th, a response was sent out to the reporter 8 minutes after, and a patch was produced within a few days.","format":"markdown","source":"ghsa"},{"lang":"es","text":"NextAuth.js (next-auth) es una solución de autenticación de código abierto para aplicaciones Next.js. En versiones anteriores a 3.29.3 y 4.3.3, se presenta una vulnerabilidad de redireccionamiento abierto cuando el desarrollador implementa un proveedor OAuth 1. Las versiones 3.29.3 y 4.3.3 contienen un parche para este problema. Los mantenedores recomiendan añadir una determinada configuración a la opción \"callbacks\" como mitigación para aquellos que no puedan actualizar","source":"nvd"}],"published":"2022-05-20T23:45:11.000Z","modified":"2026-06-17T04:39:50.540Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:M/Au:N/C:P/I:P/A:N","score":5.8,"rating":"MEDIUM"}],"cwes":["CWE-601"],"affected":[{"ranges":[{"version":"< 3.29.3","status":"affected"},{"version":">= 4.0.0, < 4.3.3","status":"affected"}],"vendor":"nextauthjs","product":"next-auth","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"3.29.3"}],"ecosystem":"npm","package":"next-auth","purl":"pkg:npm/next-auth","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"4.0.0","status":"affected","fixed":"4.3.3"}],"ecosystem":"npm","package":"next-auth","purl":"pkg:npm/next-auth","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"3.29.3"},{"status":"affected","introduced":"4.0.0","fixed":"4.3.3"}],"vendor":"nextauth.js","product":"next-auth","cpe":"cpe:2.3:a:nextauth.js:next-auth:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/nextauthjs/next-auth/security/advisories/GHSA-q2mx-j4x2-2h74","tags":["third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/nextauthjs/next-auth/releases/tag/next-auth%40v4.3.3","tags":["release-notes","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-29214","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/nextauthjs/next-auth","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2025-04-23T14:06:57.338Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-29214","url":"https://www.cve.org/CVERecord?id=CVE-2022-29214","licence":"CVE Terms of Use","modified":"2025-04-23T18:23:37.970Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-q2mx-j4x2-2h74","url":"https://github.com/advisories/GHSA-q2mx-j4x2-2h74","licence":"CC-BY-4.0","modified":"2023-11-08T04:09:10.878Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-29214","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-29214","licence":"Public domain","modified":"2026-06-17T04:39:50.540Z"}],"updatedAt":"2026-11-25T22:58:11.883Z","epss":{"score":0.0067,"percentile":0.53263,"date":"2026-12-01T12:00:22.000Z"}}