CVE-2026-107724

fast-jwt treats raw public JWK JSON as an HMAC secret, enabling HS256 token forgery

Published Oct 8, 2026 CVSS 3.1 · 7.4 High EPSS < 1% KEV · Not listed
Description
fast-jwt provides fast JSON Web Token (JWT) implementation. In 6.2.4, fast-jwt can classify raw serialized public JWK or JWKS JSON as an HMAC secret because src/crypto.js performDetectPublicKeyAlgorithms treats non-PEM strings as symmetric key material. If HS256 is explicitly allowed or inferred, an attacker who knows the exact serialized public-key bytes can use those bytes as an HMAC key and create a token containing arbitrary claims that createVerifier accepts. Serialization ordering or whitespace differences can prevent exploitation, and applications using supported PEM keys with an asymmetric-only algorithm allowlist are not affected. This issue is fixed in version 6.3.0.

Analysis

AI-generated

Technical impact

fast-jwt incorrectly treats raw serialized public JWK or JWKS JSON as an HMAC secret when the algorithm is not PEM‑encoded. When HS256 is accepted, an attacker who knows the exact serialized public key bytes can use those bytes as an HMAC key and create a signed JWT containing arbitrary claims. This flaw allows an attacker to forge tokens that the library accepts, leading to potential privilege escalation, impersonation, or unauthorized access within any system that trusts the token.

Affected Systems

The vulnerability affects the nearform fast-jwt library. Versions 6.2.4 and earlier are impacted; the issue was fixed in release 6.3.0.

Risk and Exploitability

The CVSS score of 7.4 reflects moderate severity. No EPSS score is available, and the issue is not listed in CISA KEV. The attack requires knowledge of the public key serialization, but many libraries do not sufficiently normalize ordering or whitespace, so the key bytes can be determined or observed. The likely attack vector is a remote request to an application that accepts HS256 tokens signed with the vulnerable library, allowing token forgery over HTTP or API endpoints.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade fast-jwt to version 6.3.0 or later
  • Disable HS256 or enforce an algorithm allowlist that permits only asymmetric algorithms such as RS256 or ES256
  • Verify that the validation logic checks the algorithm header and does not treat public key JSON as an HMAC secret

Generated by OpenCVE AI on October 8, 2026 at 23:44 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-g3jj-5cmm-3hxx fast-jwt treats raw public JWK JSON as an HMAC secret, enabling HS256 token forgery
History
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Nearform
Nearform fast-jwt
Vendors & Products Nearform
Nearform fast-jwt
Type Values Removed Values Added
Description fast-jwt provides fast JSON Web Token (JWT) implementation. In 6.2.4, fast-jwt can classify raw serialized public JWK or JWKS JSON as an HMAC secret because src/crypto.js performDetectPublicKeyAlgorithms treats non-PEM strings as symmetric key material. If HS256 is explicitly allowed or inferred, an attacker who knows the exact serialized public-key bytes can use those bytes as an HMAC key and create a token containing arbitrary claims that createVerifier accepts. Serialization ordering or whitespace differences can prevent exploitation, and applications using supported PEM keys with an asymmetric-only algorithm allowlist are not affected. This issue is fixed in version 6.3.0.
Title fast-jwt treats raw public JWK JSON as an HMAC secret, enabling HS256 token forgery
Weaknesses CWE-347
References
Metrics cvssV3_1

{'score': 7.4, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N'}

Weaknesses
  • CWE-347

    Improper Verification of Cryptographic Signature

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Oct 9, 2026, 3:51 PM
Reserved
Oct 8, 2026, 5:21 PM
Status
Deferred
Published
Oct 8, 2026, 10:17 PM
Modified
Oct 9, 2026, 4:17 PM