Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. requests
  4. ›
  5. CVE-2023-32681

CVE-2023-32681: Unintended leak of Proxy-Authorization header in requests

May 22, 2023 (updated February 13, 2025)

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):

  1. HTTP → HTTPS: leak
  2. HTTPS → HTTP: no leak
  3. HTTPS → HTTPS: leak
  4. 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.

References

  • github.com/advisories/GHSA-j8r2-6x86-q33q
  • github.com/psf/requests
  • github.com/psf/requests/commit/74ea7cf7a6a27a4eeb2ae24e162bcc942a6706d5
  • github.com/psf/requests/releases/tag/v2.31.0
  • github.com/psf/requests/security/advisories/GHSA-j8r2-6x86-q33q
  • github.com/pypa/advisory-database/tree/main/vulns/requests/PYSEC-2023-74.yaml
  • lists.debian.org/debian-lts-announce/2023/06/msg00018.html
  • lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/AW7HNFGYP44RT3DUDQXG2QT3OEV2PJ7Y
  • lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/KOYASTZDGQG2BWLSNBPL3TQRL2G7QYNZ
  • nvd.nist.gov/vuln/detail/CVE-2023-32681
  • security.gentoo.org/glsa/202309-08

Code Behaviors & Features

Detect and mitigate CVE-2023-32681 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 2.3.0 before 2.31.0

Fixed versions

  • 2.31.0

Solution

Upgrade to version 2.31.0 or above.

Impact 6.1 MEDIUM

CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:N/A:N

Learn more about CVSS

Weakness

  • CWE-200: Exposure of Sensitive Information to an Unauthorized Actor

Source file

pypi/requests/CVE-2023-32681.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:14:50 +0000.