Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
🐘 Packagist
Not in CISA KEV

PHP JWT Library: PBES2-HS*+A*KW unwrap accepts an unbounded p2c iteration count, enabling CPU-amplification denial of serviceGHSA-3prj-6hqw-cm82

GHSA-3prj-6hqw-cm82 is a security vulnerability in web-token/jwt-library. A fix is available for web-token/jwt-library — see the affected versions and patch details below.

Published
Updated
Affected
6 pkgs
Patched
6 / 6
Exploits
None indexed
Exploitation data as of Jul 15, 2026 · OSV.dev, FIRST.org (EPSS)

Real-World Exposure

6 pkgs affected
🐘web-token/jwt-library🐘web-token/jwt-framework🐘web-token/jwt-library🐘web-token/jwt-library🐘web-token/jwt-framework🐘web-token/jwt-framework

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects Packagist packages — download data is not available via public APIs for these ecosystems.

Description

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 hash_pbkdf2() with no upper bound. The only validation performed (checkHeaderAdditionalParameters()) was is_int($p2c) && $p2c > 0.

An unauthenticated attacker can craft a single JWE whose protected header sets a very large p2c (e.g. 100_000_000 ≈ 87 s of CPU, or PHP_INT_MAX), 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*+A*KW algorithm in their decryption AlgorithmManager.

Patches

PBES2AESKW now enforces a configurable maximum iteration count (DEFAULT_MAX_COUNT = 1_000_000, 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 DEFAULT_MAX_COUNT = 1_000_000, configurable via le constructeur) avant tout appel à hash_pbkdf2(), 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.

Affected Packages

6 total 6 fixed
EcosystemPackageVulnerable rangeFix
🐘Packagistweb-token/jwt-libraryall versions3.4.10composer require web-token/jwt-library:^3.4.10
🐘Packagistweb-token/jwt-frameworkall versions3.4.10composer require web-token/jwt-framework:^3.4.10
🐘Packagistweb-token/jwt-library≥ 4.0.0&&< 4.0.74.0.7composer require web-token/jwt-library:^4.0.7
🐘Packagistweb-token/jwt-library≥ 4.1.0&&< 4.1.74.1.7composer require web-token/jwt-library:^4.1.7
🐘Packagistweb-token/jwt-framework≥ 4.0.0&&< 4.0.74.0.7composer require web-token/jwt-framework:^4.0.7
🐘Packagistweb-token/jwt-framework≥ 4.1.0&&< 4.1.74.1.7composer require web-token/jwt-framework:^4.1.7

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for web-token/jwt-library, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update web-token/jwt-library to 3.4.10 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-3prj-6hqw-cm82 is resolved across your whole dependency graph.

  3. Workarounds

    Cap what an attacker can consume: apply request size, rate and timeout limits in front of the affected component, and run it with memory and CPU limits so exhaustion degrades one worker rather than the whole service.

Frequently Asked Questions

### 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 `hash_pbkdf2()` with **no upper bound**. The only validation performed (`checkHeaderAdditionalParameters()`) was `is_int($p2c) && $p2c > 0`. An unauthenticated attacker can craft a single JWE whose protected header sets a very large `p2c` (e.g. `100_000_000` ≈ 87 s of CPU, or `PHP_INT_MAX`), forcing a worker to spen
O3 Security · Impact-Aware SCA

Is GHSA-3prj-6hqw-cm82 in your dependencies?

Find it across Packagist, including transitive dependencies.

PHP JWT Library: PBES2-HS*+A*KW unwrap accepts an…