logo

CVE-2021-41106 lcobucci/jwt

Package

Manager: composer
Name: lcobucci/jwt
Vulnerable Version: >=3.4.0 <3.4.6 || >=4.0.0 <4.0.4 || >=4.1.0 <4.1.5

Severity

Level: Medium

CVSS v3.1: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N

CVSS v4.0: CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N

EPSS: 0.00034 pctl0.08421

Details

File reference keys leads to incorrect hashes on HMAC algorithms ### Impact 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, people are lead to believe that everything works properly. ### Patches All versions 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. ### Workarounds Use `Lcobucci\JWT\Signer\Key\InMemory` instead of `Lcobucci\JWT\Signer\Key\LocalFileReference` to create the instances of your keys: ```diff -use Lcobucci\JWT\Signer\Key\LocalFileReference; +use Lcobucci\JWT\Signer\Key\InMemory; -$key = LocalFileReference::file(__DIR__ . '/public-key.pem'); +$key = InMemory::file(__DIR__ . '/public-key.pem'); ```

Metadata

Created: 2021-09-29T17:09:40Z
Modified: 2021-09-29T18:04:31Z
Source: https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2021/09/GHSA-7322-jrq4-x5hf/GHSA-7322-jrq4-x5hf.json
CWE IDs: ["CWE-345"]
Alternative ID: GHSA-7322-jrq4-x5hf
Finding: F204
Auto approve: 1