CVE-2021-21330: Aiohttp `aiohttp` Open Redirect Vulnerability (`normalize_path_middleware` Vulnerability
LOWCVE-2021-21330 is a LOW (CVSS 3.1) `aiohttp` open redirect vulnerability (`normalize_path_middleware` vulnerability (CWE-601: URL Redirection to Untrusted Site ('Open Redirect')) affecting Aiohttp libraries in the PyPI ecosystem. The issue involves `aiohttp` open redirect vulnerability (`normalize_path_middleware` middleware). Remediation is available by upgrading affected packages to version 3.7.4.
CVE-2021-21330 at a Glance
Security Impact
CVSS: 3.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:L/A:N).
How to Fix CVE-2021-21330
To remediate this vulnerability, upgrade all affected Aiohttp dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install aiohttp>=3.7.4
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show aiohttp
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2021-21330, inspect your installed packages using pip:
pip show aiohttp
Analyze the terminal output to locate any version of Aiohttp in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.7.4), your application is affected.
Note: The pip show aiohttp command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-601: URL Redirection to Untrusted Site ('Open Redirect'), where the web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect. In Aiohttp, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2021-21330 Affected Aiohttp Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
aiohttp
|
PyPI |
< 3.7.4
|
3.7.4
|
References
Frequently Asked Questions
What is CVE-2021-21330?
Which Aiohttp versions are affected?
What version fixes CVE-2021-21330?
Is aiohttp affected?
What is the CVSS score of CVE-2021-21330?
What CWE is associated with CVE-2021-21330?
How can I check PyPI dependencies for CVE-2021-21330?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-v6wp-4m6f-gcjg",
"modified" : "2024-09-03T21:02:49Z",
"published" : "2021-02-26T02:11:57Z",
"aliases" : [ "CVE-2021-21330" ],
"summary" : "`aiohttp` Open Redirect vulnerability (`normalize_path_middleware` middleware)",
"details" : "### Impact\n\nOpen redirect vulnerability — a maliciously crafted link to an aiohttp-based web-server could redirect the browser to a different website.\n\nIt is caused by a bug in the `aiohttp.web_middlewares.normalize_path_middleware` middleware.\n\n### Patches\n\nThis security problem has been fixed in v3.7.4. Upgrade your dependency as follows:\n[`pip install aiohttp >= 3.7.4`]\n\n### Workarounds\n\nIf upgrading is not an option for you, a workaround can be to avoid using `aiohttp.web_middlewares.normalize_path_middleware` in your applications.\n\n### References\n\n* [aiohttp @ PyPI]\n* [GHSA-v6wp-4m6f-gcjg]\n* [OWASP page on open redirects]\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n* Open an issue in the [aiohttp repo](https://github.com/aio-libs/aiohttp/issues/new/choose)\n* Email us at wk+aio-libs-security@sydorenko.org.ua and/or andrew.svetlov+aio-libs-security@gmail.com\n\nCredit: [Jelmer Vernooij] and [Beast Glatisant].\n\n[aiohttp @ PyPI]: https://pypi.org/p/aiohttp\n[`pip install aiohttp >= 3.7.4`]: https://pypi.org/project/aiohttp/3.7.4/\n[GHSA-v6wp-4m6f-gcjg]: https://github.com/aio-libs/aiohttp/security/advisories/GHSA-v6wp-4m6f-gcjg\n[OWASP page on open redirects]:\nhttps://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html\n\n[Jelmer Vernooij]: https://jelmer.uk\n[Beast Glatisant]: https://github.com/g147",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:L/A:N"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "aiohttp"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.7.4"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/aio-libs/aiohttp/security/advisories/GHSA-v6wp-4m6f-gcjg"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-21330"
}, {
"type" : "WEB",
"url" : "https://github.com/aio-libs/aiohttp/commit/2545222a3853e31ace15d87ae0e2effb7da0c96b"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/aio-libs/aiohttp"
}, {
"type" : "WEB",
"url" : "https://github.com/aio-libs/aiohttp/blob/master/CHANGES.rst#374-2021-02-25"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/aiohttp/PYSEC-2021-76.yaml"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/FU7ENI54JNEK3PHEFGCE46DGMFNTVU6L"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/JN3V7CZJRT4QFCVXB6LDPCJH7NAOFCA5"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/FU7ENI54JNEK3PHEFGCE46DGMFNTVU6L"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/JN3V7CZJRT4QFCVXB6LDPCJH7NAOFCA5"
}, {
"type" : "WEB",
"url" : "https://pypi.org/project/aiohttp"
}, {
"type" : "WEB",
"url" : "https://security.gentoo.org/glsa/202208-19"
}, {
"type" : "WEB",
"url" : "https://www.debian.org/security/2021/dsa-4864"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-601" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2021-02-26T02:11:40Z",
"nvd_published_at" : "2021-02-26T03:15:00Z"
}
}