Windows SSPI connection-pool probe can reuse a connection under the wrong user
A connection pool health probe in curl can set a connection ID that is later reused by a different transfer, causing a Windows SSPI-authenticated connection to be reused under the wrong user. An attacker could potentially access data or perform actions authorised for another user.
- Disclosed after 2 months
Summary: A fresh transfer can reuse a keep-alive connection authenticated under another Windows user because the SSPI isolation check trusts a connection ID that a health probe can set.
Root cause: Curl_cpool_conn_seems_healthy() calls Curl_attach_connection(), which sets data->state.recent_conn_id, while Curl_detach_connection() does not restore it before url_allow_sspi_empty_creds() checks that value.
Steps to reproduce:
(1) build this checkout with temporary prints around Curl_cpool_prune_dead() and Curl_attach_connection(); (2) run a local HTTP server returning 200 OK with Connection: keep-alive; (3) request it with transfer A on a CURLM, then remove A but keep the multi handle; (4) wait 1200 ms; (5) request it with fresh transfer B and observe B rcid=-1, probe attach id=0, B rcid=0, then Reusing existing http.
Suggested fix: Save and restore recent_conn_id around transient probes, or make Curl_attach_connection() skip that update for probes, then add a regression test
Impact
B’s ID changes before B sends any bytes, so on Windows a connection negotiated under token A can carry B’s request as A and expose A-only data or perform an A-authorized action.
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 health check calls Curl_attach_connection() which updates data->state.recent_conn_id, but Curl_detach_connection() does not restore it, so a later SSPI credential check uses the wrong connection ID.
Impact
On Windows, a connection negotiated under token A can carry B’s request as A, potentially exposing A-only data or performing an A-authorized action.
What the attacker needed
Windows SSPI authentication; Multiple transfers on same multi handle; Keep-alive connection reuse
The fix
Save and restore recent_conn_id around transient probes, or make Curl_attach_connection() skip that update for probes, then add a regression test.
How it was found
- Build the checkout with temporary prints around Curl_cpool_prune_dead() and Curl_attach_connection().
- Run a local HTTP server that returns 200 OK with Connection: keep-alive.
- Request it with transfer A on a CURLM, then remove A but keep the multi handle.
- Wait 1200 ms.
- Request it with fresh transfer B and observe the connection ID changes and reuse.
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 an existing network connection, it must ensure the connection belongs to the same user. Here, a background check accidentally changed a record of which connection was last used, so a later request from a different user could be sent over the first user's authenticated connection. This could let one user see or do things meant only for another user.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.