# Auth0 jsonwebtoken insecure input validation in jwt.verify

Source: https://junglewise.ai/threats/auth0-jsonwebtoken-insecure-input-validation-in-jwt-verify-d6e47a79  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2022-12-22. Updated: 2026-05-13  
License: CC BY 4.0 with a link back

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

The jsonwebtoken library, a popular tool for handling secure digital tokens in Node.js applications, contains a flaw in how it validates security keys. If an application is configured to allow untrusted users to influence the key used for verification, an attacker could potentially execute malicious code or write unauthorized files on the server. This could lead to a full system compromise, though it requires the application to be using the library in a specific, non-standard way.

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

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** 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 This vulnerability?** 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 This vulnerability attacked?** It is attacked over the network, in a software library.

**Am I affected?** 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

A vulnerability in the `jwt.verify()` function of the `jsonwebtoken` library (versions <= 8.5.1) stems from insufficient validation of the `secretOrPublicKey` argument. If an attacker can control this parameter, they may be able to trigger remote code execution (RCE) or arbitrary file writes on the host machine. This is classified as an insecure input validation issue (CWE-20). While originally assigned CVE-2022-23529, the CVE was later retracted because exploitation requires the calling application to pass untrusted input directly into the key retrieval parameter, which is considered an insecure implementation pattern rather than a flaw in the library's default behavior. The issue is mitigated in version 9.0.0 by introducing stricter asymmetric key type validations.

## Affected products

- Auth0 jsonwebtoken <= 8.5.1

## Timeline

- 2022-12-21: patched: Version 9.0.0 released
- 2022-12-22: disclosed
- 2023-01-27: other: CVE-2022-23529 was retracted after further review

## References

- [https://github.com/auth0/node-jsonwebtoken/security/advisories/GHSA-27h2-hvpr-p74q](https://github.com/auth0/node-jsonwebtoken/security/advisories/GHSA-27h2-hvpr-p74q)
- [https://github.com/auth0/node-jsonwebtoken/commit/e1fa9dcc12054a8681db4e6373da1b30cf7016e3](https://github.com/auth0/node-jsonwebtoken/commit/e1fa9dcc12054a8681db4e6373da1b30cf7016e3)
- [https://github.com/auth0/node-jsonwebtoken](https://github.com/auth0/node-jsonwebtoken)

## 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)
- [jsonwebtoken unrestricted key type in signature verification](https://junglewise.ai/threats/cve-2022-23539-jsonwebtoken-unrestricted-key-type-in-signature-verification)
- [Auth0 jsonwebtoken verification bypass](https://junglewise.ai/threats/cve-2015-9235-auth0-jsonwebtoken-verification-bypass)
