{"id":"CVE-2022-23541","aliases":["CVE-2022-23541","GHSA-hjrf-2m68-5959"],"related":[],"kind":"vulnerability","state":"published","title":"jsonwebtoken's insecure implementation of key retrieval function could lead to Forgeable Public/Private Tokens from RSA to HMAC","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"# Overview\n\nVersions `<=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](https://github.com/auth0/node-jsonwebtoken#jwtverifytoken-secretorpublickey-options-callback)) will result in incorrect verification of tokens. There is a possibility of using a different algorithm and key combination in verification  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. \n\n# Am I affected?\n\nYou will be affected if your application is supporting usage of both symmetric key and asymmetric key in jwt.verify() implementation with the same key retrieval function. \n\n# How do I fix it?\n \nUpdate to version 9.0.0.\n\n# Will the fix impact my users?\n\nThere is no impact for end users","format":"markdown","source":"ghsa"},{"lang":"es","text":"jsonwebtoken es una implementación de JSON Web Tokens. Las versiones `&lt;= 8.5.1` de la librería `jsonwebtoken` pueden estar mal configuradas, de modo que pasar una función de recuperación de claves mal implementada que haga referencia al argumento `secretOrPublicKey` desde el enlace readme resultará en una verificación incorrecta de los tokens. Existe la posibilidad de utilizar un algoritmo y una combinación de claves diferentes en la verificación, distintos al que se utilizó para firmar los tokens. En concreto, los tokens firmados con una clave pública asimétrica podrían verificarse con un algoritmo simétrico HS256. Esto puede conducir a una validación exitosa de tokens falsificados. Si su aplicación admite el uso de claves simétricas y asimétricas en la implementación de jwt.verify() con la misma función de recuperación de claves. Este problema ha sido solucionado; actualice a la versión 9.0.0.","source":"nvd"}],"published":"2022-12-22T03:33:19.000Z","modified":"2026-06-17T04:30:19.393Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L","score":5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L","score":5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L","score":5,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L","score":6.3,"rating":"MEDIUM"}],"cwes":["CWE-287","CWE-1259"],"affected":[{"ranges":[{"version":"<= 8.5.1","status":"affected"}],"vendor":"auth0","product":"node-jsonwebtoken","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"9.0.0"}],"ecosystem":"npm","package":"jsonwebtoken","purl":"pkg:npm/jsonwebtoken","source":"ghsa"},{"ranges":[{"status":"affected","lastAffected":"8.5.1"}],"vendor":"auth0","product":"jsonwebtoken","cpe":"cpe:2.3:a:auth0:jsonwebtoken:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/auth0/node-jsonwebtoken/security/advisories/GHSA-hjrf-2m68-5959","tags":["third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/auth0/node-jsonwebtoken/commit/e1fa9dcc12054a8681db4e6373da1b30cf7016e3","tags":["patch","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/auth0/node-jsonwebtoken/releases/tag/v9.0.0","tags":["release-notes","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://security.netapp.com/advisory/ntap-20240621-0007/","tags":["x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-23541","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/auth0/node-jsonwebtoken","tags":["package"],"sources":["ghsa"]},{"url":"https://security.netapp.com/advisory/ntap-20240621-0007","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2024-07-03T17:50:35.348Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-23541","url":"https://www.cve.org/CVERecord?id=CVE-2022-23541","licence":"CVE Terms of Use","modified":"2025-02-13T16:32:22.327Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-hjrf-2m68-5959","url":"https://github.com/advisories/GHSA-hjrf-2m68-5959","licence":"CC-BY-4.0","modified":"2024-06-24T21:24:06.000Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-23541","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-23541","licence":"Public domain","modified":"2026-06-17T04:30:19.393Z"}],"updatedAt":"2026-11-25T22:58:17.753Z","epss":{"score":0.00826,"percentile":0.58567,"date":"2026-12-01T12:00:22.000Z"}}