CVE-2024-11053: netrc + redirect credential leak
Curl mishandles netrc credentials during redirects, sending the original host's password (and possibly login) to the redirect target. An attacker controlling the redirect target could receive credentials meant for the original host.
- Triaged in 16 hours
- Fixed in 33 days
- Disclosed after 33 days
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.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, when parsing the netrc file during a redirect, curl does not clear previously loaded credentials if the matching entry for the redirect target omits the password or both login and password.
Impact
Credentials could be leaked to the redirect target; if the netrc entry for the target omits only the password, just the password leaks, but if it omits both login and password, full credentials leak.
What the attacker needed
Curl with netrc support; netrc file with entry for redirect target lacking password; redirect from original host to target host
How it was found
- Set up two sites where the first redirects to the second.
- Create a netrc file with credentials for the first site and a default entry for the second site that lacks a password.
- Run curl with the -L and --netrc-file options against the first site.
- Observe that the credentials from the first site are sent to the second site.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When curl follows a redirect from one website to another, it should not carry over login details meant for the first site. Here, if a netrc file (a file storing login details) has an entry for the second site that lacks a password, curl mistakenly reuses the password from the first site. This means the second site could learn a password it should never see.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.