Skip to content

Fix potential vulnerability in cloned function#12

Open
navnitan-7 wants to merge 1 commit intoring04h:masterfrom
navnitan-7:fix/CVE-2018-18074
Open

Fix potential vulnerability in cloned function#12
navnitan-7 wants to merge 1 commit intoring04h:masterfrom
navnitan-7:fix/CVE-2018-18074

Conversation

@navnitan-7
Copy link
Copy Markdown

@navnitan-7 navnitan-7 commented Mar 30, 2026

Summary

This PR fixes a potential security vulnerability in rebuild_auth() in libs/requests/sessions.py that was cloned from python-requests but did not receive the security patch for CVE-2018-18074.

Details

Affected Function: rebuild_auth() in libs/requests/sessions.py
Original Fix: requests/requests@be32cb8

Changes

Added a scheme-downgrade check so the Authorization header is stripped not only when the redirect target is a different host, but also when the redirect downgrades from HTTPS to HTTP. Previously, credentials could leak in plaintext when a server redirected an HTTPS request to an HTTP endpoint on the same host.

Impact

Without this fix, an attacker controlling a redirect target could force a scheme downgrade to capture the Authorization header over an unencrypted connection.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant