The vulnerability is a Denial of Service (DoS) caused by improper handling of highly compressed data, commonly known as a "zip bomb". The root cause lies in the low-level decompression functions in aiohttp.compression_utils for zlib, brotli, and zstd, which did not enforce any limits on the size of the decompressed output.
This flaw was exposed through higher-level parsers that handle HTTP request bodies:
aiohttp.http_parser.DeflateBuffer: Used for streaming decompression of request bodies with Content-Encoding: deflate or gzip.
aiohttp.multipart.BodyPartReader: Used for handling compressed parts within a multipart/* request.
Before the patch, these parsers would feed compressed data from an incoming request directly into the unlimited decompression functions. An attacker could craft a small, highly-compressed request body that, when decompressed by the server, would expand to an enormous size, exhausting system memory and causing the server process to crash or become unresponsive.
The fix introduces a max_decompress_size limit (defaulting to 32MiB) at the parser level. This limit is then passed down to the low-level decompression functions, which were modified to accept a max_length parameter. Now, if the decompressed output for any single chunk of data exceeds this limit, a DecompressSizeError is raised, terminating the request and preventing the DoS attack.