Information Exposure Affecting next-auth package, versions <3.29.9>=4.0.0 <4.10.2


Severity

Recommended
0.0
low
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.05% (18th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-JS-NEXTAUTH-2965597
  • published2 Aug 2022
  • disclosed2 Aug 2022
  • creditShuPink

Introduced: 2 Aug 2022

CVE-2022-31186  (opens in a new tab)
CWE-200  (opens in a new tab)

How to fix?

Upgrade next-auth to version 3.29.9, 4.10.2 or higher.

Overview

next-auth is an Authentication for Next.js

Affected versions of this package are vulnerable to Information Exposure where it is possible to reveal sensitive information such as an identity provider's secret in logs.

Note: This vulnerability can be worked around by configuring the logger manually to remove the provider secret.

import log from "your-logging-service"
export const authOptions: NextAuthOptions = {
  debug: process.env.NODE_ENV !== "production",
  logger: {
    error: (code, metadata) => {
      if (!(metadata instanceof Error) &&  metadata.provider) {
        // redact the provider secret here
        delete metadata.provider
        log.error(code, metadata)
      } else {
        log.error(code, metadata)
      }
    }
  },
}

CVSS Scores

version 3.1