CVE-2022-23540 jsonwebtoken vulnerable to signature validation bypass due to insecure default algorithm in jwt.verify()

Medium 6.4 Published Updated

Attackers can bypass JWT signature validation by exploiting the default 'none' algorithm, allowing unauthorized access if algorithms are not explicitly specified.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-23540?

CVE-2022-23540 is a medium-severity authentication bypass vulnerability in auth0 node-jsonwebtoken, published on 22 Dec 2022. Any signed-in user can exploit it over the network, with no action from the victim.

Official description

In versions `<=8.5.1` of `jsonwebtoken` library, lack of algorithm definition in the `jwt.verify()` function can lead to signature validation bypass due to defaulting to the `none` algorithm for signature verification. Users are affected if you do not specify algorithms in the `jwt.verify()` function. This issue has been fixed, please update to version 9.0.0 which removes the default support for the none algorithm in the `jwt.verify()` method. There will be no impact, if you update to version 9.0.0 and you don’t need to allow for the `none` algorithm. If you need 'none' algorithm, you have to explicitly specify that in `jwt.verify()` options.

Weakness: CWE-347, CWE-287

Which versions are affected by CVE-2022-23540?

2 open source packages ship an affected version, including jsonwebtoken. It affects 1 product.

PackageAffectedFixed in
jsonwebtoken npmAll versions9.0.0
jsonwebtoken npmAll versions9.0.0

Products include Auth0 Jsonwebtoken.

How do I fix CVE-2022-23540?

Upgrade jsonwebtoken to 9.0.0 or later.

Upgrade, and rotate credentials and sessions that may have been exposed. More about Authentication bypass.

Is CVE-2022-23540 being exploited?

There is no known exploitation of CVE-2022-23540 in the wild and no public exploit code.

Sources

Also known as CLSA-2026-1784683085, CLSA-2026-1784769530, GHSA-qwph-4952-7xr6, ROOT-APP-NPM-CVE-2022-23540.

Is CVE-2022-23540 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free