PT-2022-16062 · Unknown · Jsonwebtoken

Julienwoll

·

Published

2022-12-22

·

Updated

2026-06-04

·

CVE-2022-23541

CVSS v3.1

5.0

Medium

VectorAV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L
Name of the Vulnerable Software and Affected Versions jsonwebtoken versions <= 8.5.1
Description The jsonwebtoken library can be misconfigured, leading to incorrect verification of tokens. This occurs when a poorly implemented key retrieval function is used, referring to the secretOrPublicKey argument. As a result, tokens signed with an asymmetric public key could be verified with a symmetric HS256 algorithm, allowing for successful validation of forged tokens. This issue affects applications that support both symmetric and asymmetric keys in the jwt.verify() implementation with the same key retrieval function.
Recommendations Update to version 9.0.0 to resolve the issue. If you are currently using a version of jsonwebtoken that is <= 8.5.1, updating to version 9.0.0 will fix the problem. As a temporary workaround, consider reviewing and correcting your key retrieval function to ensure it properly handles both symmetric and asymmetric keys. Restrict access to the jwt.verify() function to minimize the risk of exploitation until the update is applied.

Exploit

Fix

Improper Authentication

Found an issue in the description? Have something to add? Feel free to write us 👾

Weakness Enumeration

Related Identifiers

CVE-2022-23541
GHSA-HJRF-2M68-5959

Affected Products

Jsonwebtoken