Intel

AIKIDO-2026-933024

fast-jwt is vulnerable to Authentication Bypass

Authentication BypassGHSA-ww5h-9m49-7xx4 Published 4 days ago

98

Critical Risk

This Affects:

JSfast-jwt
6.2.0 - 6.2.4
Fixed in 6.3.0
Are you affected? Scan for Free

TL;DR

fast-jwt detects PEM-encoded asymmetric keys by trimming the key and matching a -----BEGIN PUBLIC KEY----- header anchored at the start of the string. Because trimming only removes whitespace, a key carrying any non-whitespace leading bytes (control characters, zero-width unicode, comment or wrapper text) fails the anchored match and falls through to the HMAC verification path, where the public RSA key is used as the HMAC shared secret. As the verification key is public, an attacker can forge an HS256 token keyed with it and have the signature accepted, bypassing verification. The fix locates the PEM header wherever it appears and refuses to use any key containing PEM markers as an HMAC secret.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and your application verifies tokens without an algorithms allowlist while loading its verification key from a source that may prepend non-whitespace bytes.

Background info

fast-jwt is vulnerable to Authentication Bypass in versions 6.2.0 - 6.2.4.

How to fix this

Upgrade the fast-jwt library to the patch version.