CVE-2026-134461: PHP JWT Library: PBES2-HS*+A*KW unwrap accepts an unbounded p2c iteration count, enabling CPU-amplification denial of service

Published Jun 18, 2026
·
Updated

Impact

When a JWE uses a password-based key-encryption algorithm (PBES2-HS256+A128KW, PBES2-HS384+A192KW, PBES2-HS512+A256KW), PBES2AESKW::unwrapKey() reads the p2c (PBKDF2 iteration count) parameter directly from the attacker-controlled JOSE header and passes it to hashpbkdf2() with no upper bound. The only validation performed (checkHeaderAdditionalParameters()) was isint($p2c) && $p2c > 0.

An unauthenticated attacker can craft a single JWE whose protected header sets a very large p2c (e.g. 100000000 ≈ 87 s of CPU, or PHPINTMAX), forcing a worker to spend an arbitrary amount of CPU inside PBKDF2 before the key unwrap can even fail. The decrypter swallows the eventual exception, so the attacker pays almost nothing while the server burns CPU. JSON General serialization (multiple recipients) and multi-key JWKSets multiply the cost. This is a classic uncontrolled-resource-consumption (CWE-400) denial of service.

Affected configurations

Applications that register any PBES2-HS+AKW algorithm in their decryption AlgorithmManager.

Patches

PBES2AESKW now enforces a configurable maximum iteration count (DEFAULTMAXCOUNT = 1000000, well above realistic legitimate values which are a few thousand) in checkHeaderAdditionalParameters(), before any PBKDF2 computation. The bound is exposed as a constructor argument so operators can tune it.

Workarounds

Before upgrading: validate/limit the p2c header with a custom header checker, or do not enable PBES2 algorithms for untrusted tokens.

References

- RFC 7518 §4.8 (PBES2) - CWE-400: Uncontrolled Resource Consumption

Résolution

Un correctif a été préparé sur une branche dédiée basée sur 3.4.x, avec des tests anti-régression dédiés (fork privé temporaire de cette advisory, PR #1).

PBES2 — PBES2AESKW::unwrapKey() borne désormais le paramètre p2c (constante DEFAULTMAXCOUNT = 1000000, configurable via le constructeur) avant tout appel à hashpbkdf2(), empêchant l'amplification CPU (DoS).

Validation : php -l OK, PHPUnit vert, aucune nouvelle erreur PHPStan introduite (différentiel nul vs 3.4.x), aucun commentaire ajouté dans le code source. Après merge, cascade prévue 3.4.x → 4.0.x → 4.1.x.

Other sources

Web-Token jwt-framework and jwt-library before 3.4.10, 4.0.0 before 4.0.7, and 4.1.0 before 4.1.7 contain an uncontrolled resource consumption vulnerability in PBES2AESKW::unwrapKey(), which passes the attacker-controlled p2c JWE header value to hashpbkdf2() without an upper bound. Unauthenticated attackers can send a JWE using a PBES2-HS+AKW algorithm with a huge p2c iteration count to force lengthy PBKDF2 computations and exhaust server CPU.

— MITRE

Affected Software

8 affected componentsFixes available
composer/web-token/jwt-framework<3.4.10, >=4.0.0<4.0.7, >=4.1.0<4.1.7
composer/web-token/jwt-library<3.4.10, >=4.0.0<4.0.7, >=4.1.0<4.1.7
composer/web-token/jwt-library<3.4.10
3.4.10
composer/web-token/jwt-framework<3.4.10
3.4.10
composer/web-token/jwt-library>=4.0.0<4.0.7
4.0.7
composer/web-token/jwt-library>=4.1.0<4.1.7
4.1.7
composer/web-token/jwt-framework>=4.0.0<4.0.7
4.0.7
composer/web-token/jwt-framework>=4.1.0<4.1.7
4.1.7

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade composer/web-token/jwt-library to a version that resolves this vulnerability.

    Fixed in 3.4.10
  2. Upgrade

    Upgrade composer/web-token/jwt-framework to a version that resolves this vulnerability.

    Fixed in 3.4.10
  3. Upgrade

    Upgrade composer/web-token/jwt-library to a version that resolves this vulnerability.

    Fixed in 4.0.7
  4. Upgrade

    Upgrade composer/web-token/jwt-library to a version that resolves this vulnerability.

    Fixed in 4.1.7
  5. Upgrade

    Upgrade composer/web-token/jwt-framework to a version that resolves this vulnerability.

    Fixed in 4.0.7
  6. Upgrade

    Upgrade composer/web-token/jwt-framework to a version that resolves this vulnerability.

    Fixed in 4.1.7
  7. Upgrade

    Upgrade Web-Token jwt-framework and jwt-library to a version that resolves this vulnerability.

    Fixed in 3.4.10
  8. Upgrade

    Upgrade Web-Token jwt-framework and jwt-library to a version that resolves this vulnerability.

    Fixed in 4.0.7
  9. Upgrade

    Upgrade Web-Token jwt-framework and jwt-library to a version that resolves this vulnerability.

    Fixed in 4.1.7
  10. Configuration

    Do not enable PBES2 algorithms for untrusted tokens.

    AlgorithmManager PBES2-HS*+A*KW algorithms = not enabled for untrusted tokens

Event History

Jun 18, 2026
Advisory Published
via OSV·09:09 PM
Data Sourced
via OSV·09:09 PM
DescriptionSeverityWeaknessAffected Software
Nov 21, 2026
CVE Published
via MITRE·04:32 PM
Data Sourced
via MITRE·04:32 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·05:17 PM
DescriptionSeverityWeakness

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203