CVE-2024-27306 is a medium-severity (CVSS 6.1) Cross-site Scripting (XSS) vulnerability in aiohttp. A fix is available for aiohttp — see the affected versions and patch details below.
aiohttp vulnerable to XSS on index pages for static file handling
Exploitation Status
No confirmed exploitation observed yet
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for CVE-2024-27306.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
aiohttpReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
Description
Summary
A XSS vulnerability exists on index pages for static file handling.
Details
When using web.static(..., show_index=True), the resulting index pages do not escape file names.
If users can upload files with arbitrary filenames to the static directory, the server is vulnerable to XSS attacks.
Workaround
We have always recommended using a reverse proxy server (e.g. nginx) for serving static files. Users following the recommendation are unaffected.
Other users can disable show_index if unable to upgrade.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | aiohttp | all versions | 3.9.4pip install --upgrade 'aiohttp==3.9.4' |
Affected Products
aiohttpaiohttpfedorafedoraprojectDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for aiohttp, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update aiohttp to 3.9.4 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2024-27306 is resolved across your whole dependency graph.
Workarounds
Escape or sanitise the affected output on the server side rather than relying on client-side filtering, and add a Content-Security-Policy that blocks inline script execution so injected markup cannot run even if it reaches the page.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat Ansible Automation Platform 2.4 for RHEL 8 | python3x-aiohttp-0:3.9.5-1.el8ap | RHSA-2024:3781 |
| Red Hat Satellite 6.15 for RHEL 8 | python-aiohttp-0:3.9.4-1.el8pc | RHSA-2024:5662 |
| RHUI 4 for RHEL 8 | python-aiohttp-0:3.9.4-1.el8ui | RHSA-2025:1335 |
Frequently Asked Questions
Is CVE-2024-27306 in your dependencies?
Find it across PyPI, including transitive dependencies.