CVE-2024-28176

CVE-2024-28176 is a medium-severity uncontrolled resource consumption vulnerability in jose (npm), affecting versions >= 3.0.0, <= 4.15.4. It is fixed in 4.15.5, 2.0.7.

Summary

A vulnerability has been identified in the JSON Web Encryption (JWE) decryption interfaces, specifically related to the support for decompressing plaintext after its decryption. This allows an adversary to exploit specific scenarios where the compression ratio becomes exceptionally high. As a result, the length of the JWE token, which is determined by the compressed content's size, can land below application-defined limits. In such cases, other existing application level mechanisms for preventing resource exhaustion may be rendered ineffective.

Note that as per RFC 8725 compression of data SHOULD NOT be done before encryption, because such compressed data often reveals information about the plaintext. For this reason the v5.x major version of jose removed support for compressed payloads entirely and is therefore NOT affected by this advisory.

Affected users

The impact is limited only to Node.js users utilizing the JWE decryption APIs to decrypt JWEs from untrusted sources.

You are NOT affected if any of the following applies to you

  • Your code uses jose version v5.x where JWE Compression is not supported anymore
  • Your code runs in an environment other than Node.js (e.g. Deno, CF Workers), which is the only runtime where JWE Compression is implemented out of the box
  • Your code does not use the JWE decryption APIs
  • Your code only accepts JWEs produced by trusted sources

Workarounds

If you cannot upgrade and do not want to support compressed JWEs you may detect and reject these tokens early by checking the token's protected header

const { zip } = jose.decodeProtectedHeader(token)
if (zip !== undefined) {
  throw new Error('JWE Compression is not supported')
}

If you wish to continue supporting JWEs with compressed payloads in these legacy release lines you must upgrade (v1.x and v2.x to version v2.0.7, v3.x and v4.x to version v4.15.5) and review the limits put forth by the patched releases.

For more information

If you have any questions or comments about this advisory please open a discussion in the project's repository

Impact

Under certain conditions it is possible to have the user's environment consume unreasonable amount of CPU time or memory during JWE Decryption operations.

Crafted input forces the application to consume excessive CPU, memory, or other resources, degrading or denying service. Typical impact: denial of service.

CVE-2024-28176 has a CVSS score of 5.3 (Medium). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (4.15.5, 2.0.7); upgrading removes the vulnerable code path.

Affected versions

jose (>= 3.0.0, <= 4.15.4) jose-node-cjs-runtime (<= 4.15.4) jose-node-esm-runtime (<= 4.15.4) jose (< 2.0.7)

Security releases

jose → 4.15.5 (npm) jose-node-cjs-runtime → 4.15.5 (npm) jose-node-esm-runtime → 4.15.5 (npm) jose → 2.0.7 (npm)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

See it in your environment

Remediation advice

v2.0.7 and v4.15.5 releases limit the decompression routine to only allow decompressing up to 250 kB of plaintext. In v4.x it is possible to further adjust this limit via the inflateRaw decryption option implementation. In v2.x it is possible to further adjust this limit via the inflateRawSyncLimit decryption option.

Frequently Asked Questions

  1. What is CVE-2024-28176? CVE-2024-28176 is a medium-severity uncontrolled resource consumption vulnerability in jose (npm), affecting versions >= 3.0.0, <= 4.15.4. It is fixed in 4.15.5, 2.0.7. Crafted input forces the application to consume excessive CPU, memory, or other resources, degrading or denying service.
  2. How severe is CVE-2024-28176? CVE-2024-28176 has a CVSS score of 5.3 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which packages are affected by CVE-2024-28176?
    • jose (npm) (versions >= 3.0.0, <= 4.15.4)
    • jose-node-cjs-runtime (npm) (versions <= 4.15.4)
    • jose-node-esm-runtime (npm) (versions <= 4.15.4)
  4. Is there a fix for CVE-2024-28176? Yes. CVE-2024-28176 is fixed in 4.15.5, 2.0.7. Upgrade to this version or later.
  5. Is CVE-2024-28176 exploitable, and should I be worried? Whether CVE-2024-28176 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether CVE-2024-28176 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix CVE-2024-28176?
    • Upgrade jose to 4.15.5 or later
    • Upgrade jose-node-cjs-runtime to 4.15.5 or later
    • Upgrade jose-node-esm-runtime to 4.15.5 or later
    • Upgrade jose to 2.0.7 or later

Other vulnerabilities in jose

CVE-2026-34240CVE-2023-50966CVE-2024-28176CVE-2022-36083

Stop the waste.
Protect your environment with Kodem.