CVE-2023-48238: JWT Algorithm Confusion in json-web-token library
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.
Security readout for executives and security teams
Plain-English summary
CVE-2023-48238 affects the joaquimserafim/json-web-token JavaScript library before 4.0.0. A flaw in JWT signature verification can let an attacker forge trusted tokens in certain RS256 deployments. For businesses, the main concern is unauthorized access or privilege misuse in applications relying on this library for authentication or authorization.
Executive priority
Treat as a high-priority application dependency issue where this library protects user identity, sessions, or API access. Patch during the next urgent remediation window, sooner for internet-facing or sensitive systems using RS256 JWTs.
Technical view
The library selected the verification algorithm from an untrusted JWT header before verification. In RS256 use cases, this enables JWT algorithm confusion: a token declaring HS256 may be accepted if signed using the application’s public RSA key as an HMAC secret. Version 4.0.0 fixes the issue. CVSS is 7.5, with high integrity impact.
Likely exposure
Exposure is limited to applications using joaquimserafim/json-web-token versions earlier than 4.0.0, especially where RS256 is used for JWT verification. Systems not using this package, or already on 4.0.0 or later, are not indicated as affected by the provided sources.
Exploitation context
The advisory describes a network-reachable, unauthenticated attack requiring a crafted JWT and knowledge of the victim application’s public RSA key. CISA KEV status is false in the provided data, and no cited source states active exploitation.
Researcher notes
The issue maps to CWE-345 and centers on trusting the unverified token header to choose the verification algorithm. Evidence supports affected versions below 4.0.0 and a fixed release at 4.0.0. No public exploit status is established by the provided sources.
Mitigation direction
Upgrade joaquimserafim/json-web-token to version 4.0.0 or later.
Review vendor advisory and commit for implementation details.
Prioritize applications using JWTs for authentication or authorization.
Check transitive dependencies and lockfiles for affected versions.
Validation and detection
Inventory applications using the json-web-token package.
Confirm installed package versions are 4.0.0 or later.
Identify services verifying JWTs with RS256.
Review dependency manifests and lockfiles for older versions.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · low confidence lookup
CWE-345: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
The CVE wording references authentication or credential exposure, so valid-account and credential-access review may help. This is a Glexia inferred lookup path, not an official MITRE, ATT&CK, or CVE Program mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-345 · source CWE mapping
Insufficient Verification of Data Authenticity
Insufficient Verification of Data Authenticity represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.