# web-token PHP JWT Framework algorithm confusion in JWSVerifier

Source: https://junglewise.ai/threats/web-token-php-jwt-framework-algorithm-confusion-in-jwsverifier-6c60a50e  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-06-18. Updated: 2026-06-18  
License: CC BY 4.0 with a link back

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

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.

Technologies: [Web-Token JWT Framework](https://junglewise.ai/threats/technologies/jwt-framework), [Web-Token JWT Library](https://junglewise.ai/threats/technologies/jwt-library). Vendors: [Web-Token](https://junglewise.ai/threats/vendors/web-token).

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** High severity, with a CVSS score of 8.1, published 18 June 2026.

**Which products and versions are affected?** 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.

**Is there a fix for This vulnerability?** No fixed version is recorded yet. Check the vendor's advisory in the references below. If you run it, Junglewise drafts a mitigation that fits your setup and applies it once you approve, with senior security engineers behind it.

**How is This vulnerability attacked?** It is attacked over the network, in a software library.

**Am I affected?** Check whether you run Web-Token JWT Framework or Web-Token JWT Library at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## 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

- [https://api.github.com/users/Papadope](https://api.github.com/users/Papadope)
- [https://github.com/Papadope](https://github.com/Papadope)
- [https://api.github.com/users/Papadope/gists%7B/gist_id%7D](https://api.github.com/users/Papadope/gists%7B/gist_id%7D)
- [https://api.github.com/users/Papadope/repos](https://api.github.com/users/Papadope/repos)
- [https://avatars.githubusercontent.com/u/115578162?v=4](https://avatars.githubusercontent.com/u/115578162?v=4)
- [https://api.github.com/users/Papadope/events%7B/privacy%7D](https://api.github.com/users/Papadope/events%7B/privacy%7D)

## Related threats

- [web-token PHP JWT Library padding oracle in RSA1_5 decryption](https://junglewise.ai/threats/web-token-php-jwt-library-padding-oracle-in-rsa1-5-decryption-d6582319)
- [web-token jwt-library denial of service via unbounded PBKDF2 iterations](https://junglewise.ai/threats/web-token-jwt-library-denial-of-service-via-unbounded-pbkdf2-iterations-26ced229)
- [PHP JWT Framework missing integrity check in Chacha20Poly1305](https://junglewise.ai/threats/php-jwt-framework-missing-integrity-check-in-chacha20poly1305-7ee741c5)
