CVE-2022-31186 Leakage of excessive information into log in next-auth

Low 3.3 Published Updated

Attackers with log access can obtain OAuth secrets from NextAuth.js logs, enabling client impersonation and permission escalation.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2022-31186?

CVE-2022-31186 is a low-severity vulnerability in nextauthjs next-auth, published on 1 Aug 2022. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

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.

Weakness: CWE-532

Which versions are affected by CVE-2022-31186?

4 open source packages ship an affected version, including next-auth. It affects 1 product.

PackageAffectedFixed in
next-auth npmAll versions3.29.9
next-auth npmAll versions3.29.9
next-auth npmFrom 4.0.04.10.2
next-auth npmFrom 4.0.04.10.2

Products include Next-Auth Nextauth.js.

How do I fix CVE-2022-31186?

Upgrade next-auth to a fixed version for your release line: 3.29.9 or 4.10.2.

Is CVE-2022-31186 being exploited?

There is no known exploitation of CVE-2022-31186 in the wild and no public exploit code.

Sources

Also known as GHSA-p6mm-27gq-9v3p.

Is CVE-2022-31186 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free