Skip to content
The Patch Observer
Wednesday, October 21, 2026Your daily threat briefing297 reports
Vulnerabilities

Organisations at Risk: fast-jwt Patch Restores Critical Token Forgery Flaw in 6.2.x

A patch for the popular Node.js library inadvertently restored a critical flaw, allowing attackers to forge tokens using public keys as secrets.

Illustration: A generic laptop sits on a desk with its screen displaying a blank browser window.
AI-generated illustration: Patch Observer

Key points

  • CVE-2026-107722 is rated Critical with a CVSS score of 9.8.
  • Versions 6.2.0 through 6.2.4 are vulnerable; version 6.3.0 fixes the issue.
  • The flaw allows authentication bypass by misclassifying RSA keys as HMAC secrets.

Organizations using the fast-jwt library for Node.js applications face renewed risk as a recent security update failed to fully resolve a critical algorithm confusion vulnerability. The issue, tracked as CVE-2026-107722, allows attackers to forge JSON Web Tokens (JWTs) by tricking the library into treating a public RSA key as a shared secret for HMAC verification.

How it unfolded

  • Version 6.2.0 was released to address CVE-2026-34950, a critical algorithm confusion flaw.
  • The fix added a `trim()` function to remove whitespace from key inputs before detection.
  • Researchers found that non-whitespace characters, such as comments or control codes, bypassed this check.
  • The library’s regex matcher failed to identify the PEM header when not at position zero.
  • Execution fell through to the HMAC path, re-enabling the original attack vector.
  • Vendor nearform released version 6.3.0 to permanently fix the detection logic.

Who is affected

Any application using fast-jwt versions 6.2.0, 6.2.1, 6.2.2, 6.2.3, or 6.2.4 is exposed. The vulnerability is rated Critical with a CVSS score of 9.8. It specifically impacts systems where the RSA public key is loaded from sources that might include leading non-whitespace characters, such as database columns with encoding issues, YAML configuration files with inline comments, or copied text from formatted documents.

Our take on the response

The incomplete nature of the initial fix highlights the complexity of handling cryptographic key formats. While the vendor acted quickly to issue version 6.3.0, the window of exposure for users who updated to 6.2.x remains significant. The attack prerequisites are low: an attacker needs only knowledge of the public key, which is inherently public, and a target configuration that allows non-standard key formatting.

Background: Attack vectors

Attack vectors are the paths adversaries use to reach your data. They range from simple phishing emails to complex supply chain compromises. Defending against them requires mapping every entry point, validating inputs, and limiting what each component can do. You cannot stop all attacks, but you can make them costly and slow.

Read the full guide: Attack Vectors Explained: Mechanisms, Limits, and Defense Strategies

What to do and how to stay safe: fast-jwt

  • Audit your Node.js dependencies to identify any usage of fast-jwt versions 6.2.0 through 6.2.4.
  • Upgrade immediately to version 6.3.0 or later once the vendor provides the update.
  • Review configuration files and database entries for public keys to ensure they contain no leading comments or control characters.
  • Implement an asymmetric-only algorithm allowlist in your JWT validation logic to prevent HMAC fallback attacks.

Step-by-step guide: Vulnerability Prioritization: How to Rank Risks Without Wasting Time

General security guidance from the Patch Observer newsroom. It is not confirmed advice from the organisations named in this story.

Frequently asked questions

What is CVE-2026-107722?

It is a critical vulnerability in fast-jwt where non-whitespace prefixes on public keys cause the library to misclassify them as HMAC secrets, enabling token forgery.

Which versions of fast-jwt are vulnerable?

Versions 6.2.0, 6.2.1, 6.2.2, 6.2.3, and 6.2.4 are affected. Version 6.3.0 contains the fix.

How can an attacker exploit this?

By providing a public RSA key with a non-whitespace leading character, the attacker forces the library to use that key as an HMAC secret, allowing them to sign arbitrary tokens.

Sources

  1. CVE Program
  2. GitHub Advisory Database
fast-jwtCVE-2026-107722nearformJWTNode.js

Related stories