GHSA-g4mx-q9vg-27p4 CVE-2023-45803 PYSEC-2023-212
urllib3's request body not stripped after redirect from 303 status changes request method to GET
- Severity
- 5.7 / 10
- Medium · CVSS 4.0
- Exploit chance (EPSS)
- 0.59%
- Chance of exploitation in the next 30 days. Higher than 48.36% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-200 Exposure of Sensitive Information to an Unauthorized Actor
- Fix
2.0.7- Upgrade urllib3 to this version or later
Description
urllib3 previously wouldn't remove the HTTP request body when an HTTP redirect response using status 303 "See Other" after the request had its method changed from one that could accept a request body (like POST) to GET as is required by HTTP RFCs. Although the behavior of removing the request body is not specified in the section for redirects, it can be inferred by piecing together information from different sections and we have observed the behavior in other major HTTP client implementations like curl and web browsers.
From RFC 9110 Section 9.3.1:
A client SHOULD NOT generate content in a GET request unless it is made directly to an origin server that has previously indicated, in or out of band, that such a request has a purpose and will be adequately supported.
Affected usages
Because the vulnerability requires a previously trusted service to become compromised in order to have an impact on confidentiality we believe the exploitability of this vulnerability is low. Additionally, many users aren't putting sensitive data in HTTP request bodies, if this is the case then this vulnerability isn't exploitable.
Both of the following conditions must be true to be affected by this vulnerability:
- If you're using urllib3 and submitting sensitive information in the HTTP request body (such as form data or JSON)
- The origin service is compromised and starts redirecting using 303 to a malicious peer or the redirected-to service becomes compromised.
Remediation
You can remediate this vulnerability with any of the following steps:
- Upgrade to a patched version of urllib3 (v1.26.18 or v2.0.7)
- Disable redirects for services that you aren't expecting to respond with redirects with
redirects=False. - Disable automatic redirects with
redirects=Falseand handle 303 redirects manually by stripping the HTTP request body.
Affected versions
PyPI
| Package | Vulnerable | Fixed in |
|---|---|---|
| urllib3 | >= 2.0.0, < 2.0.7 |
2.0.7 |
| urllib3 | < 1.26.18 |
1.26.18 |
| urllib3 | >= 2.0.0, < 2.0.7 |
2.0.7 |
| urllib3 | < 1.26.18 |
1.26.18 |
| urllib3 | >= 2.0.0, < 2.0.7< 1.26.18 |
1.26.182.0.7 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
urllib3 PyPI → 2.0.7
- pip
pip install --upgrade "urllib3>=2.0.7"- poetry
poetry add "urllib3>=2.0.7"- uv
uv add "urllib3>=2.0.7"
Severity breakdown
CVSS 4.0 5.7
CVSS:4.0/AV:A/AC:L/AT:P/PR:H/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
- Attack vector
- Adjacent
- Attack complexity
- Low
- Attack requirements
- Present
- Privileges required
- High
- User interaction
- None
- Confidentiality (vulnerable system)
- High
- Integrity (vulnerable system)
- None
- Availability (vulnerable system)
- None
- Confidentiality (subsequent systems)
- None
- Integrity (subsequent systems)
- None
- Availability (subsequent systems)
- None
CVSS 3.1 4.2
CVSS:3.1/AV:A/AC:H/PR:H/UI:N/S:U/C:H/I:N/A:N
- Attack vector
- Adjacent
- Attack complexity
- High
- Privileges required
- High
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- None
- Availability
- None
Weakness
CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
How to prevent it
- Architecture and Design: Compartmentalize the system to have "safe" areas where trust boundaries can be unambiguously drawn. Do not allow sensitive data to go outside of the trust boundary and always be careful when interfacing with a compartment outside of the safe area. Ensure that appropriate compartmentalization is built into the system design, and the compartmentalization allows for and reinforces privilege separation functionality. Architects and designers should rely on the principle of least privilege to decide the appropriate time to use privileges and the time to drop privileges.
References
Advisories
Fixes and patches
Write-ups
Packages
Other links
- github.com/urllib3/urllib3/releases/tag/1.26.18
- github.com/urllib3/urllib3/releases/tag/2.0.7
- rfc-editor.org/rfc/rfc9110.html
- github.com/pypa/advisory-database/tree/main/vulns/urllib3/PYSEC-2023-212.yaml
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/4R2Y5…
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/5F5CU…
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/PPDPL…
- lists.debian.org/debian-lts-announce/2024/12/msg00020.html
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/4R2Y5…
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/5F5CU…
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-vxq7-64xx-v4gw urllib3: HTTPResponse.stream()/read_chunked() buffers an unbounded chunk-size line into memory | High | Also affects urllib3 |
| GHSA-gh4c-6fx4-qh6g urllib3: Chunked Deflate streaming can enter an infinite loop | Medium | Also affects urllib3 |
| GHSA-8988-9cw3-xx77 urllib3: HTTPS proxy TLS configuration may be ignored or overridden | High | Also affects urllib3 |
| GHSA-mf9v-mfxr-j63j urllib3: Decompression-bomb safeguards bypassed in parts of the streaming API | High | Also affects urllib3 |
| GHSA-qccp-gfcp-xxvc urllib3: Sensitive headers forwarded across origins in proxied low-level redirects | High | Also affects urllib3 |
| GHSA-38jv-5279-wg99 Decompression-bomb safeguards bypassed when following HTTP redirects (streaming API) | High | Also affects urllib3 |
| GHSA-2xpw-w6gg-jr37 urllib3 streaming API improperly handles highly compressed data | High | Also affects urllib3 |
| GHSA-gm62-xv2j-4w53 urllib3 allows an unbounded number of links in the decompression chain | High | Also affects urllib3 |
Credits: Hacked36, illia-v, ranjit-git, sethmlarson
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor