Junglewise Threat Intelligence

web-token PHP JWT Framework algorithm confusion in JWSVerifier

Severity: high · CVSS 8.1 · Published 2026-06-18

Technologies: Web-Token JWT Library, Web-Token JWT Framework. Vendors: Web-Token.

Executive brief

A vulnerability in the PHP JWT Framework allows attackers to bypass security checks by manipulating the headers of a digital signature. By placing a different algorithm name in an unprotected part of the token, an attacker can trick the system into using a weaker or different validation method than intended. This could allow an attacker to forge valid-looking tokens, potentially leading to unauthorized access to sensitive data or administrative functions.

Technical details

The vulnerability exists in JWSVerifier::getAlgorithm() and JWEDecrypter.php due to the way PHP's spread operator and array_merge() handle duplicate keys. When merging protected and unprotected headers, the unprotected header values take precedence if they appear last in the merge operation. This creates a Time-of-Check/Time-of-Use (TOCTOU) flaw where the HeaderCheckerManager validates the 'alg' parameter from the protected header, but the Verifier/Decrypter uses the 'alg' (or 'enc') parameter from the unprotected header for the actual cryptographic operation. Attackers can exploit this to force algorithm downgrades or confusion, especially in environments using mixed key sets. Patches are available in versions 3.4.10, 4.0.7, and 4.1.7.

Affected products

  • web-token jwt-framework <= 4.2.99
  • web-token jwt-library < 3.4.10, >= 4.0.0 < 4.0.7, >= 4.1.0 < 4.1.7

Timeline

  • 2026-06-06: disclosed
  • 2026-06-18: advisory

References

Related threats