Unintended leak of Proxy-Authorization header in requestsGHSA-j8r2-6x86-q33q
MEDIUMFix: psf/requests@74ea7cfGHSA-j8r2-6x86-q33q is a medium-severity (CVSS 6.1) Information Exposure vulnerability in requests. 2 public exploit references exist, so weaponization risk is real. A fix is available for requests — see the affected versions and patch details below.
Exploitation Status
No confirmed exploitation observed yet
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for GHSA-j8r2-6x86-q33q.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
GHSA-j8r2-6x86-q33q by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.
Where this sits among everything scored
Of 394,803 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.
Real-World Exposure
requestsReal-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
Since Requests v2.3.0, Requests has been vulnerable to potentially leaking Proxy-Authorization headers to destination servers, specifically during redirects to an HTTPS origin. This is a product of how rebuild_proxies is used to recompute and reattach the Proxy-Authorization header to requests when redirected. Note this behavior has only been observed to affect proxied requests when credentials are supplied in the URL user information component (e.g. https://username:password@proxy:8080).
Current vulnerable behavior(s):
- HTTP → HTTPS: leak
- HTTPS → HTTP: no leak
- HTTPS → HTTPS: leak
- HTTP → HTTP: no leak
For HTTP connections sent through the proxy, the proxy will identify the header in the request itself and remove it prior to forwarding to the destination server. However when sent over HTTPS, the Proxy-Authorization header must be sent in the CONNECT request as the proxy has no visibility into further tunneled requests. This results in Requests forwarding the header to the destination server unintentionally, allowing a malicious actor to potentially exfiltrate those credentials.
The reason this currently works for HTTPS connections in Requests is the Proxy-Authorization header is also handled by urllib3 with our usage of the ProxyManager in adapters.py with proxy_manager_for. This will compute the required proxy headers in proxy_headers and pass them to the Proxy Manager, avoiding attaching them directly to the Request object. This will be our preferred option going forward for default usage.
Patches
Starting in Requests v2.31.0, Requests will no longer attach this header to redirects with an HTTPS destination. This should have no negative impacts on the default behavior of the library as the proxy credentials are already properly being handled by urllib3's ProxyManager.
For users with custom adapters, this may be potentially breaking if you were already working around this behavior. The previous functionality of rebuild_proxies doesn't make sense in any case, so we would encourage any users impacted to migrate any handling of Proxy-Authorization directly into their custom adapter.
Workarounds
For users who are not able to update Requests immediately, there is one potential workaround.
You may disable redirects by setting allow_redirects to False on all calls through Requests top-level APIs. Note that if you're currently relying on redirect behaviors, you will need to capture the 3xx response codes and ensure a new request is made to the redirect destination.
import requests
r = requests.get('http://github.com/', allow_redirects=False)
Credits
This vulnerability was discovered and disclosed by the following individuals.
Dennis Brinkrolf, Haxolot (https://haxolot.com/) Tobias Funke, ([email protected])
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | requests | ≥ 2.3.0&&< 2.31.0 | 2.31.0pip install --upgrade 'requests==2.31.0' |
Affected Products
fedorafedoraprojectrequestspythonResearch use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for requests, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update requests to 2.31.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-j8r2-6x86-q33q is resolved across your whole dependency graph.
Workarounds
Assume what was exposed is already known: rotate any credential, token or key that the affected component could return, restrict the endpoint to callers that genuinely need it, and strip sensitive fields from responses and error output at the boundary rather than relying on the client not to read them.
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.
For users who are not able to update Requests immediately, there is one potential workaround. You may disable redirects by setting allow_redirects to False on all calls through Requests top-level APIs. Note that if you are currently relying on redirect behaviors, you will need to capture the 3xx response codes and ensure a new request is made to the redirect destination. import requests r = requests.get('http://github.com/', allow_redirects=False)Source: Red Hat security advisory for GHSA-j8r2-6x86-q33q (CC BY 4.0)
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat Ansible Automation Platform 2.4 for RHEL 8 | python3x-requests-0:2.31.0-1.el8ap | RHSA-2023:4693 |
| Red Hat Enterprise Linux 8 | python39:3.9-8090020230922213827.7484f1d1 | RHSA-2023:7034 |
| Red Hat Enterprise Linux 8 | python27:2.7-8090020231003120724.449e760b | RHSA-2023:7042 |
| Red Hat Enterprise Linux 8 | python38:3.8-8090020230810143931.d9f72c26 | RHSA-2023:7050 |
| Red Hat Enterprise Linux 8 | python-requests-0:2.20.0-3.el8_8 | RHSA-2023:4520 |
| Red Hat Enterprise Linux 8.6 Extended Update Support | python-requests-0:2.20.0-3.el8_6 | RHSA-2024:0299 |
| Red Hat Enterprise Linux 9 | python-requests-0:2.25.1-7.el9_2 | RHSA-2023:4350 |
| Red Hat Satellite 6.14 for RHEL 8 | python-requests-0:2.31.0-1.el8pc | RHSA-2023:6818 |
Frequently Asked Questions
Is GHSA-j8r2-6x86-q33q in your dependencies?
Find it across PyPI, including transitive dependencies.