CVE-2026-39373: JWCrypto: JWE ZIP decompression bomb

Published Apr 7, 2026
·
Updated

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) > defaultmaxcompressedsize: raise InvalidJWEData('Compressed data exceeds maximum allowed size') self.plaintext = zlib.decompress(data, -zlib.MAXWBITS)

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) bombdata = b"A" 1024 1024 100 # 100MB uncompressed

token = jwe.JWE( plaintext=bombdata, protected={"alg": "A128KW", "enc": "A128GCM", "zip": "DEF"} ) token.addrecipient(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.

Other sources

JWCrypto implements JWK, JWS, and JWE specifications using python-cryptography. Prior to 1.5.7, an unauthenticated attacker can exhaust server memory by sending crafted JWE tokens with ZIP compression. The existing patch for CVE-2024-28102 limits input token size to 250KB but does not validate the decompressed output size. An unauthenticated attacker can cause memory exhaustion on memory-constrained systems. A token under the 250KB input limit can decompress to approximately 100MB. This vulnerability is fixed in 1.5.7.

MITRE

Affected Software

2 affected components
pip/jwcrypto<=1.5.6
latchset jwcrypto<1.5.7

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade jwcrypto to a version that resolves this vulnerability.

    Fixed in 1.5.7

Event History

Apr 7, 2026
CVE Published
via MITRE·07:35 PM
Data Sourced
via MITRE·07:35 PM
DescriptionSeverityWeakness
Data Sourced
via Red Hat·08:03 PM
DescriptionSeverityAffected Software
Data Sourced
via NVD·08:16 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·08:16 PM
Affected Software
Apr 8, 2026
Advisory Published
via GitHub·12:16 AM
Data Sourced
via GitHub·12:16 AM
DescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203