Given that the actual vulnerability seems relatively niche along with it being such a popular library officially maintained by the Python foundation, the scariest line in the advisory is almost certainly:
The vulnerability was originally reported to the library maintainers on September 12, 2024, but no fix is available.
It's not ideal that requests automatically slurps credentials from ~/.netrc and leaks them, even when my code never references it. It's possible that the netrc is on the same server from a different application, developer debugging environment, or just forgotten about etc.
First one to grab the flag wins, well, nothing. But have fun. I'll keep it online for a couple of weeks, or until the VC money runs out.
Well done for solving it.. but I'd have preferred you had not shared the solution, it's against the spirit of these sorts of things, but I can't stop you. :)
EDIT: I do appreciate you removing the solution. Have a great day.
Another good example of lax URL parsing/parser differentials being problematic.
That being said, I wonder how big the actual impact here is in practice: how many users actually use .netrc? I’ve been using curl and other network tools for well over a decade and I don’t think I’ve ever used .netrc for site credentials.
I think it may be in use by tools without people being aware.
I decided to check my workstation for it just in case, figuring the file would be empty, or not exist.
Instead it seems to be populated with what seem to be Heroku API and git credentials.
Well then go check if you are for some reason using any of the other surprise features [1], like honoring the CURL_CA_BUNDLE env variable, or not honoring the PROXIES env variable if REQUEST_METHOD is set.
Wait till you see the cPython stdlib email parser..
Any programming language these days should ship a decent rfc5234 API in the standard library, so you do not get these kinds of problems in slightly different fashion for each and every library/program.
--no-netrc
Do not try to obtain credentials from .netrc file. By default .netrc file is searched for credentials in
case none have been passed on command line and authentication is required.
The vulnerability was originally reported to the library maintainers on September 12, 2024, but no fix is available.