CVE-2023-43804: `Cookie` HTTP header isn't stripped on cross-origin redirects
Cookie HTTP header isn't stripped on cross-origin redirects
Other sources
urllib3 doesn't treat the Cookie HTTP header special or provide any helpers for managing cookies over HTTP, that is the responsibility of the user. However, it is possible for a user to specify a Cookie header and unknowingly leak information via HTTP redirects to a different origin if that user doesn't disable redirects explicitly.
Users must handle redirects themselves instead of relying on urllib3's automatic redirects to achieve safe processing of the Cookie header, thus we decided to strip the header by default in order to further protect users who aren't using the correct approach.
Affected usages
We believe the number of usages affected by this advisory is low. It requires all of the following to be true to be exploited:
Using an affected version of urllib3 (patched in v1.26.17 and v2.0.6) Using the Cookie header on requests, which is mostly typical for impersonating a browser. Not disabling HTTP redirects Either not using HTTPS or for the origin server to redirect to a malicious origin.
Remediation
Upgrading to at least urllib3 v1.26.17 or v2.0.6 Disabling HTTP redirects using redirects=False when sending requests. Not using the Cookie header.
— GitHub
urllib3 is a user-friendly HTTP client library for Python. urllib3 doesn't treat the Cookie HTTP header special or provide any helpers for managing cookies over HTTP, that is the responsibility of the user. However, it is possible for a user to specify a Cookie header and unknowingly leak information via HTTP redirects to a different origin if that user doesn't disable redirects explicitly. This issue has been patched in urllib3 version 1.26.17 or 2.0.5.
— NVD
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/urllib3to a version that resolves this vulnerability.Fixed in 1.26.17 - Upgrade
Upgrade
pip/urllib3to a version that resolves this vulnerability.Fixed in 2.0.6 - Upgrade
Upgrade
redhat/urllib3to a version that resolves this vulnerability.Fixed in 2.0.6 - Upgrade
Upgrade
redhat/urllib3to a version that resolves this vulnerability.Fixed in 1.26.17 - Upgrade
Upgrade
urllib3to a version that resolves this vulnerability.Fixed in 1.26.17 - Upgrade
Upgrade
urllib3to a version that resolves this vulnerability.Fixed in 2.0.6 - Configuration
When sending requests with a Cookie header, disable urllib3 automatic HTTP redirects by setting redirects=False, and handle redirects yourself to prevent Cookie header leakage to a different origin.
urllib3 redirects = False - Configuration
If you are using urllib3, avoid relying on urllib3 to manage the Cookie header across redirects; do not set the Cookie header on requests, or otherwise ensure redirects are handled safely so Cookie is not sent on cross-origin redirects.
urllib3 Cookie header usage = not set - Compensating control
Ensure requests either do not use HTTPS or that the origin server does not redirect to a different/malicious origin, to prevent cross-origin redirects that could cause Cookie header leakage.
Event History
Frequently Asked Questions
What is the vulnerability ID of this issue?
The vulnerability ID is CVE-2023-43804.
What is the severity of CVE-2023-43804?
The severity of CVE-2023-43804 is medium with a severity value of 5.9.
Which software is affected by CVE-2023-43804?
urllib3 versions up to 1.26.17 and versions up to 2.0.6 are affected by CVE-2023-43804.
How can I fix CVE-2023-43804?
To fix CVE-2023-43804, you should update urllib3 to version 1.26.17 or version 2.0.6.
Where can I find more information about CVE-2023-43804?
You can find more information about CVE-2023-43804 at the following references: [GitHub Advisory](https://github.com/urllib3/urllib3/security/advisories/GHSA-v845-jxx5-vc9f), [GitHub Commit 1](https://github.com/urllib3/urllib3/commit/01220354d389cd05474713f8c982d05c9b17aafb), [GitHub Commit 2](https://github.com/urllib3/urllib3/commit/644124ecd0b6e417c527191f866daa05a5a2056d).