Negotiate connection reuse with wrong credentials when using CURLAUTH_ANY
A connection previously authenticated with Negotiate (Kerberos) could be reused by a second handle using CURLAUTH_ANY with different credentials, because the NTLM credential-mismatch path saved the connection without checking the Negotiate state. An attacker could then send requests on a connection authenticated under another user's identity.
Originally disclosed on HackerOne
- Disclosed after 26 days
Summary:
CVE-2026-1965 fixed connection reuse for Negotiate authentication by adding url_match_auth_nego() in url_match_conn() at line 1244 of lib/url.c. When a first handle authenticates via Negotiate (Kerberos) on a connection and that connection returns to the pool, a second handle with different credentials should not reuse it.
When the second handle uses CURLAUTH_NEGOTIATE with different credentials, here is what happens:
url_match_auth_ntlm() at line 1239 returns TRUE (because want_ntlm_http is FALSE), so url_match_conn() does not stop and continues. It reaches url_match_auth_nego() at line 1244. This function compares the credentials at lines 1152-1153, finds they are different, and returns FALSE at line 1154. Back in url_match_conn(), this FALSE causes return FALSE to execute at line 1245. The connection is not saved in m->found. The fix works.
However, when the second handle uses CURLAUTH_ANY (which includes both the NTLM and Negotiate bits ), want_ntlm_http is TRUE. url_match_auth_ntlm() enters its credential-mismatch path at line 1086. It checks conn->http_ntlm_state == NTLMSTATE_NONE at line 1091. On a connection authenticated via Negotiate, this condition is true because NTLM was never used. The function saves the connection in m->found = conn at line 1092, then returns FALSE at line 1093. Back in url_match_conn(), this FALSE causes return FALSE to execute at line 1240. The function url_match_conn() terminates here. url_match_auth_nego() at line 1244 is never called.
After the pool iteration, url_match_result() at line 1267 only tests whether match->found is non-NULL. It is (saved at line 1092). Curl_attach_connection() is called at line 1270. The second handle is attached to the first handle's connection. On this connection, the Negotiate handshake is already completed (GSS_AUTHSUCC). Curl does not generate a new Authorization header (http_negotiate.c:254 sets authp->done = TRUE). The request is sent on a connection already authenticated under the first handle's identity.
The root cause is line 1092: m->found = conn is set when http_ntlm_state == NTLMSTATE_NONE, without checking http_negotiate_state.
Affected version:
The vulnerability was identified by source code analysis of curl 8.20.0-DEV (master branch).
Impact
Same impact as CVE-2026-1965
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 connection-matching code saved the connection in the NTLM credential-mismatch path without verifying that the connection's Negotiate state was also unauthenticated.
Impact
The second handle could send requests on a connection already authenticated under the first handle's identity, giving the same impact as CVE-2026-1965.
What the attacker needed
Curl built with Negotiate support; first handle authenticates via Negotiate; second handle uses CURLAUTH_ANY; different credentials on second handle
How it was found
- A first handle authenticates via Negotiate on a connection, and the connection returns to the pool.
- A second handle with different credentials uses CURLAUTH_ANY, which includes both NTLM and Negotiate bits.
- The NTLM credential-mismatch path sees NTLMSTATE_NONE and saves the connection in m->found.
- url_match_conn() returns early, so the Negotiate credential check is never reached.
- The second handle is attached to the first handle's already-authenticated connection.
- No new Authorization header is generated, and the request is sent under the first handle's identity.
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 reuses a network connection, it must check that the new user is allowed to use the old login. Here, a check for one login type (NTLM) accidentally allowed reuse of a connection logged in with a different type (Negotiate/Kerberos), so a second user could act as the first.
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.