Skip to content
Info disclosure Disclosed report Intermediate CVE-2024-11053

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.

nyymi Follow

Originally disclosed on HackerOne

  • 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:

  1. Have two sites https://a and https://b. https://a does 301 redirect to https://b
  2. Have netrc file with the following:
machine a
  login alice
  password alicespassword

default
  login bob
  1. 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.

The original report as published on HackerOne, by nyymi. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

  1. Set up two sites where the first redirects to the second.
  2. Create a netrc file with credentials for the first site and a default entry for the second site that lacks a password.
  3. Run curl with the -L and --netrc-file options against the first site.
  4. 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.

More by nyymi

View all

51 more disclosed reports, best first.

More from curl

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.