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

netrc and redirect credential leak

When curl used a .netrc file for credentials and followed an HTTP redirect, it could send the password for the original host to the redirect target. This only happened if the netrc file had an entry for the target host that omitted the password or both login and password.

nyymi Follow

Originally disclosed on HackerOne

Bounty$505 Low View original
  • Fixed in 35 days
  • Paid in 35 days
  • Disclosed after 35 days

Summary by the program

netrc and redirect credential leak Project curl Security Advisory, December 11th 2024 - https://curl.se/docs/CVE-2024-11053.html

VULNERABILITY When asked to both use a .netrc file for credentials and to follow HTTP redirects, curl could leak the password used for the first host to the followed-to host under certain circumstances.

This flaw only manifests itself if the netrc file has an entry that matches the redirect target hostname but the entry either omits just the password or omits both login and password.

The report

When asked to both use a .netrc file for credentials and to follow HTTP redirects, curl could leak the password used for the first host to the followed-to host under certain circumstances.

This flaw only manifests itself if the netrc file has an entry that matches the redirect target hostname but the entry either omits just the password or omits both login and password.

Impact

Information disclosure (password sent to the wrong host).

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 3 min read.

Context

curl is a command line tool and library for transferring data with URLs. Two of its features meet in this report: reading credentials from a .netrc file, and following HTTP redirects. Normally, when curl is told to use a netrc file, it looks up the host it is talking to and takes the login and password from the matching entry. When it is told to follow redirects, it re-issues the request against whatever location the server returns.

The bug is that under certain circumstances the password used for the first host could be leaked to the followed-to host. The project published this as CVE-2024-11053 in a curl security advisory dated December 11th 2024, and the report was handled through the Internet Bug Bounty programme against the https://github.com/curl/curl asset.

Setup

The report describes no accounts, roles, tools or versions. The only precondition it states is the shape of the netrc file and the curl options in use: curl must be asked both to use a .netrc file for credentials and to follow HTTP redirects.

The flaw only manifests itself if the netrc file has an entry that matches the redirect target hostname, and that entry either omits just the password or omits both login and password.

Finding it

The report states that the combination of netrc credentials and redirect following could send the first host's password to the second host. That is wrong because credentials are scoped to a host: a password that belongs to host A has no business being presented to host B, even when the netrc file happens to mention host B.

The interesting part is the narrow trigger. It is not enough for the redirect target to be absent from the netrc file. The target must have an entry, and that entry must be incomplete: either a login with no password, or no login and no password at all.

Exploitation

The report does not include any request, response, command or payload, so there is no step-by-step transcript to reproduce. What it does give is the exact set of conditions, which can be read as the recipe for a reproduction:

  1. Configure curl to use a .netrc file for credentials and to follow HTTP redirects.
  2. Put an entry in the netrc file for the first host that includes a password.
  3. Put an entry in the netrc file for the redirect target host that omits just the password, or omits both login and password.
  4. Make curl request the first host, which responds with a redirect to the second host.
  5. curl follows the redirect and, under these conditions, sends the first host's password to the second host.

The report does not state the exact request or response that demonstrates this, nor the curl version affected.

Root cause

The report does not describe the code path or the internal state that carries the password across the redirect. What it establishes is the observable behaviour: when the netrc lookup for the redirect target yields an entry that is missing a password (or missing both fields), the password already used for the first host is reused for the followed-to host instead of being dropped.

Why the existing defences did not stop it is not discussed in the report.

Impact

The impact is information disclosure: a password is sent to the wrong host. The report keeps this hedged, and the hedge matters. The leak requires all of the following at once:

  • curl is asked to use a .netrc file for credentials.
  • curl is asked to follow HTTP redirects.
  • the netrc file has an entry matching the redirect target hostname.
  • that entry omits just the password, or omits both login and password.

Fix

The advisory it points to is the curl security advisory for CVE-2024-11053, published December 11th 2024.

