PHP JWT Library: PBES2-HS*+A*KW unwrap accepts an unbounded p2c iteration count, enabling CPU-amplification denial of service
The PHP JWT Library contains a vulnerability in its PBES2-HS*+A*KW key unwrapping implementation where the iteration count parameter (p2c) from the attacker-controlled JOSE header is not properly bounded. This allows an unauthenticated attacker to specify an extremely large iteration count, causing excessive CPU consumption during PBKDF2 computation and resulting in a denial of service. The vulnerability affects applications that enable PBES2 algorithms for decryption. A patch has been introduced that enforces a configurable maximum iteration count to prevent CPU amplification attacks.
AI Analysis
Technical Summary
The vulnerability exists in the PHP JWT Library's PBES2AESKW::unwrapKey() function, which reads the PBKDF2 iteration count (p2c) directly from the JOSE header without an upper bound, only validating that it is a positive integer. An attacker can craft a JWE with a very large p2c value, causing the server to spend excessive CPU time computing PBKDF2 before failing the unwrap operation. This leads to an uncontrolled resource consumption (CWE-400) denial of service. The issue affects any application registering PBES2-HS*+A*KW algorithms in their decryption AlgorithmManager. The patch introduces a default maximum iteration count of 1,000,000, configurable via the constructor, to limit CPU usage.
Potential Impact
An unauthenticated attacker can cause a denial of service by forcing the server to perform expensive PBKDF2 computations with an unbounded iteration count, consuming excessive CPU resources. This can degrade or disrupt service availability. The decryption process swallows exceptions, so the attacker incurs minimal cost while amplifying CPU usage on the server. The impact is limited to denial of service via CPU exhaustion; no direct data compromise or privilege escalation is indicated.
Mitigation Recommendations
A patch is available that enforces a configurable maximum iteration count (default 1,000,000) in the PBES2AESKW::unwrapKey() method before any PBKDF2 computation. Operators should upgrade to a fixed version to mitigate the vulnerability. Before upgrading, as a workaround, validate or limit the p2c header parameter with a custom header checker or disable PBES2 algorithms for untrusted tokens. Do not rely on the default unbounded iteration count.
PHP JWT Library: PBES2-HS*+A*KW unwrap accepts an unbounded p2c iteration count, enabling CPU-amplification denial of service
Description
The PHP JWT Library contains a vulnerability in its PBES2-HS*+A*KW key unwrapping implementation where the iteration count parameter (p2c) from the attacker-controlled JOSE header is not properly bounded. This allows an unauthenticated attacker to specify an extremely large iteration count, causing excessive CPU consumption during PBKDF2 computation and resulting in a denial of service. The vulnerability affects applications that enable PBES2 algorithms for decryption. A patch has been introduced that enforces a configurable maximum iteration count to prevent CPU amplification attacks.
CVSS v4.0
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability exists in the PHP JWT Library's PBES2AESKW::unwrapKey() function, which reads the PBKDF2 iteration count (p2c) directly from the JOSE header without an upper bound, only validating that it is a positive integer. An attacker can craft a JWE with a very large p2c value, causing the server to spend excessive CPU time computing PBKDF2 before failing the unwrap operation. This leads to an uncontrolled resource consumption (CWE-400) denial of service. The issue affects any application registering PBES2-HS*+A*KW algorithms in their decryption AlgorithmManager. The patch introduces a default maximum iteration count of 1,000,000, configurable via the constructor, to limit CPU usage.
Potential Impact
An unauthenticated attacker can cause a denial of service by forcing the server to perform expensive PBKDF2 computations with an unbounded iteration count, consuming excessive CPU resources. This can degrade or disrupt service availability. The decryption process swallows exceptions, so the attacker incurs minimal cost while amplifying CPU usage on the server. The impact is limited to denial of service via CPU exhaustion; no direct data compromise or privilege escalation is indicated.
Mitigation Recommendations
A patch is available that enforces a configurable maximum iteration count (default 1,000,000) in the PBES2AESKW::unwrapKey() method before any PBKDF2 computation. Operators should upgrade to a fixed version to mitigate the vulnerability. Before upgrading, as a workaround, validate or limit the p2c header parameter with a custom header checker or disable PBES2 algorithms for untrusted tokens. Do not rely on the default unbounded iteration count.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-3prj-6hqw-cm82
- Osv Schema Version
- 1.4.0
- Aliases
- []
- Ecosystems
- ["Packagist"]
- Database Specific Severity
- HIGH
- Cvss Version
- 4.0
Threat ID: 6a58b41668715ace43d6858d
Added to database: 07/16/2026, 10:36:06 UTC
Last enriched: 07/16/2026, 10:57:56 UTC
Last updated: 07/31/2026, 12:27:30 UTC
Views: 9
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.