CVE-2023-48223 json
fast-jwt JWT Algorithm Confusion
published 2023-11-20 2 y ago modified 2026-06-17 4 mo ago also GHSA-c2ff-88x2-x9pg , EUVD-2023-2944
- cvss
- 5.9
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 0.7%
- EPSS 0.7% chance of exploitation in 30 days, percentile 52%
- public exploits
- 0
- none known
Summary
fast-jwt provides fast JSON Web Token (JWT) implementation. Prior to version 3.3.2, the fast-jwt library does not properly prevent JWT algorithm confusion for all public key types. The 'publicKeyPemMatcher' in 'fast-jwt/src/crypto.js' does not properly match all common PEM formats for public keys. 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 if the victim application utilizes a public key containing the `BEGIN RSA PUBLIC KEY` header. Applications using the RS256 algorithm, a public key with a `BEGIN RSA PUBLIC KEY` header, and calling the verify function without explicitly providing an algorithm, are vulnerable to this algorithm confusion attack which allows attackers to sign arbitrary payloads which will be accepted by the verifier. Version 3.3.2 contains a patch for this issue. As a workaround, change line 29 of `blob/master/src/crypto.js` to include a regular expression.
Patch / fix
- npm fast-jwt 3.3.2
- nearform fast-jwt 3.3.2
Exploit prediction
0.68% chance of exploitation in the next 30 days, higher than 52% of all scored CVEs (FIRST EPSS, 2026-11-08).
Exploits and checks
- github.com https://github.com/nearform/fast-jwt/security/advisories/GHSA-c2ff-88x2-x9pg referenced PoC, tagged "exploit" by a source, unverified
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 5.9 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N |
| NVD | 3.1 | 5.9 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N |
| GitHub | 3.1 | 5.9 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| npm | fast-jwt | <3.3.2 |
3.3.2 |
Affected products
- nearform fast-jwt
Classification
- Weakness
-
- CWE-20 Improper Input Validation
References
-
github.com
/nearform/fast-jwt/commit/15a6e92c9adb39acde41a9b11cec0cbde8ad763b
web
-
github.com
/nearform/fast-jwt/security/advisories/GHSA-c2ff-88x2-x9pg
web, exploit, vendor-advisory
-
github.com
/nearform/fast-jwt/blob/master/src/crypto.js#L29
web, product
-
github.com
/nearform/fast-jwt/releases/tag/v3.3.2
web, release-notes
-
nvd.nist.gov
/vuln/detail/CVE-2023-48223
advisory
-
github.com
/nearform/fast-jwt
package
Sources
- CVE List CVE-2023-48223
- GitHub Advisory GHSA-c2ff-88x2-x9pg
- NVD CVE-2023-48223
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.