CVE-2024-30251: aiohttp Denial of Service Vulnerability
Summary
CVE-2024-30251: aiohttp vulnerable to Denial of Service when trying to parse malformed POST requests. Affects aiohttp versions < 3.9.4. Fixed in 3.9.4. How to fix ↓
Also tracked for
- python-aiohttp · Debian:11
The same CVE-2024-30251 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
aiohttp is a Python library for building HTTP-based applications. It provides an asynchronous HTTP client and server implementation. The library is widely used for developing web applications and APIs. aiohttp versions prior to 3.9.4 are vulnerable to a Denial of Service (DoS) attack when processing malformed POST requests.
Vulnerability Detail
The vulnerability arises when an attacker sends a specially crafted POST request with multipart/form-data content. When the aiohttp server attempts to process this request, it enters an infinite loop and becomes unable to handle any further requests. This results in a DoS condition, where the application is effectively stopped from serving any requests after receiving a single malicious request.
How To Fix
Latest published version: 3.14.5 as of 22 Oct 2026
pip install --upgrade "aiohttp==3.14.5"
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
3.9.4
This is the first release that contains the fix.
pip install --upgrade "aiohttp==3.9.4"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If upgrading to the latest version is not immediately feasible, a temporary workaround can be applied by modifying the _read_chunk_from_length() function in the aiohttp/multipart.py file. The following diff shows the necessary changes:
--- a/aiohttp/multipart.py
+++ b/aiohttp/multipart.py
@@ -338,6 +338,8 @@ class BodyPartReader:
assert self._length is not None, "Content-Length required for chunked read"
chunk_size = min(size, self._length - self._read_bytes)
chunk = await self._content.read(chunk_size)
+ if self._content.at_eof():
+ self._at_eof = True
return chunk
async def _read_chunk_from_stream(self, size: int) -> bytes:
Please note that applying this workaround may introduce minor issues with handling form data. It is recommended to backport the changes mentioned in the provided links if possible.
Conclusion
The aiohttp library versions prior to 3.9.4 are susceptible to a Denial of Service vulnerability. It is crucial to upgrade to the latest version or apply the provided workaround to mitigate the risk. For further assistance or support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for aiohttp →
FAQ
aiohttp is a Python library used for building HTTP-based applications. It provides an asynchronous HTTP client and server implementation.
An attacker can exploit this vulnerability to send a single malicious request that causes the aiohttp server to enter an infinite loop. As a result, the application becomes unresponsive and unable to serve any further requests.
To fix this vulnerability, upgrade to aiohttp version 3.9.4 or later. Alternatively, apply the provided workaround if immediate upgrade is not possible.
Yes, versions prior to 3.9.4 are vulnerable to this DoS vulnerability.
Yes, the CVSS score for this vulnerability is 7.5 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
References
Related vulnerabilities
Recent vulnerabilities recorded for aiohttp.