CVE-2022-36083
Medium · 5.3CVSS
5.3
EPSS
1.5%
Published
Sep 7, 2022
CISA due date
—
Cloudanix analysis
A library used to handle encrypted web tokens can be tricked into wasting large amounts of processing power when it receives specially crafted tokens from outside sources, potentially slowing down or disrupting the service.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Denial Of Service
- Component
- Library
- Class
- Denial of service
- Remediation
- Upgrade
- Effort
- Low
- Patch risk
- Low
What it actually does
An attacker can supply a JWE with an extremely high p2c (PBES2 Count) value in the JOSE header when using PBKDF2-based key management algorithms. This triggers an unbounded number of PBKDF2 iterations during decryption of JWEs from untrusted sources when the library does not restrict accepted algorithms via keyManagementAlgorithms or equivalent, resulting in excessive CPU consumption.
Why it matters to the business
Services that accept and decrypt JWEs with symmetric secrets from external parties may experience resource exhaustion, leading to degraded performance or denial of service for legitimate users until the process completes or is terminated.
How an attack unfolds
An attacker crafts a JWE using one of the PBES2 algorithms and sets an abnormally large p2c value in the header. The victim application passes the JWE to the jose decryption API without limiting algorithms or inspecting p2c. The library performs the requested number of PBKDF2 iterations, consuming CPU time proportional to the chosen count and potentially stalling the process or thread.
How to fix it
Upgrade panva/jose to v1.28.2, v2.0.6, v3.20.4, or v4.9.2 (commit 179e2a7c22db97386a0495f2d1c31d59d939ed15) or later. After upgrading, the default maximum PBES2 iteration count is 10000; adjust via the maxPBES2Count option if needed. If immediate upgrade is impossible, restrict accepted algorithms using keyManagementAlgorithms to exclude PBES2 variants or inspect and cap the p2c header value before decryption.
How to confirm the fix worked
Confirm the installed jose version meets or exceeds the fixed releases listed above. Test by attempting decryption of a JWE with p2c exceeding 10000 and verify that the operation is rejected or capped rather than executing the full iteration count.
Typical attack path
- Identify an endpoint that accepts and decrypts JWEs using symmetric keys without algorithm restrictions
- Generate a JWE with a PBES2 algorithm and an extremely high p2c value
- Send the crafted JWE to the target decryption routine
- Observe sustained high CPU usage on the receiving system
How to detect it
Review application logs and process monitoring for unusually long-running or high-CPU decryption operations involving JWE payloads. Correlate with incoming requests containing JWE objects that include p2c values far above normal ranges. Examine source code and configuration for use of jose decrypt without algorithm restrictions.
What your security team should do
- Prioritize upgrade of panva/jose across all environments that decrypt untrusted JWEs
- Enable keyManagementAlgorithms restriction to disable PBES2 algorithms where not required
- Monitor for high-CPU decryption operations involving JWE handling
- Review and enforce input validation on JOSE headers before invoking decryption APIs
The record
JOSE is "JSON Web Almost Everything" - JWA, JWS, JWE, JWT, JWK, JWKS with no dependencies using runtime's native crypto in Node.js, Browser, Cloudflare Workers, Electron, and Deno. The PBKDF2-based JWE key management algorithms expect a JOSE Header Parameter named `p2c` PBES2 Count, which determines how many PBKDF2 iterations must be executed in order to derive a CEK wrapping key. The purpose of this parameter is to intentionally slow down the key derivation function in order to make password brute-force and dictionary attacks more expensive. This makes the PBES2 algorithms unsuitable for situations where the JWE is coming from an untrusted source: an adversary can intentionally pick an extremely high PBES2 Count value, that will initiate a CPU-bound computation that may take an unreasonable amount of time to finish. Under certain conditions, it is possible to have the user's environment consume unreasonable amount of CPU time. The impact is limited only to users utilizing the JWE decryption APIs with symmetric secrets to decrypt JWEs from untrusted parties who do not limit the accepted JWE Key Management Algorithms (`alg` Header Parameter) using the `keyManagementAlgorithms` (or `algorithms` in v1.x) decryption option or through other means. The `v1.28.2`, `v2.0.6`, `v3.20.4`, and `v4.9.2` releases limit the maximum PBKDF2 iteration count to `10000` by default. It is possible to adjust this limit with a newly introduced `maxPBES2Count` decryption option. If users are unable to upgrade their required library version, they have two options depending on whether they expect to receive JWEs using any of the three PBKDF2-based JWE key management algorithms. They can use the `keyManagementAlgorithms` decryption option to disable accepting PBKDF2 altogether, or they can inspect the JOSE Header prior to using the decryption API and limit the PBKDF2 iteration count (`p2c` Header Parameter).
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| npm | jose | 1.0.0 | 1.28.2 |
| npm | jose | 2.0.0 | 2.0.6 |
| npm | jose | 3.0.0 | 3.20.4 |
| npm | jose | 4.0.0 | 4.9.2 |
| npm | jose-browser-runtime | 3.0 | No fix |
| npm | jose-browser-runtime | 3.0.0 | 3.20.4 |
| npm | jose-browser-runtime | 4.0 | No fix |
| npm | jose-browser-runtime | 4.0.0 | 4.9.2 |
| npm | jose-node-cjs-runtime | 3.0 | No fix |
| npm | jose-node-cjs-runtime | 3.0.0 | 3.20.4 |
| npm | jose-node-cjs-runtime | 4.0 | No fix |
| npm | jose-node-cjs-runtime | 4.0.0 | 4.9.2 |
| npm | jose-node-esm-runtime | 3.0 | No fix |
| npm | jose-node-esm-runtime | 3.0.0 | 3.20.4 |
| npm | jose-node-esm-runtime | 4.0 | No fix |
| npm | jose-node-esm-runtime | 4.0.0 | 4.9.2 |
| Debian:12 | node-jose | 0 | 4.9.2-1 |
| Debian:13 | node-jose | 0 | 4.9.2-1 |
| Ubuntu:22.04:LTS | node-jose | 0 | No fix |
| Ubuntu:24.04:LTS | jose | 0 | No fix |
| Ubuntu:24.10 | jose | 0 | No fix |
| Ubuntu:25.04 | jose | 0 | No fix |
| Ubuntu:25.10 | jose | 0 | No fix |
Related vulnerabilities
- CVE-2026-106576 ImageMagick is free and open-source software used for editing and manipulating digital… CWE-834
- CVE-2026-53493 containerd is an open-source container runtime. CWE-834
- CVE-2026-81872 OpenTelemetry-Go is the Go implementation of OpenTelemetry. CWE-834
- CVE-2026-16497 NVIDIA Triton Inference Server for Linux contains a vulnerability where an attacker could… CWE-834
- CVE-2026-84310 pypdf is a free and open-source pure-python PDF library. CWE-834
- CVE-2026-84311 pypdf is a free and open-source pure-python PDF library. CWE-834
- CVE-2026-77357 Mesop is a Python-based UI framework that allows users to build web applications. CWE-834
- CVE-2026-71852 pypdf is a free and open-source pure-python PDF library. CWE-834