CVE-2023-48223: JWT Algorithm Confusion in fast-jwt

fast-jwt Updated 02 Oct 2025

Summary

20/11/2023
Yes i
Moderate
5.9

CVE-2023-48223: JWT Algorithm Confusion. Affects fast-jwt versions < 3.3.2. Fixed in 3.3.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 Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

fast-jwt is an npm package that provides functionality for JSON Web Tokens (JWT) in Node.js applications. It includes features for signing and verifying JWT tokens using various algorithms. The package is widely used in web applications for authentication and authorization purposes. However, a vulnerability has been discovered in the library that allows for algorithm confusion when verifying JWT tokens with certain public key formats.

Vulnerability Detail

The vulnerability in fast-jwt arises from the improper matching of common PEM formats for public keys in the 'publicKeyPemMatcher' function of the 'crypto.js' file. This can be exploited by crafting a malicious JWT token with the HS256 algorithm and signing it with the public RSA key of the target application. The attack is only successful if the target application uses a public key containing the 'BEGIN RSA PUBLIC KEY' header. This vulnerability enables attackers to sign arbitrary payloads that will be accepted by the verifier. The impact of this vulnerability is considered moderate with a CVSS score of 5.9.

How To Fix

Latest published version: 6.3.5 as of 22 Oct 2026

npm install fast-jwt@6.3.5

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

If you need the minimum change

3.3.2

This is the first release that contains the fix.

npm install fast-jwt@3.3.2

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

Workaround

There is no specific workaround provided for this vulnerability. Applying the recommended fix mentioned above is the best approach to address the issue.

Conclusion

The fast-jwt library is vulnerable to algorithm confusion when verifying JWT tokens with certain public key formats. This can lead to unauthorized access or other security breaches in applications that utilize the RS256 algorithm and a public key with the 'BEGIN RSA PUBLIC KEY' header. It is recommended to update the library to the latest version (3.3.2) or apply the provided fix to mitigate this vulnerability. For further support on vulnerability remediation, you can contact DevNack.com.

See every vulnerability recorded for fast-jwt →

Share this vulnerability

FAQ

fast-jwt is an npm package used for handling JSON Web Tokens (JWT) in Node.js applications. It provides functionality for signing and verifying JWT tokens using various algorithms.

The vulnerability allows attackers to sign arbitrary payloads with the HS256 algorithm using a target application's public RSA key. This can lead to unauthorized access or other security breaches depending on the application's implementation.

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

Yes, a fix is available for this vulnerability. It involves updating the 'publicKeyPemMatcher' function in the 'crypto.js' file of the fast-jwt library to properly match all common PEM formats for public keys.

The CVSS score of this vulnerability is 5.9, indicating a moderate level of severity.

Related vulnerabilities

Recent vulnerabilities recorded for fast-jwt.

How To Fix

Latest published version: 6.3.5 as of 22 Oct 2026

npm install fast-jwt@6.3.5

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

If you need the minimum change

3.3.2

This is the first release that contains the fix.

npm install fast-jwt@3.3.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