Advisory Database
  • Advisories
  • Dependency Scanning
  1. composer
  2. ›
  3. web-token/jwt-framework
  4. ›
  5. GHSA-jc38-x7x8-2xc8

GHSA-jc38-x7x8-2xc8: PHP JWT Framework: JWSVerifier uses algorithm from unprotected header, enabling algorithm confusion attacks

June 18, 2026 (updated July 6, 2026)

JWSVerifier::getAlgorithm() in src/Library/Signature/JWSVerifier.php (line 144) merges protected and unprotected headers using PHP’s spread operator:

$completeHeader = [...$signature->getProtectedHeader(), ...$signature->getHeader()];

In PHP, when spreading arrays with duplicate string keys, the last array’s values take precedence. Since the unprotected header (getHeader()) is spread second, an attacker can override the integrity-protected alg parameter by placing a different value in the unprotected header.

This creates a Time-of-Check/Time-of-Use (TOCTOU) vulnerability:

  1. HeaderCheckerManager validates alg from the protected header
  2. JWSVerifier uses alg from the unprotected header for actual verification

The same issue exists in JWEDecrypter.php (lines 120-124) where array_merge() exhibits the same last-wins behavior for alg and enc.

References

  • github.com/FriendsOfPHP/security-advisories/blob/master/web-token/jwt-library/GHSA-jc38-x7x8-2xc8.yaml
  • github.com/advisories/GHSA-jc38-x7x8-2xc8
  • github.com/web-token/jwt-framework/security/advisories/GHSA-jc38-x7x8-2xc8

Code Behaviors & Features

Detect and mitigate GHSA-jc38-x7x8-2xc8 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions before 3.4.10, all versions starting from 4.0.0 before 4.0.7, all versions starting from 4.1.0 before 4.1.7

Fixed versions

  • 3.4.10
  • 4.0.7
  • 4.1.7

Solution

Upgrade to versions 3.4.10, 4.0.7, 4.1.7 or above.

Impact 7.4 HIGH

CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N

Learn more about CVSS

Weakness

  • CWE-345: Insufficient Verification of Data Authenticity

Source file

packagist/web-token/jwt-framework/GHSA-jc38-x7x8-2xc8.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sun, 08 Nov 2026 00:16:10 +0000.