# CVE-2022-23539: jsonwebtoken unrestricted key type in signature verification

Source: https://junglewise.ai/threats/cve-2022-23539-jsonwebtoken-unrestricted-key-type-in-signature-verification  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2022-12-22. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2022-23539 · Severity: low · CVSS 3.1 · Published 2022-12-22

jsonwebtoken is a widely-used Node.js library for creating and verifying JSON Web Tokens (JWTs), which are used for authentication and authorization. Versions before 9.0.0 did not properly validate that the key type matches the signing algorithm, allowing applications to accidentally use weaker legacy key types (like DSA) with modern algorithms (like RS256), potentially bypassing security controls or accepting forged tokens.

Technologies: [jsonwebtoken (npm)](https://junglewise.ai/threats/technologies/jsonwebtoken). Vendors: [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is CVE-2022-23539 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2022-23539 being exploited in the wild.

**How severe is CVE-2022-23539?** Low severity, with a CVSS score of 3.1, published 22 December 2022.

**Which products and versions are affected?** jsonwebtoken (npm) SEMVER:introduced=0,fixed=9.0.0.

**Is there a fix for CVE-2022-23539?** Yes. jsonwebtoken (npm): upgrade to 9.0.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2022-23539 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2022-23539?** Check whether you run jsonwebtoken (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- jsonwebtoken (npm): upgrade to 9.0.0 or later

  ```sh
  npm install jsonwebtoken@9.0.0
  ```


## Technical details

The jsonwebtoken library prior to version 9.0.0 fails to validate that the asymmetric key type is compatible with the specified signing algorithm during JWT verification. This allows misconfigured applications to use legacy, cryptographically weak key types (such as DSA) in combination with modern algorithms (e.g., RS256 for RSA), violating cryptographic best practices. An attacker with knowledge of a weak key or the ability to influence key selection could potentially forge or manipulate JWTs, compromising authentication systems that rely on this library. The issue requires prior misconfiguration by the application developer, not a network-based exploit. Version 9.0.0 adds strict validation of key type and algorithm combinations; applications requiring backwards compatibility with invalid combinations can set allowInvalidAsymmetricKeyTypes to true.

## Affected products

- Auth0 jsonwebtoken <=8.5.1

## Identifiers

- CVE-2022-23539
- GHSA-8cf7-32gw-wr33

## Timeline

- 2022-12-22: disclosed
- 2022-12-22: patched: Version 9.0.0 released with key type and algorithm validation

## References

- [https://github.com/auth0/node-jsonwebtoken/security/advisories/GHSA-8cf7-32gw-wr33](https://github.com/auth0/node-jsonwebtoken/security/advisories/GHSA-8cf7-32gw-wr33)

## Related threats

- [jsonwebtoken insecure key retrieval leading to token forgery](https://junglewise.ai/threats/cve-2022-23541-jsonwebtoken-insecure-key-retrieval-leading-to-token-forgery)
- [Auth0 jsonwebtoken signature validation bypass via default algorithm](https://junglewise.ai/threats/cve-2022-23540-auth0-jsonwebtoken-signature-validation-bypass-via-default)
- [Auth0 jsonwebtoken insecure input validation in jwt.verify](https://junglewise.ai/threats/auth0-jsonwebtoken-insecure-input-validation-in-jwt-verify-d6e47a79)
- [Auth0 jsonwebtoken verification bypass](https://junglewise.ai/threats/cve-2015-9235-auth0-jsonwebtoken-verification-bypass)
