# GHSA-5R6F-M46C-MPHM: Proxy-Authorization header not stripped on cross-origin redirects leaks proxy credentials

- Database: GitHub
- Severity: CVSS 3.7 (Low)
- Published: 2026-12-04
- Modified: 2026-12-04

## Tracked as

- [CVE-2026-140868](https://cve.now/CVE-2026-140868.md): httpx2 proxy credential leak on cross-origin redirects

## Affected versions

- httpx2 (PyPI): fixed in 2.18.0

## Description

### Summary

When following a redirect to a different origin, `BaseClient._redirect_headers()` strips `Authorization` and `Cookie` from the outgoing request, but leaves `Proxy-Authorization` in place. A client that carries `Proxy-Authorization` in its client or request `headers` forwards that credential to the redirect target.

### Details

When `follow_redirects=True`, `BaseClient._redirect_headers()` copies all headers from the previous request onto the redirect request. When `url.origin != request.url.origin`, it pops `Authorization` (outside same-host HTTP-to-HTTPS upgrades) and unconditionally pops `Cookie` before rebuilding cookies from the jar, but never removes `Proxy-Authorization` - even though `httpx2` already classifies `proxy-authorization` in `SENSITIVE_HEADERS`.

Proxy credentials configured through the documented `proxy="http://user:pass@host"` parameter are not affected: `httpcore2` stores those credentials in connection-level proxy headers and never adds them to `request.headers`. A manually set `Proxy-Authorization` header already reaches every origin contacted without a forward proxy, so redirects add exposure specifically when the initial request traverses a forward proxy that consumes the header and the redirect target is reached without that proxy (for example, an `http://` request routed through an HTTP proxy redirecting to an unproxied `https://` target).

### Impact

An attacker who controls an HTTP response that redirects the client (the contacted origin, or an on-path attacker on plain HTTP) can capture the proxy credential.

An application is affected when all of the following hold:

* `follow_redirects=True` is enabled (the default is `False`).
* `Proxy-Authorization` is passed manually in client or request `headers` rather than via `proxy=`.
* The redirect target is not routed through the same forward proxy that stripped `Proxy-Authorization` on the initial request.

Because the documented proxy authentication API is unaffected and all three conditions are required, realistic exposure is narrow. This is the same class of issue as CVE-2024-37891 in `urllib3` and CVE-2025-4673 in Go's `net/http`.

### Mitigation

Upgrade to `httpx2` `2.18.0` or later, which strips `Proxy-Authorization` whenever a redirect changes origin (including same-host HTTP-to-HTTPS upgrades).

If upgrading is not immediately possible, configure proxy credentials via `proxy="http://user:pass@host"` instead of passing `Proxy-Authorization` in `headers`, or leave `follow_redirects=False`.

## References

- https://github.com/pydantic/httpx2/security/advisories/GHSA-5r6f-m46c-mphm

Page: https://cve.now/GHSA-5R6F-M46C-MPHM

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
