# CVE-2022-23541: jsonwebtoken's insecure implementation of key retrieval function could lead to Forgeable Public/Private Tokens from RSA to HMAC

- Severity: Medium 5.0 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.83%, higher than 58% of CVEs (2026-12-01)
- Published: 2022-12-22T03:33:19.000Z
- Modified: 2026-06-17T04:30:19.393Z
- Also known as: GHSA-hjrf-2m68-5959
- Weaknesses: CWE-287, CWE-1259
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: GitHub_M

## Description

jsonwebtoken is an implementation of JSON Web Tokens. Versions `<= 8.5.1` of `jsonwebtoken` library can be misconfigured so that passing a poorly implemented key retrieval function referring to the `secretOrPublicKey` argument from the readme link will result in incorrect verification of tokens. There is a possibility of using a different algorithm and key combination in verification, other than the one that was used to sign the tokens. Specifically, tokens signed with an asymmetric public key could be verified with a symmetric HS256 algorithm. This can lead to successful validation of  forged tokens. If your application is supporting usage of both symmetric key and asymmetric key in jwt.verify() implementation with the same key retrieval function. This issue has been patched, please update to version 9.0.0.

(As written by CVE List.)

## Affected

- auth0 node-jsonwebtoken: <= 8.5.1
- jsonwebtoken (npm): before 9.0.0
- auth0 jsonwebtoken: up to 8.5.1

## Every score

- GitHub_M: CVSS:3.1 5.0 Medium `CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L`
- GitHub: CVSS:3.1 5.0 Medium `CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L`
- NVD: CVSS:3.1 6.3 Medium `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L`

## References

- <https://github.com/auth0/node-jsonwebtoken/security/advisories/GHSA-hjrf-2m68-5959> (third-party-advisory, web)
- <https://github.com/auth0/node-jsonwebtoken/commit/e1fa9dcc12054a8681db4e6373da1b30cf7016e3> (patch, web)
- <https://github.com/auth0/node-jsonwebtoken/releases/tag/v9.0.0> (release-notes, web)
- <https://security.netapp.com/advisory/ntap-20240621-0007/>
- <https://nvd.nist.gov/vuln/detail/CVE-2022-23541> (advisory)
- <https://github.com/auth0/node-jsonwebtoken> (package)
- <https://security.netapp.com/advisory/ntap-20240621-0007> (web)

## Sources

- CVE List: [CVE-2022-23541](https://www.cve.org/CVERecord?id=CVE-2022-23541), CVE Terms of Use, modified 2025-02-13
- GitHub Advisory Database: [GHSA-hjrf-2m68-5959](https://github.com/advisories/GHSA-hjrf-2m68-5959), CC-BY-4.0, modified 2024-06-24
- NVD: [CVE-2022-23541](https://nvd.nist.gov/vuln/detail/CVE-2022-23541), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2022-23541 · Whole record: https://cve.day/CVE-2022-23541.json · Rebuilt by cve.day 2026-11-25T22:58:17.753Z
