XSS Vulnerability in Python Aiohttp Package: CVE-2024-27306

python-aiohttp Updated 03 Oct 2025

Summary

18/04/2024
N/A
Yes i
Medium
6.1

UBUNTU-CVE-2024-27306: aiohttp is an asynchronous HTTP client/server framework for asyncio and Python. Affects python-aiohttp versions < 3.0.1-1ubuntu0.1~esm5. Fixed in 3.0.1-1ubuntu0.1~esm5. How to fix ↓

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

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The Python Aiohttp package is an asynchronous HTTP client/server framework designed for asyncio and Python. It enables developers to build web applications and services that can handle multiple requests concurrently, making it efficient for I/O-bound tasks. The package is widely used for its simplicity and performance, but it has recently been identified as vulnerable to a cross-site scripting (XSS) attack, particularly in its handling of static file serving.

Vulnerability Detail

The vulnerability, identified as CVE-2024-27306, arises from improper handling of static file requests, specifically on index pages. This flaw allows attackers to inject malicious scripts into the web application, potentially compromising user data and session integrity. The vulnerability is particularly concerning for applications that do not implement a reverse proxy server, which is recommended for serving static files. If exploited, this vulnerability could lead to unauthorized access to sensitive information and a breach of user trust.

How To Fix

Minimum fixed version

3.0.1-1ubuntu0.1~esm5

This is the first release that contains the fix.

sudo apt-get install --only-upgrade python-aiohttp

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

Workaround

If upgrading is not immediately feasible, users can implement a workaround by disabling the 'show_index' feature in their Aiohttp configuration. This can be done by modifying the server settings as follows:

app.router.add_static('/static/', path='static', show_index=False)

This change will prevent the display of index pages that could be exploited by attackers.

Conclusion

The CVE-2024-27306 vulnerability in the Python Aiohttp package poses significant risks to web applications that utilize this framework for serving static files. It is crucial for developers to update their packages to the latest patched versions and consider implementing recommended workarounds to safeguard their applications against potential attacks.

See every vulnerability recorded for python-aiohttp →

Share this vulnerability

FAQ

CVE-2024-27306 is a cross-site scripting (XSS) vulnerability found in the Python Aiohttp package, affecting its static file handling.

You can check if your application is affected by using the Vulert playground at Vulert Scanner, which allows you to monitor for open-source vulnerabilities without needing to sign up.

Exploitation of this vulnerability could lead to unauthorized access to user data, session hijacking, and a loss of user trust in the application.

Yes, a patched version of the Aiohttp package is available. Users should update to version 3.9.4 or later to mitigate the risk.

As a temporary measure, you can disable the 'show_index' feature in your Aiohttp configuration to reduce the risk of exploitation.

Related vulnerabilities

Recent vulnerabilities recorded for python-aiohttp.

How To Fix

Minimum fixed version

3.0.1-1ubuntu0.1~esm5

This is the first release that contains the fix.

sudo apt-get install --only-upgrade python-aiohttp

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