CVE-2026-39373: JWCrypto JWE ZIP Decompression Bomb Vulnerability

MODERATE
Advisory Identifier: GHSA-fjrm-76x2-c4q4
CVSS 5.3
CWE-409
Published
Advisory Summary

CVE-2026-39373 is a MODERATE (CVSS 5.3) jwe zip decompression bomb vulnerability (CWE-409: Improper Handling of Highly Compressed Data (Data Amplification)) affecting JWCrypto libraries in the PyPI ecosystem. The issue involves jwe zip decompression bomb. Remediation is available by upgrading affected packages to version 1.5.7.

CVE-2026-39373 at a Glance

CVE Identifier CVE-2026-39373
GHSA Identifier GHSA-fjrm-76x2-c4q4
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-409: Improper Handling of Highly Compressed Data (Data Amplification)
Affected Product JWCrypto
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability Low (A:L)

How to Fix CVE-2026-39373

To remediate this vulnerability, upgrade all affected JWCrypto dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

jwcrypto fixed: 1.5.7
pip install jwcrypto>=1.5.7
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show jwcrypto

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-39373, inspect your installed packages using pip:

pip show jwcrypto

Analyze the terminal output to locate any version of JWCrypto in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.5.7), your application is affected.

Note: The pip show jwcrypto command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-409: Improper Handling of Highly Compressed Data (Data Amplification), where the product does not handle or incorrectly handles a compressed input with a very high compression ratio that produces a large output. In JWCrypto, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary The fix for GHSA-j857-7rvv-vj97 in v1.5.6 is weak in that it does not allow to fully control the amount of plaintext the receiver is willing to deal with and provides just a weak upper bound. The patch limits input token size to 250KB but does not validate the decompressed output size. An unauthenticated attacker can craft a JWE token under the 250KB input limit that decompresses to very large data that may exceed small devices memory availability, causing Denial of Service via memory exhaustion. Although this is technically not unbounded I do recognize that it may be too much for devices and is something that could be surprising to developers, and we can do better than that. NOTE: the original report was sloppy (probably AI slop) and claimed arbitrary memory consumption, but simple testing showed that while 100MB could be decompressed a 1GB output was denied because the token exceeded the 250K compressed serialization. NOTE WELL: The proposed solution was also sloppy, proposing to first decompress the data completely in memory (therefore causing the memory exhaustion) and then checking how much memory was already used to deny the operation. I _intentionally_ left the "details" section untouched to show how bad AI slop is and how _uncritical_ the submitter was, even as it was obvious the "suggested fix" is actually no solution at all, as it was using the very call that he claimed was causing "arbitrary" memory exhaustion and wrapping it around an "if" ... the actual solution is in the resolving commit in version 1.5.7 ### Details The vulnerable code in `jwcrypto/jwe.py`: ```python if len(data) > default_max_compressed_size: raise InvalidJWEData('Compressed data exceeds maximum allowed size') self.plaintext = zlib.decompress(data, -zlib.MAX_WBITS) ``` The check validates `data` which is the **compressed** bytes, not the decompressed output. A 132KB token (under the 250KB limit) can decompress to approximately 100MB with no error raised. ### PoC Tested on jwcrypto 1.5.6 (patched version): ```python import zlib from jwcrypto import jwe from jwcrypto.jwk import JWK import time key = JWK.generate(kty='oct', size=128) bomb_data = b"A" * 1024 * 1024 * 100 # 100MB uncompressed token = jwe.JWE( plaintext=bomb_data, protected={"alg": "A128KW", "enc": "A128GCM", "zip": "DEF"} ) token.add_recipient(key) serialized = token.serialize(compact=True) print(f"Token size: {len(serialized)/1024:.1f} KB") # 132.8 KB — under 250KB limit tok2 = jwe.JWE() tok2.deserialize(serialized, key) print(f"Decompressed: {len(tok2.plaintext)/1024/1024:.0f} MB") # 100 MB ``` Output: ``` Token size: 132.8 KB Decompressed: 100 MB ``` ### Impact An unauthenticated attacker can exhaust server memory by sending crafted JWE tokens with ZIP compression. The existing patch (v1.5.6) does not prevent this attack. An unauthenticated attacker can cause memory exhaustion on memory-constrained systems. A token under the 250KB input limit can decompress to approximately 100MB.

CVE-2026-39373 Affected JWCrypto Versions

1 component(s)
Fixed Versions:
1.5.7
Product / Package Ecosystem Affected Versions Fixed Version
jwcrypto
PyPI
< 1.5.7
1.5.7

References

Frequently Asked Questions

What is CVE-2026-39373?
CVE-2026-39373 is a security vulnerability in JWCrypto involving JWE ZIP decompression bomb under CWE-409: Improper Handling of Highly Compressed Data (Data Amplification).
Which JWCrypto versions are affected?
Affected versions include releases prior to 1.5.7 across affected packages: jwcrypto.
What version fixes CVE-2026-39373?
Upgrading to 1.5.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is jwcrypto affected?
Yes, jwcrypto is affected in releases prior to 1.5.7. Upgrade your dependency to 1.5.7 or later.
What is the CVSS score of CVE-2026-39373?
CVE-2026-39373 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L.
What CWE is associated with CVE-2026-39373?
CVE-2026-39373 is classified under CWE-409: Improper Handling of Highly Compressed Data (Data Amplification) (The product does not handle or incorrectly handles a compressed input with a very high compression ratio that produces a large output.).
How can I check PyPI dependencies for CVE-2026-39373?
Run the dependency tree command: 'pip show jwcrypto'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-fjrm-76x2-c4q4",
  "modified" : "2026-06-06T00:25:45Z",
  "published" : "2026-04-08T00:16:14Z",
  "aliases" : [ "CVE-2026-39373" ],
  "summary" : "JWCrypto: JWE ZIP decompression bomb",
  "details" : "### Summary\nThe fix for GHSA-j857-7rvv-vj97 in v1.5.6 is weak in that it does not allow to fully control the amount of plaintext the receiver is willing to deal with and provides just a weak upper bound. The patch limits input token size to 250KB but does not validate the decompressed output size. An unauthenticated attacker can craft a JWE token under the 250KB input limit that decompresses to very large data that may exceed small devices memory availability, causing Denial of Service via memory exhaustion.\n\nAlthough this is technically not unbounded I do recognize that it may be too much for devices and is something that could be surprising to developers, and we can do better than that.\n\nNOTE: the original report was sloppy (probably AI slop) and claimed arbitrary memory consumption, but simple testing showed that while 100MB could be decompressed a 1GB output was denied because the token exceeded the 250K compressed serialization.\n\nNOTE WELL: The proposed solution was also sloppy, proposing to first decompress the data completely in memory (therefore causing the memory exhaustion) and then checking how much memory was already used to deny the operation. I _intentionally_ left the \"details\" section untouched to show how bad AI slop is and how _uncritical_ the submitter was, even as it was obvious the \"suggested fix\" is actually no solution at all, as it was using the very call that he claimed was causing \"arbitrary\" memory exhaustion and wrapping it around an \"if\" ... the actual solution is in the resolving commit in version 1.5.7\n\n### Details\nThe vulnerable code in `jwcrypto/jwe.py`:\n```python\nif len(data) > default_max_compressed_size:\n    raise InvalidJWEData('Compressed data exceeds maximum allowed size')\nself.plaintext = zlib.decompress(data, -zlib.MAX_WBITS)\n```\n\nThe check validates `data` which is the **compressed** bytes, not the decompressed output. A 132KB token (under the 250KB limit) can decompress to approximately 100MB with no error raised.\n\n### PoC\nTested on jwcrypto 1.5.6 (patched version):\n```python\nimport zlib\nfrom jwcrypto import jwe\nfrom jwcrypto.jwk import JWK\nimport time\n\nkey = JWK.generate(kty='oct', size=128)\nbomb_data = b\"A\" * 1024 * 1024 * 100  # 100MB uncompressed\n\ntoken = jwe.JWE(\n    plaintext=bomb_data,\n    protected={\"alg\": \"A128KW\", \"enc\": \"A128GCM\", \"zip\": \"DEF\"}\n)\ntoken.add_recipient(key)\nserialized = token.serialize(compact=True)\nprint(f\"Token size: {len(serialized)/1024:.1f} KB\")  # 132.8 KB — under 250KB limit\n\ntok2 = jwe.JWE()\ntok2.deserialize(serialized, key)\nprint(f\"Decompressed: {len(tok2.plaintext)/1024/1024:.0f} MB\")  # 100 MB\n```\n\nOutput:\n```\nToken size: 132.8 KB\nDecompressed: 100 MB\n```\n\n### Impact\nAn unauthenticated attacker can exhaust server memory by sending crafted JWE tokens with ZIP compression. The existing patch (v1.5.6) does not prevent this attack. An unauthenticated attacker can cause memory exhaustion on memory-constrained systems. A token under the 250KB input limit can decompress to approximately 100MB.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "jwcrypto"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.5.7"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.5.6"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/latchset/jwcrypto/security/advisories/GHSA-fjrm-76x2-c4q4"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-39373"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/latchset/jwcrypto/commit/25db861d8b29434838669a94a843af03d29ea6ed"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/latchset/jwcrypto"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/latchset/jwcrypto/releases/tag/v1.5.7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/jwcrypto/PYSEC-2026-70.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-409" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-08T00:16:14Z",
    "nvd_published_at" : "2026-04-07T20:16:32Z"
  }
}