CVE-2022-23540: Insecure Default Algorithm in jsonwebtoken Library

jsonwebtoken Updated 02 Oct 2025

Summary

22/12/2022
Yes i
Moderate
6.4

CVE-2022-23540: Overview In versions. Affects jsonwebtoken versions < 9.0.0. Fixed in 9.0.0. 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 Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The jsonwebtoken library is an npm package that provides functionality for creating, signing, and verifying JSON Web Tokens (JWTs). JWTs are used for secure transmission of information between parties. The library allows developers to generate and validate JWTs using various algorithms. However, versions <=8.5.1 of the library have a vulnerability that can lead to signature validation bypass. This vulnerability occurs when the jwt.verify() function is used with a token that has no signature, no specified algorithms, and a falsy secret or key. In such cases, the library defaults to the none algorithm for signature verification, which can be exploited to bypass signature validation.

Vulnerability Detail

The vulnerability in the jsonwebtoken library allows an attacker to bypass signature validation when using the jwt.verify() function. By providing a token with no signature, no specified algorithms, and a falsy secret or key, the library defaults to the none algorithm for signature verification. This means that even if the token is tampered with or does not have a valid signature, it will still be considered valid by the library. This can lead to unauthorized access or privilege escalation in applications that rely on JWTs for authentication or authorization.

How To Fix

Latest published version: 9.0.3 as of 23 Oct 2026

npm install jsonwebtoken@9.0.3

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

9.0.0

This is the first release that contains the fix.

npm install jsonwebtoken@9.0.0

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

Workaround

There is no specific workaround for this vulnerability. The best course of action is to update to a fixed version of the jsonwebtoken library.

Conclusion

The jsonwebtoken library versions <=8.5.1 are vulnerable to signature validation bypass due to an insecure default algorithm in the jwt.verify() function. To mitigate this vulnerability, it is crucial to update to version 9.0.0 or later of the library. This update removes the default support for the none algorithm and ensures that tokens with no signature and no specified algorithms are not considered valid. For further assistance or support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for jsonwebtoken →

Share this vulnerability

FAQ

You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply provide the package-lock.json file of your application, and Vulert will analyze it for any open-source vulnerabilities, including this one.

The consequences of this vulnerability can vary depending on how JWTs are used in the affected application. In general, it can lead to unauthorized access or privilege escalation, as the library will consider tampered or invalid tokens as valid. This can result in attackers bypassing authentication or gaining elevated privileges within the application.

At the time of this report, there are no known public exploits specifically targeting this vulnerability. However, it is important to update to a fixed version of the jsonwebtoken library to mitigate the risk of potential exploits.

No, the default support for the none algorithm has been removed in version 9.0.0 of the jsonwebtoken library. If you still need to use the none algorithm, you must explicitly specify it in the jwt.verify() options.

There should be no impact on existing users if they update to version 9.0.0 or later of the jsonwebtoken library and do not rely on the none algorithm. However, if the none algorithm is required, it must be explicitly specified in the jwt.verify() options.

Related vulnerabilities

Recent vulnerabilities recorded for jsonwebtoken.

How To Fix

Latest published version: 9.0.3 as of 23 Oct 2026

npm install jsonwebtoken@9.0.3

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

9.0.0

This is the first release that contains the fix.

npm install jsonwebtoken@9.0.0

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