Description
Since "algorithm" isn't enforced in jwt.decode()in jwt-simple 0.3.0 and earlier, a malicious user could choose what algorithm is sent sent to the server. If the server is expecting RSA but is sent HMAC-SHA with RSA's public key, the server will think the public key is actually an HMAC private key. This could be used to forge any data an attacker wants.
Remediation
References
https://auth0.com/blog/2015/03/31/critical-vulnerabilities-in-json-web-token-libraries/
https://github.com/hokaccha/node-jwt-simple/pull/14
https://github.com/hokaccha/node-jwt-simple/pull/16
https://nodesecurity.io/advisories/87
Related Vulnerabilities
CVE-2012-0391 Vulnerability in maven package com.opensymphony:xwork-core
CVE-2020-8129 Vulnerability in npm package script-manager
CVE-2021-34801 Vulnerability in npm package valine
CVE-2018-18853 Vulnerability in maven package io.spray:spray-json_2.10
CVE-2022-36007 Vulnerability in maven package com.github.jlangch:venice