Variants to test

  1. A netrc entry for the redirect target with a login but no password. A positive result is the first host's password arriving at the target.
  2. A netrc entry for the redirect target with neither login nor password. A positive result is the same leak, showing that an empty entry is enough to trigger the fallback.

Hunting notes

To show impact, the report relies on the precise precondition, an incomplete netrc entry for the redirect target, which is what turns a general concern about redirects into a reproducible leak of a specific password to a specific host.

The report was rated low severity and paid a bounty of 505.00 USD.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 8 min read.

What happened, in plain words

curl is a small program that fetches things from the internet, usually from a command line. You give it a web address and it goes and gets the page, the file or whatever else lives there. It is also a library, meaning other programs can borrow its fetching machinery instead of writing their own.

Two of curl's features meet in this report. The first is reading credentials from a .netrc file. A netrc file is a plain text file kept on your computer that stores logins and passwords for different servers, so you do not have to type them every time. The second is following HTTP redirects. A redirect is what happens when you ask a website for a page and the website answers "not here, look over there" and gives you a new address. Browsers follow redirects automatically, and so can curl when you ask it to.

The bug is that, under certain circumstances, curl could take the password it used for the first host and send it to the second host it was redirected to. A password that belongs to one server has no business being presented to another server. The curl project published this as CVE-2024-11053 in a security advisory dated December 11th 2024. The report was handled through the Internet Bug Bounty programme against the https://github.com/curl/curl asset, which is the curl source code repository.

Context

curl is a command line tool and library for transferring data with URLs. Think of it as a courier: you hand it an address, it goes there, and it brings back what it finds. Because it is also a library, many other programs use it under the hood, so a flaw in curl can affect far more than people typing curl into a terminal.

Two of its features meet in this report:

  • Reading credentials from a .netrc file. A netrc file is a small text file on your machine that lists, per server, the login name and password to use. It saves you from typing secrets repeatedly. When curl is told to use a netrc file, it looks up the host it is talking to and takes the login and password from the matching entry.
  • Following HTTP redirects. When a server answers with a redirect, it is telling the client "the thing you want is at this other address". If curl is told to follow redirects, it re-issues the request against whatever location the server returns.

The bug is that under certain circumstances the password used for the first host could be leaked to the followed-to host. The project published this as CVE-2024-11053 in a curl security advisory dated December 11th 2024, and the report was handled through the Internet Bug Bounty programme against the https://github.com/curl/curl asset.

Setup

The report describes no accounts, roles, tools or versions. The only precondition it states is the shape of the netrc file and the curl options in use: curl must be asked both to use a .netrc file for credentials and to follow HTTP redirects.

The flaw only manifests itself if the netrc file has an entry that matches the redirect target hostname, and that entry either omits just the password or omits both login and password.

In everyday terms: you need a netrc file that mentions both servers. The first server's entry is complete, with a password. The second server's entry is incomplete, either a username with no password, or nothing at all. Only then does the leak happen.

Finding it

The report states that the combination of netrc credentials and redirect following could send the first host's password to the second host. That is wrong because credentials are scoped to a host: a password that belongs to host A has no business being presented to host B, even when the netrc file happens to mention host B.

The interesting part is the narrow trigger. It is not enough for the redirect target to be absent from the netrc file. The target must have an entry, and that entry must be incomplete: either a login with no password, or no login and no password at all.

Exploitation

The report does not include any request, response, command or payload, so there is no step-by-step transcript to reproduce. What it does give is the exact set of conditions, which can be read as the recipe for a reproduction:

  1. Configure curl to use a .netrc file for credentials and to follow HTTP redirects.
  2. Put an entry in the netrc file for the first host that includes a password.
  3. Put an entry in the netrc file for the redirect target host that omits just the password, or omits both login and password.
  4. Make curl request the first host, which responds with a redirect to the second host.
  5. curl follows the redirect and, under these conditions, sends the first host's password to the second host.

