Skip to content

Conversation

danigm
Copy link
Contributor

@danigm danigm commented Jun 4, 2025

This patch uses the "hostname" attribute from the parsed url to get the host, instead of trying to calculate the host from netloc that can produce errors when "http://username:[email protected]" format is used.

This should fix the security issue reported here: CVE-2024-47081: Netrc credential leak in PSF requests library

@sethmlarson
Copy link
Member

@danigm Thanks! The new test is failing on Windows, can you take a peek?

@sigmavirus24
Copy link
Contributor

Can you please rebase as well?

This patch adds a new test that reproduces the security issue reported
here:
https://seclists.org/oss-sec/2025/q2/204

Doing a request to a malicious url with a prefix like "domain.com:@"
will use the "domain.com" netrc credentials in the request to other
domain.
@danigm
Copy link
Contributor Author

danigm commented Jun 5, 2025

I've fixed the windows failure and rebased, so now this patch just adds a new test for netrc because the code fix was added in a different pr: #6965

@danigm danigm changed the title Use hostname for netrc instead split netloc test: Add new test to check netrc auth leak Jun 5, 2025
@Daviey
Copy link

Daviey commented Jun 5, 2025

An example of this vulnerability is available with this intentionally exploitable site, as documented here, https://www.openwall.com/lists/oss-security/2025/06/03/11

@sigmavirus24 sigmavirus24 merged commit 7bc4587 into psf:main Jun 5, 2025
29 checks passed
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.

4 participants