GHSA-g7f3-828f-7h7m
Denial of Service (DoS) vulnerability in authlib (PyPI)

Denial of Service (DoS) No known exploit

What is GHSA-g7f3-828f-7h7m About?

This vulnerability in Authlib's JWE `zip=DEF` decompression mechanism allows for unbounded DEFLATE expansion. An attacker can craft a small JWE ciphertext that inflates to a very large plaintext, consuming significant memory and CPU resources, leading to a denial of service. Exploitation is possible remotely if an attacker can supply decryptable tokens.

Affected Software

authlib <1.6.5

Technical Details

The vulnerability resides in the Authlib library's JSON Web Encryption (JWE) functionality, specifically when the zip=DEF (DEFLATE compression) algorithm is used. The DeflateZipAlgorithm.decompress method in authlib/authlib/jose/rfc7518/jwe_zips.py calls zlib.decompress(s, -zlib.MAX_WBITS) without any limits on the output size. This means that a highly compressed, specially crafted JWE ciphertext, even if very small (e.g., a few KBs), can be designed to expand into tens or hundreds of megabytes during decompression, as DEFLATE achieves very high compression ratios on repetitive data. When the JWE decoding path (authlib/authlib/jose/rfc7516/jwe.py) processes such a token, it attempts to fully decompress the ciphertext into memory. This unbounded expansion causes the application to consume excessive memory (RSS) and CPU cycles, eventually leading to memory exhaustion and system unresponsiveness, thereby creating a Denial of Service condition. The attacker must be able to submit a JWE token that the target system is capable of decrypting (e.g., by possessing a shared key or exploiting token reflection).

What is the Impact of GHSA-g7f3-828f-7h7m?

Successful exploitation may allow attackers to cause a denial of service, leading to memory and CPU exhaustion, making the affected application unresponsive and unavailable to legitimate users, severely impacting service availability.

What is the Exploitability of GHSA-g7f3-828f-7h7m?

Exploitation complexity is moderate. An attacker needs to craft a JWE token with the zip=DEF header and a highly compressible payload, and then ensure that this token can be successfully decrypted by the target application. This implies the attacker either has access to a shared secret key (e.g., for alg=dir) or can exploit a token reflection/re-submission vulnerability. Authentication requirements depend on whether the JWE decryption endpoint is accessible to unauthenticated users or requires prior authentication. Privilege requirements are limited to being able to submit JWE tokens that the system will attempt to decrypt. This is primarily a remote vulnerability. The risk is significantly increased in environments where Authlib is used for JWE with zip=DEF, especially in services that process JWE tokens from untrusted sources or where shared keys are easily compromised, and without explicit guards against large decompression outputs or robust input validation for token size.

What are the Known Public Exploits?

PoC Author Link Commentary
No known exploits

What are the Available Fixes for GHSA-g7f3-828f-7h7m?

Available Upgrade Options

  • authlib
    • <1.6.5 → Upgrade to 1.6.5

Struggling with dependency upgrades?

See how Resolved Security's drop-in replacements make it simple.

Book a demo

Additional Resources

What are Similar Vulnerabilities to GHSA-g7f3-828f-7h7m?

Similar Vulnerabilities: CVE-2022-37454 , CVE-2019-11252 , CVE-2018-10237 , CVE-2020-26233 , CVE-2021-39144