The report does not state the exact request or response that demonstrates this, nor the curl version affected.

Root cause

The report does not describe the code path or the internal state that carries the password across the redirect. What it establishes is the observable behaviour: when the netrc lookup for the redirect target yields an entry that is missing a password (or missing both fields), the password already used for the first host is reused for the followed-to host instead of being dropped.

Why the existing defences did not stop it is not discussed in the report.

Impact

The impact is information disclosure: a password is sent to the wrong host. Information disclosure simply means that data which should have stayed private ends up somewhere it should not be. Here the data is a password, and the wrong place is a server that was never meant to see it.

The report keeps this hedged, and the hedge matters. The leak requires all of the following at once:

  • curl is asked to use a .netrc file for credentials.
  • curl is asked to follow HTTP redirects.
  • the netrc file has an entry matching the redirect target hostname.
  • that entry omits just the password, or omits both login and password.

Fix

The advisory it points to is the curl security advisory for CVE-2024-11053, published December 11th 2024.

Variants to test

  1. A netrc entry for the redirect target with a login but no password. A positive result is the first host's password arriving at the target.
  2. A netrc entry for the redirect target with neither login nor password. A positive result is the same leak, showing that an empty entry is enough to trigger the fallback.

Hunting notes

A credential helper is a small program that supplies stored logins on demand, and proxy authentication is the login a client gives to an intermediary server that forwards its traffic. All of these answer the same question, "which secret belongs to which host", and that is exactly where mistakes happen.

Recon here means the early survey work of looking for software that has the right features before testing anything. To show impact, the report relies on the precise precondition, an incomplete netrc entry for the redirect target, which is what turns a general concern about redirects into a reproducible leak of a specific password to a specific host.

The report was rated low severity and paid a bounty of 505.00 USD.

Glossary

  • curl: a command line tool and library for transferring data with URLs.
  • Library: reusable code that other programs can call instead of writing the same functionality themselves.
  • URL: the address of something on the internet, such as a web page or a file.
  • Host: the server named in a URL, the part that identifies which machine you are talking to.
  • Credentials: the login name and password used to prove who you are to a server.
  • .netrc file: a plain text file on your computer that stores logins and passwords per host, so they do not have to be typed each time.
  • netrc entry: one host's record inside a netrc file, normally holding a login and a password.
  • HTTP redirect: a server response that points the client to a different address to fetch the requested thing from.
  • Following redirects: a client option that makes it automatically re-issue the request against the address given in a redirect.
  • Re-issue a request: send the same kind of request again, this time to a different address.
  • CVE: a public identifier for a known security vulnerability, here CVE-2024-11053.
  • Security advisory: a published notice from a software project describing a vulnerability and its fix.
  • Internet Bug Bounty: the programme through which this report was handled and rewarded.
  • Asset: the specific piece of software or infrastructure a report is filed against, here the curl source code repository.
  • Information disclosure: a weakness where data that should stay private is exposed to someone who should not see it.
  • Password leak: a password reaching a party or system it was never intended for.
  • Scoped credentials: credentials that are valid only for one specific host and should never be sent to another.
  • Fallback: using a previous or default value when the expected one is missing.
  • Root cause: the underlying reason a bug happens, as opposed to its visible symptom.
  • Reproduction: the exact steps and conditions needed to make a bug happen again.
  • Payload: the part of a request crafted to trigger a specific behaviour.
  • Redirect chain: two or more redirects in sequence, where each server points to the next.
  • Credential helper: a program that supplies stored credentials to a client on demand.
  • Proxy authentication: the login a client presents to an intermediary server that forwards its traffic.
  • Recon: the early survey of software and features to decide what is worth testing.
  • Severity: a rating of how serious a vulnerability is, here low.
  • Bounty: a reward paid by a bug bounty programme for a valid report.

More by nyymi

View all

51 more disclosed reports, best first.

More from Internet Bug Bounty

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.