# CVE-2021-41106: File reference keys leads to incorrect hashes on HMAC algorithms

- Severity: Medium 4.4 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/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.21%, higher than 11% of CVEs (2026-12-01)
- Published: 2021-09-28T20:50:11.000Z
- Modified: 2026-07-08T06:27:26.757Z
- Also known as: GHSA-7322-jrq4-x5hf
- Weaknesses: CWE-345
- Assigned by: GitHub_M

## Description

JWT is a library to work with JSON Web Token and JSON Web Signature. Prior to versions 3.4.6, 4.0.4, and 4.1.5, users of HMAC-based algorithms (HS256, HS384, and HS512) combined with `Lcobucci\JWT\Signer\Key\LocalFileReference` as key are having their tokens issued/validated using the file path as hashing key - instead of the contents. The HMAC hashing functions take any string as input and, since users can issue and validate tokens, users are lead to believe that everything works properly. Versions 3.4.6, 4.0.4, and 4.1.5 have been patched to always load the file contents, deprecated the `Lcobucci\JWT\Signer\Key\LocalFileReference`, and suggest `Lcobucci\JWT\Signer\Key\InMemory` as the alternative. As a workaround, use `Lcobucci\JWT\Signer\Key\InMemory` instead of `Lcobucci\JWT\Signer\Key\LocalFileReference` to create the instances of one's keys.

(As written by CVE List.)

## Affected

- lcobucci jwt: >= 3.4.0, < 3.4.6; >= 4.0.0, < 4.0.4; >= 4.1.0, < 4.1.5; from 3.4.0 before 3.4.6; from 4.0.0 before 4.0.4; from 4.1.0 before 4.1.5
- lcobucci/jwt (Packagist): from 3.4.0 before 3.4.6; from 4.0.0 before 4.0.4; from 4.1.0 before 4.1.5

## Every score

- GitHub_M: CVSS:3.1 4.4 Medium `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N`
- GitHub: CVSS:3.1 4.4 Medium `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N`
- NVD: CVSS:3.1 3.3 Low `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N`
- NVD: CVSS:2.0 2.1 Low `AV:L/AC:L/Au:N/C:N/I:P/A:N`

## References

- <https://github.com/lcobucci/jwt/security/advisories/GHSA-7322-jrq4-x5hf> (patch, third-party-advisory, web)
- <https://github.com/lcobucci/jwt/commit/8175de5b841fbe3fd97d2d49b3fc15c4ecb39a73> (patch, third-party-advisory, web)
- <https://github.com/lcobucci/jwt/commit/c45bb8b961a8e742d8f6b88ef5ff1bd5cca5d01c> (patch, third-party-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2021-41106> (advisory)
- <https://github.com/FriendsOfPHP/security-advisories/blob/master/lcobucci/jwt/CVE-2021-41106.yaml> (web)
- <https://github.com/lcobucci/jwt> (package)

## Sources

- CVE List: [CVE-2021-41106](https://www.cve.org/CVERecord?id=CVE-2021-41106), CVE Terms of Use, modified 2024-08-04
- GitHub Advisory Database: [GHSA-7322-jrq4-x5hf](https://github.com/advisories/GHSA-7322-jrq4-x5hf), CC-BY-4.0, modified 2026-07-08
- NVD: [CVE-2021-41106](https://nvd.nist.gov/vuln/detail/CVE-2021-41106), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2021-41106 · Whole record: https://cve.day/CVE-2021-41106.json · Rebuilt by cve.day 2026-11-25T22:58:04.204Z
