{"id":"CVE-2022-31186","aliases":["CVE-2022-31186","GHSA-p6mm-27gq-9v3p"],"related":[],"kind":"vulnerability","state":"published","title":"Leakage of excessive information into log in next-auth","summary":"NextAuth.js is a complete open source authentication solution for Next.js applications. An information disclosure vulnerability in `next-auth` before `v4.10.2` and `v3.29.9` allows an attacker with log access privilege to obtain excessive information such as an identity provider's secret in the log (which is thrown during OAuth error handling) and use it to leverage further attacks on the system, like impersonating the client to ask for extensive permissions. This issue has been patched in `v4.10.2` and `v3.29.9` by moving the log for `provider` information to the debug level. In addition, we added a warning for having the `debug: true` option turned on in production. If for some reason you cannot upgrade, you can user the `logger` configuration option by sanitizing the logs.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"NextAuth.js is a complete open source authentication solution for Next.js applications. An information disclosure vulnerability in `next-auth` before `v4.10.2` and `v3.29.9` allows an attacker with log access privilege to obtain excessive information such as an identity provider's secret in the log (which is thrown during OAuth error handling) and use it to leverage further attacks on the system, like impersonating the client to ask for extensive permissions. This issue has been patched in `v4.10.2` and `v3.29.9` by moving the log for `provider` information to the debug level. In addition, we added a warning for having the `debug: true` option turned on in production. If for some reason you cannot upgrade, you can user the `logger` configuration option by sanitizing the logs.","source":"cvelist"},{"lang":"en","text":"### Impact\nAn information disclosure vulnerability in `next-auth` before `v4.10.2` and `v3.29.9` allows an attacker with log access privilege to obtain excessive information such as an identity provider's secret in the log (which is thrown during OAuth error handling) and use it to leverage further attacks on the system, like impersonating the client to ask for extensive permissions.\n\n### Patches\nWe patched this vulnerability in `v4.10.2` and `v3.29.9` by moving the log for `provider` information to the debug level. In addition, we added a warning for having the `debug: true` option turned on in production and documented it [here](https://next-auth.js.org/warnings#debug_enabled).\n> You have enabled the debug option. It is meant for development only, to help you catch issues in your authentication flow and you should consider removing this option when deploying to production. One way of only allowing debugging while not in production is to set debug: process.env.NODE_ENV !== \"production\", so you can commit this without needing to change the value.\n> \n> If you want to log debug messages during production anyway, we recommend setting the [logger option](https://next-auth.js.org/configuration/options#logger) with proper sanitization of potentially sensitive user information.\n\nTo upgrade:\n\n```sh\nnpm i next-auth@latest\n# or\nyarn add next-auth@latest\n# or\npnpm add next-auth@latest\n```\n(This will update to the latest v4 version, but you can change `latest` to 3 if you want to stay on v3. This is not recommended. v3 is unmaintained.)\n\n### Workarounds\n\nIf for some reason you cannot upgrade, you can user the `logger` configuration option by sanitizing the logs:\n```ts\n// Example\nimport log from \"your-logging-service\"\nexport const authOptions: NextAuthOptions = {\n  debug: process.env.NODE_ENV !== \"production\",\n  logger: {\n    error: (code, metadata) => {\n      if (!(metadata instanceof Error) &&  metadata.provider) {\n        // redact the provider secret here\n        delete metadata.provider\n        log.error(code, metadata)\n      } else {\n        log.error(code, metadata)\n      }\n    }\n  },\n}\n```\n\n### References\nRelated documentation:\n- https://next-auth.js.org/warnings#debug_enabled\n- https://next-auth.js.org/configuration/options#logger \n- https://next-auth.js.org/getting-started/upgrade-v4\n\n### For more information\nIf you have any concerns, we request responsible disclosure, outlined here: https://next-auth.js.org/security#reporting-a-vulnerability\n\n### Timeline\nThe issue was reported 18th of July, a response was sent out in less than 20 minutes and after identifying the issue a patch was published within a week.","format":"markdown","source":"ghsa"},{"lang":"es","text":"NextAuth.js es una completa solución de autenticación de código abierto para aplicaciones Next.js. Una vulnerabilidad de divulgación de información en \"next-auth\" versiones anteriores a \"v4.10.2\" y \"v3.29.9\" permite a un atacante con privilegio de acceso al registro obtener información excesiva, como el secreto de un proveedor de identidad en el registro (que sea lanzada durante la administración de errores de OAuth) y usarla para aprovechar otros ataques al sistema, como hacerse pasar por el cliente para solicitar amplios permisos. Este problema ha sido parcheado en versiones \"v4.10.2\" y \"v3.29.9\" moviendo el registro de la información del \"proveedor\" al nivel de depuración. Además, hemos añadido una advertencia por tener la opción \"debug: true\" activada en producción. Si por alguna razón no puede actualizar, puede usar la opción de configuración \"logger\" saneando los registros","source":"nvd"}],"published":"2022-08-01T19:25:24.000Z","modified":"2026-06-17T04:44:59.163Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N","score":3.3,"rating":"LOW"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N","score":3.3,"rating":"LOW"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N","score":3.3,"rating":"LOW"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N","score":3.3,"rating":"LOW"}],"cwes":["CWE-532"],"affected":[{"ranges":[{"version":">= 4.0.0, < 4.10.2","status":"affected"},{"version":"< 3.29.9","status":"affected"}],"vendor":"nextauthjs","product":"next-auth","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"3.29.9"}],"ecosystem":"npm","package":"next-auth","purl":"pkg:npm/next-auth","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"4.0.0","status":"affected","fixed":"4.10.2"}],"ecosystem":"npm","package":"next-auth","purl":"pkg:npm/next-auth","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"3.29.9"},{"status":"affected","introduced":"4.0.0","fixed":"4.10.2"}],"vendor":"next-auth","product":"nextauth.js","cpe":"cpe:2.3:a:next-auth:nextauth.js:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://next-auth.js.org/getting-started/upgrade-v4","tags":["vendor-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/nextauthjs/next-auth/security/advisories/GHSA-p6mm-27gq-9v3p","tags":["third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://next-auth.js.org/configuration/options#logger","tags":["vendor-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://next-auth.js.org/warnings#debug_enabled","tags":["vendor-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-31186","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:02:52.307Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-31186","url":"https://www.cve.org/CVERecord?id=CVE-2022-31186","licence":"CVE Terms of Use","modified":"2025-04-23T17:56:16.785Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-p6mm-27gq-9v3p","url":"https://github.com/advisories/GHSA-p6mm-27gq-9v3p","licence":"CC-BY-4.0","modified":"2023-11-08T04:09:29.321Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-31186","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-31186","licence":"Public domain","modified":"2026-06-17T04:44:59.163Z"}],"updatedAt":"2026-11-25T22:58:13.346Z","epss":{"score":0.00263,"percentile":0.19332,"date":"2026-12-01T12:00:22.000Z"}}