CVE-2023-48238 JWT Algorithm Confusion in json-web-token library
Attackers can bypass JWT signature verification by exploiting algorithm confusion, allowing unauthorized access to applications using this library.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2023-48238?
CVE-2023-48238 is a high-severity vulnerability in joaquimserafim json-web-token, published on 17 Nov 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
joaquimserafim/json-web-token is a javascript library use to interact with JSON Web Tokens (JWT) which are a compact URL-safe means of representing claims to be transferred between two parties. Versions prior to 4.0.0 are vulnerable to a JWT algorithm confusion attack. On line 86 of the 'index.js' file, the algorithm to use for verifying the signature of the JWT token is taken from the JWT token, which at that point is still unverified and thus shouldn't be trusted. To exploit this vulnerability, an attacker needs to craft a malicious JWT token containing the HS256 algorithm, signed with the public RSA key of the victim application. This attack will only work against this library is the RS256 algorithm is in use, however it is a best practice to use that algorithm. Version 4.0.0 fixes the issue.
Weakness: CWE-345
Which versions are affected by CVE-2023-48238?
2 open source packages ship an affected version, including json-web-token. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
json-web-token npm | All versions | 4.0.0 |
json-web-token npm | All versions | 4.0.0 |
Products include Joaquimserafim Json Web Token.
How do I fix CVE-2023-48238?
Upgrade json-web-token to 4.0.0 or later.
Is CVE-2023-48238 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-48238 exists.
Sources
Also known as GHSA-4xw9-cx39-r355.