Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. fast-jwt
  4. ›
  5. CVE-2026-107722

CVE-2026-107722: fast-jwt: Incomplete patch of CVE-2026-34950: Non-whitespace key-prefix re-enables RSA→HS256 algorithm confusion

October 8, 2026

The fix for CVE-2026-34950 (CVSS 9.1, released in v6.2.0) is incomplete. It adds key.trim() to the PEM-detection path in src/crypto.js, but String.prototype.trim() only strips characters classified as whitespace by the ECMAScript specification. The subsequent ^-anchored regex (/^-----BEGIN(?: (RSA))? PUBLIC KEY-----/) still requires the PEM header at position 0 — so any non-whitespace leading byte (control chars, zero-width unicode, # comments, HTTP-style headers, PGP wrappers) bypasses detection and falls through to the HMAC verification path, using the RSA public key as the HMAC shared secret. Net result: the exact same RSA→HS256 algorithm-confusion attack the original CVE addressed is fully re-enabled with a slightly different leading byte.

Attack prerequisites are identical to CVE-2026-34950: attacker knows the target’s public RSA key (which is public by definition), and the target loads that key from a source whose content may have a non-whitespace prefix (DB column with corrupted encoding, YAML config with inline comment, copy-paste from formatted document, etc.).

Verified on fast-jwt@6.2.2 (latest as of 2026-04-23) with a 10-line PoC.

References

  • github.com/advisories/GHSA-ww5h-9m49-7xx4
  • github.com/nearform/fast-jwt/commit/d96bbc6c5336055a6dbfa318fdbab01197264cfa
  • github.com/nearform/fast-jwt/pull/632
  • github.com/nearform/fast-jwt/releases/tag/v6.3.0
  • github.com/nearform/fast-jwt/security/advisories/GHSA-ww5h-9m49-7xx4
  • nvd.nist.gov/vuln/detail/CVE-2026-107722

Code Behaviors & Features

Detect and mitigate CVE-2026-107722 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions starting from 6.2.0 before 6.3.0

Fixed versions

  • 6.3.0

Solution

Upgrade to version 6.3.0 or above.

Impact 9.8 CRITICAL

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Learn more about CVSS

Weakness

  • CWE-347: Improper Verification of Cryptographic Signature

Source file

npm/fast-jwt/CVE-2026-107722.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sun, 08 Nov 2026 00:15:57 +0000.