curl · Report #2829063
CVE-2024-11053: netrc + redirect credential leak
How it was found
Summary:
Curl has a logic flaw in the way it processes netrc credentials when performing redirects. The redirect will pass along credentials specified for the original host to the redirection target under certain conditions, resulting in unexpected leak of credentials to the redirect target.
Steps To Reproduce:
- Have two sites
https://aandhttps://b.https://adoes 301 redirect tohttps://b - Have netrc file with the following:
machine a
login alice
password alicespassword
default
login bob
curl -L --netrc-file netrc -v https://a
Credentials bob:alicespassword will be sent to https://b.
Suggested remediation
When parsing netrc file during redirect, if a match is found clear the previous username and password.
Note
This flaw manifests itself if the netrc file matches the redirect target, but the entry omits password or both login & password.
Impact
Unexpected leak of credentials. If the login is specified for the redirect target host in netrc, only the password is leaked, if neither login or password is specified full credentials are leaked.