The vulnerability lies in the get_netrc_auth function within requests.utils.py. This function is responsible for retrieving credentials from a .netrc file for a given URL. The flaw was in how the hostname was extracted from the URL's netloc component. The original code used ri.netloc.split(':')[0], which could be tricked by specially crafted URLs. For instance, if a URL was crafted like http://legitimate_host%40attacker.com/ (where %40 is @), the netloc might be parsed as legitimate_host@attacker.com. The vulnerable code would then attempt to find credentials for legitimate_host@attacker.com in the .netrc file. If such an entry existed (perhaps intended for a different, specific service), its credentials could be fetched and then used for a request to attacker.com, thereby leaking them. The patch corrects this by using ri.hostname, which is a more robust way to get the actual hostname, free of userinfo, port, or other parts of the netloc that could be manipulated. Therefore, requests.utils.get_netrc_auth is the direct vulnerable function as it contained the faulty parsing logic that led to potential credential leakage.