Vulnerabilities in pkg:pypi/httpx
PACKAGECVE-2021-41945 is a CRITICAL (CVSS 9.1) improper input validation vulnerability (CWE-20: Improper Input Validation) affecting Httpx libraries in the PyPI ecosystem. The issue involves improper input validation in httpx. Remediation is available by upgrading affected packages to version 0.23.0.
pkg:pypi/httpx
Vulnerability advisories affecting package pkg:pypi/httpx. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-h8pj-cxx2-jfg2 | CVE-2021-41945 | CRITICAL | Improper Input Validation in httpx |
CVE-2021-41945 at a Glance
Security Impact
CVSS: 9.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N).
How to Fix CVE-2021-41945
To remediate this vulnerability, upgrade all affected Httpx 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 httpx>=0.23.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show httpx
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2021-41945, inspect your installed packages using pip:
pip show httpx
Analyze the terminal output to locate any version of Httpx in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.23.0), your application is affected.
Note: The pip show httpx command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Httpx, 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-41945 Affected Httpx Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
httpx
|
PyPI |
< 0.23.0
|
0.23.0
|
References
Frequently Asked Questions
What is CVE-2021-41945?
Which Httpx versions are affected?
What version fixes CVE-2021-41945?
Is httpx affected?
What is the CVSS score of CVE-2021-41945?
What CWE is associated with CVE-2021-41945?
How can I check PyPI dependencies for CVE-2021-41945?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-h8pj-cxx2-jfg2",
"modified" : "2024-09-23T16:58:10Z",
"published" : "2022-04-29T00:00:25Z",
"aliases" : [ "CVE-2021-41945" ],
"summary" : "Improper Input Validation in httpx",
"details" : "Encode OSS httpx <=1.0.0.beta0 is affected by improper input validation in `httpx.URL`, `httpx.Client` and some functions using `httpx.URL.copy_with`.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "httpx"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.23.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-41945"
}, {
"type" : "WEB",
"url" : "https://github.com/encode/httpx/issues/2184"
}, {
"type" : "WEB",
"url" : "https://github.com/encode/httpx/pull/2185"
}, {
"type" : "WEB",
"url" : "https://github.com/encode/httpx/pull/2185/commits/e3c495a32c63d8aa7f1bcf3b7b27ee1a0ff428e1"
}, {
"type" : "WEB",
"url" : "https://github.com/encode/httpx/commit/e9b0c85dd4f4e4469c57c4b38e5101fd12081b5c"
}, {
"type" : "WEB",
"url" : "https://gist.github.com/lebr0nli/4edb76bbd3b5ff993cf44f2fbce5e571"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-h8pj-cxx2-jfg2"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/encode/httpx"
}, {
"type" : "WEB",
"url" : "https://github.com/encode/httpx/discussions/1831"
}, {
"type" : "WEB",
"url" : "https://github.com/encode/httpx/releases/tag/0.23.0"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/httpx/PYSEC-2022-183.yaml"
}, {
"type" : "WEB",
"url" : "http://encode.com"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-20" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2022-04-29T22:55:38Z",
"nvd_published_at" : "2022-04-28T14:15:00Z"
}
}