CVE-2021-21330 is a medium-severity (CVSS 6.1) Open Redirect vulnerability in aiohttp. A fix is available for aiohttp — see the affected versions and patch details below.
`aiohttp` Open Redirect vulnerability (`normalize_path_middleware` middleware)
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
CVE-2021-21330 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.
Where this sits among everything scored
Of 385,987 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.
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
Impact
Open redirect vulnerability — a maliciously crafted link to an aiohttp-based web-server could redirect the browser to a different website.
It is caused by a bug in the aiohttp.web_middlewares.normalize_path_middleware middleware.
Patches
This security problem has been fixed in v3.7.4. Upgrade your dependency as follows:
pip install aiohttp >= 3.7.4
Workarounds
If upgrading is not an option for you, a workaround can be to avoid using aiohttp.web_middlewares.normalize_path_middleware in your applications.
References
For more information
If you have any questions or comments about this advisory:
- Open an issue in the aiohttp repo
- Email us at [email protected] and/or [email protected]
Credit: Jelmer Vernooij and Beast Glatisant.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | aiohttp | all versions | 3.7.4pip install --upgrade 'aiohttp==3.7.4' |
Affected Products
aiohttpaiohttpdebian linuxdebianfedorafedoraprojectDetection & 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.7.4 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2021-21330 is resolved across your whole dependency graph.
Workarounds
Stop reflecting attacker-controlled destinations: resolve every redirect target against an allowlist of paths or hosts you own, prefer a server-side key over a full URL in the request, and reject absolute URLs entirely where the flow only ever needs a relative one.
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.
Red Hat Satellite version 6.7 onward (mostly pulp part) does ship an affected version of aiohttp, however, is not vulnerable since the product code does not use the normalize_path_middleware function, which the attacker may use for an attack. We may update the python-aiohttp dependency in a future release.
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat Satellite 6.10 for RHEL 7 | python-aiohttp-0:3.7.4-1.el7pc | RHSA-2021:4702 |
Frequently Asked Questions
Is CVE-2021-21330 in your dependencies?
Find it across PyPI, including transitive dependencies.