CVE-2021-32702: Reflected XSS in @auth0/nextjs-auth0

@auth0/nextjs-auth0 Updated 02 Oct 2025

Summary

28/06/2021
Yes i
High
8.0

CVE-2021-32702: Reflected XSS from the callback handler's error query parameter. Affects @auth0/nextjs-auth0 versions < 1.4.2. Fixed in 1.4.2. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The @auth0/nextjs-auth0 package is an npm package that provides authentication and authorization capabilities for Next.js applications. It allows developers to easily integrate Auth0 authentication into their Next.js projects. This package is vulnerable to a reflected cross-site scripting (XSS) attack, which can allow an attacker to execute arbitrary code by providing a malicious payload in the 'error' query parameter. The vulnerability exists in versions 1.4.1 and below of the package.

Vulnerability Detail

The vulnerability arises from the lack of proper input sanitization and validation in the callback handler of the @auth0/nextjs-auth0 package. When an error occurs during the authentication process, the error message is returned as part of the HTML response. However, this error message is not properly escaped, allowing an attacker to inject malicious code. By crafting a specially-crafted URL with a malicious payload in the 'error' query parameter, an attacker can trick a user into clicking the link and executing the injected code in their browser. This can lead to various consequences, including session hijacking, data theft, and unauthorized actions on behalf of the user.

How To Fix

Minimum fixed version

1.4.2

This is the first release that contains the fix.

npm install @auth0/nextjs-auth0@1.4.2

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading to version 1.4.2 is not immediately feasible, a temporary workaround can be implemented by manually sanitizing and escaping the error message in the callback handler. This can be done using a library or function that provides HTML escaping, such as 'he' or 'lodash.escape'. Here is an example of how to implement the workaround using the 'he' library:

const he = require('he');

// Callback handler
function handleCallback(req, res) {
  // Process error message
  const errorMessage = req.query.error;
  const sanitizedErrorMessage = he.escape(errorMessage);

  // Handle error
  // ...
}

Conclusion

The @auth0/nextjs-auth0 package is vulnerable to a reflected XSS attack that allows an attacker to execute arbitrary code by injecting a malicious payload in the 'error' query parameter. To mitigate this vulnerability, it is crucial to upgrade to version 1.4.2 of the package or implement the provided workaround. Failure to address this vulnerability can lead to serious security breaches and compromise the integrity of Next.js applications. For further support and assistance in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for @auth0/nextjs-auth0 →

Share this vulnerability

FAQ

You are affected by this vulnerability if you are using version 1.4.1 or lower of the @auth0/nextjs-auth0 package, unless you have implemented custom error handling that does not return the error message in an HTML response.

No, updating to version 1.4.2 should not impact your users. The fix adds basic HTML escaping to the error message, which ensures that the injected code is not executed.

The severity of this vulnerability is rated as HIGH with a CVSS score of 8.0. This indicates a significant security risk that should be addressed promptly.

This vulnerability was discovered by inian and git-ishanpatel and reported to the @auth0/nextjs-auth0 package maintainers.

Related vulnerabilities

Recent vulnerabilities recorded for @auth0/nextjs-auth0.

How To Fix

Minimum fixed version

1.4.2

This is the first release that contains the fix.

npm install @auth0/nextjs-auth0@1.4.2

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback