{"answers":{"affected":"2 open source packages ship an affected version, including jsonwebtoken. It affects 1 product.","exploited":"There is no known exploitation of CVE-2022-23541 in the wild and no public exploit code.","fix":"Upgrade jsonwebtoken to 9.0.0 or later.","what":"CVE-2022-23541 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."},"fix_prompt":"Check this codebase for CVE-2022-23541 and fix it if it is affected.\n\nWhat it is: CVE-2022-23541 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.\nExploitation: There is no known exploitation of CVE-2022-23541 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- jsonwebtoken (npm): affected all versions; fixed in 9.0.0\n- jsonwebtoken (npm): affected all versions; fixed in 9.0.0\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2022-23541/ (Markdown: https://insights.sbomify.com/CVE-2022-23541/index.md)","id":"CVE-2022-23541","markdown":"https://insights.sbomify.com/CVE-2022-23541/index.md","name":"CVE-2022-23541","record":{"aliases":["GHSA-hjrf-2m68-5959","ROOT-APP-NPM-CVE-2022-23541"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["security_bypass","account_takeover"],"network_reachable":"yes","non_default_config":true,"product_category":"Node.js JWT library","requires_auth":"low_privilege","summary":"Attackers can forge tokens by exploiting insecure key retrieval logic, bypassing authentication in applications using jsonwebtoken.","user_interaction":"not_required","vuln_class":"auth_bypass"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"jsonwebtoken","vendor":"auth0"}],"cvss":{"score":5,"severity":"medium","source":"cna","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L","version":"3.1"},"cwes":[{"id":"CWE-287","name":"Improper Authentication"},{"id":"CWE-1259","name":"Improper Restriction of Security Token Assignment"}],"description":"jsonwebtoken is an implementation of JSON Web Tokens. Versions `\u003c= 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.","ecosystems":["npm"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"none_known"},"has_fix":true,"headline":"jsonwebtoken's insecure implementation of key retrieval function could lead to Forgeable Public/Private Tokens from RSA to HMAC","id":"CVE-2022-23541","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"npm","product":null,"products":[],"type":"auth_bypass","year":"2022"},"n_packages":2,"n_references":4,"next":{"headline":"OpenFGA Authorization Bypass","id":"CVE-2022-23542"},"packages":[{"ecosystem":"npm","fixed":["9.0.0"],"introduced":["0"],"last_affected":[],"package":"jsonwebtoken","purl":null,"source":"GHSA-hjrf-2m68-5959"},{"ecosystem":"npm","fixed":["9.0.0"],"introduced":["0"],"last_affected":[],"package":"jsonwebtoken","purl":"pkg:npm/jsonwebtoken","source":"GHSA-hjrf-2m68-5959"}],"prev":{"headline":"jsonwebtoken vulnerable to signature validation bypass due to insecure default algorithm in jwt.verify()","id":"CVE-2022-23540"},"products":["node-jsonwebtoken"],"published":"2022-12-22","related":[{"cvss_score":9.8,"headline":"Verification Bypass in jsonwebtoken","id":"CVE-2015-9235","kev_date_added":null,"published":"2018-05-29"},{"cvss_score":6.4,"headline":"jsonwebtoken vulnerable to signature validation bypass due to insecure default algorithm in jwt.verify()","id":"CVE-2022-23540","kev_date_added":null,"published":"2022-12-22"},{"cvss_score":5.9,"headline":"jsonwebtoken unrestricted key type could lead to legacy keys usage","id":"CVE-2022-23539","kev_date_added":null,"published":"2022-12-22"}],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":"no","exploitation":"none","technical_impact":"partial"},"state":"PUBLISHED","updated":"2025-02-13","vendors":["auth0"]},"summary":"Attackers can forge tokens by exploiting insecure key retrieval logic, bypassing authentication in applications using jsonwebtoken.","url":"https://insights.sbomify.com/CVE-2022-23541/"}