CVE-2024-52303: aiohttp Memory Leak Vulnerability in Middleware Handling

aiohttp Updated 02 Oct 2025

Summary

18/11/2024
Yes i
Moderate
7.5

CVE-2024-52303: A memory leak can occur when a request produces a MatchInfoError. Affects aiohttp versions >= 3.10.6, < 3.10.11. Fixed in 3.10.11. How to fix ↓

Also tracked for

The same CVE-2024-52303 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

aiohttp is a popular asynchronous HTTP client/server framework for Python, designed to handle asynchronous web requests efficiently. It is widely used for building web applications and APIs due to its non-blocking capabilities and support for web protocols. However, a recently discovered vulnerability affects its middleware functionality, which is crucial for processing requests and responses in a web application.

Vulnerability Detail

The vulnerability arises from a memory leak that occurs when middleware is enabled and a request is made with a non-allowed HTTP method, resulting in a 'MatchInfoError'. Each occurrence of this error generates a unique cache entry, leading to excessive memory consumption. If exploited, an attacker could send a large volume of such requests, potentially exhausting the server's memory resources and causing denial of service.

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.10.11

This is the first release that contains the fix.

pip install --upgrade "aiohttp==3.10.11"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, you can disable middleware that processes requests with non-allowed methods, or implement rate limiting to restrict the number of requests from a single source. However, these are not permanent solutions and upgrading the package is strongly recommended.

Conclusion

The aiohttp memory leak vulnerability (CVE-2024-52303) poses a significant risk to applications using middleware. It is crucial to upgrade to the patched version to mitigate this risk and ensure the stability of your web applications.

See every vulnerability recorded for aiohttp →

Share this vulnerability

FAQ

The memory leak occurs when middleware is enabled and a request results in a 'MatchInfoError', leading to the creation of unique cache entries for each error.

An attacker could exploit this vulnerability by sending a massive number of requests, potentially exhausting the server's memory and causing it to crash.

Yes, versions of aiohttp starting from 3.10.6 up to 3.10.10 are affected by this vulnerability.

If an immediate upgrade is not possible, consider implementing rate limiting or disabling the middleware that processes non-allowed methods as a temporary measure.

You can use Vulert, which monitors and alerts in real-time for open-source vulnerabilities in your software. You can check if your application is affected by this vulnerability using the Vulert playground without any signup.

Related vulnerabilities

Recent vulnerabilities recorded for aiohttp.

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.10.11

This is the first release that contains the fix.

pip install --upgrade "aiohttp==3.10.11"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback