PYSEC-2026-1202: Authlib : JWE zip=DEF decompression bomb enables DoS
Authlib is a Python library which builds OAuth and OpenID Connect servers. Prior to version 1.6.5, Authlib’s JWE zip=DEF path performs unbounded DEFLATE decompression. A very small ciphertext can expand into tens or hundreds of megabytes on decrypt, allowing an attacker who can supply decryptable tokens to exhaust memory and CPU and cause denial of service. This issue has been patched in version 1.6.5. Workarounds for this issue involve rejecting or stripping zip=DEF for inbound JWEs at the application boundary, forking and add a bounded decompression guard via decompressobj().decompress(data, MAXSIZE)) and returning an error when output exceeds a safe limit, or enforcing strict maximum token sizes and fail fast on oversized inputs; combine with rate limiting.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Authlibto a version that resolves this vulnerability.Fixed in 1.6.5 - Compensating control
At the application boundary, reject or strip zip=DEF from inbound JWEs.
- Compensating control
Fork Authlib and add a bounded decompression guard using decompressobj().decompress(data, MAX_SIZE), returning an error when decompressed output exceeds a safe limit.
- Compensating control
Enforce strict maximum token sizes, fail fast on oversized inputs, and combine this control with rate limiting.
Event History
Frequently Asked Questions
Who can exploit this issue?
An attacker must be able to supply decryptable JWE tokens to an application using an affected Authlib version. They can use a small ciphertext with zip=DEF that expands during decryption and exhausts memory and CPU.
Are applications affected by default?
The issue is in the inbound JWE zip=DEF decompression path. Exposure depends on whether the application accepts and decrypts attacker-supplied JWEs that use zip=DEF.
What can be done before upgrading?
Reject or remove zip=DEF from inbound JWEs at the application boundary. Alternatively, add bounded decompression with a safe maximum output size, enforce strict token-size limits with early rejection, and apply rate limiting.
What version contains the fix?
Authlib version 1.6.5 patches the unbounded DEFLATE decompression issue.