{"id":"CVE-2021-41106","published":"2021-09-28T20:50:11Z","modified":"2024-08-04T02:59:31Z","title":"File reference keys leads to incorrect hashes on HMAC algorithms","vendor":"lcobucci","product":"jwt","tier":"tail","description":{"text":"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.","provenance":"source","from":"CVE.org"},"cvss":{"score":4.4,"severity":"MEDIUM","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00205,"percentile":0.05938,"provenance":"source"},"cwes":[{"id":"CWE-345","name":"Insufficient Verification of Data Authenticity"}],"references":[{"url":"https://github.com/lcobucci/jwt/security/advisories/GHSA-7322-jrq4-x5hf","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/lcobucci/jwt/commit/8175de5b841fbe3fd97d2d49b3fc15c4ecb39a73","tags":["x_refsource_MISC"]},{"url":"https://github.com/lcobucci/jwt/commit/c45bb8b961a8e742d8f6b88ef5ff1bd5cca5d01c","tags":["x_refsource_MISC"]}],"priority":{"score":4.3,"factors":[{"name":"EPSS percentile","points":1.19},{"name":"CVSS severity","points":3.08}]},"vendorSlug":"lcobucci","affectedVersions":[{"vendor":"lcobucci","product":"jwt","versions":[">= 3.4.0, < 3.4.6",">= 4.0.0, < 4.0.4",">= 4.1.0, < 4.1.5"]}],"affected":[{"ecosystem":"Packagist","package":"lcobucci/jwt","vulnerableRanges":[">=3.4.0, <3.4.6",">=4.0.0, <4.0.4",">=4.1.0, <4.1.5"],"patched":["3.4.6","4.0.4","4.1.5"],"from":["GHSA-7322-jrq4-x5hf"],"provenance":"source"}],"summary":{"text":"The lcobucci/jwt PHP library, in versions before 3.4.6, 4.0.4 and 4.1.5, signs and verifies HMAC tokens (HS256, HS384, HS512) using the file path of a LocalFileReference key as the secret instead of the file's contents. An attacker with local access who can read or influence the token process, with low privileges, can forge or validate tokens with the path string as the key, which compromises the integrity of tokens the application trusts.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:20:26Z"},"euvd":{"id":"EUVD-2021-2000","exploited":false,"provenance":"source"}}