# CVE-2023-48223: fast-jwt JWT Algorithm Confusion

- Severity: Medium 5.9 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.84%, higher than 58% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2023-11-20T17:39:56.816Z
- Modified: 2026-06-17T06:33:46.483Z
- Also known as: GHSA-c2ff-88x2-x9pg
- Weaknesses: CWE-20
- Assigned by: GitHub_M

## Description

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.

(As written by CVE List.)

## Affected

- nearform fast-jwt: < 3.3.2; before 3.3.2
- fast-jwt (npm): before 3.3.2

## Every score

- GitHub_M: CVSS:3.1 5.9 Medium `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N`
- GitHub: CVSS:3.1 5.9 Medium `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N`
- NVD: CVSS:3.1 5.9 Medium `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N`

## References

- <https://github.com/nearform/fast-jwt/security/advisories/GHSA-c2ff-88x2-x9pg> (exploit, vendor-advisory, web)
- <https://github.com/nearform/fast-jwt/blob/master/src/crypto.js#L29> (product, web)
- <https://github.com/nearform/fast-jwt/releases/tag/v3.3.2> (release-notes, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2023-48223> (advisory)
- <https://github.com/nearform/fast-jwt/commit/15a6e92c9adb39acde41a9b11cec0cbde8ad763b> (web)
- <https://github.com/nearform/fast-jwt> (package)

## Sources

- CVE List: [CVE-2023-48223](https://www.cve.org/CVERecord?id=CVE-2023-48223), CVE Terms of Use, modified 2024-08-02
- GitHub Advisory Database: [GHSA-c2ff-88x2-x9pg](https://github.com/advisories/GHSA-c2ff-88x2-x9pg), CC-BY-4.0, modified 2023-11-20
- NVD: [CVE-2023-48223](https://nvd.nist.gov/vuln/detail/CVE-2023-48223), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2023-48223 · Whole record: https://cve.day/CVE-2023-48223.json · Rebuilt by cve.day 2026-11-25T22:58:30.606Z
