Sep 17, 2026·8 min read·113 visits
A session reuse vulnerability in libcurl allows requests with blank Negotiate credentials to hijack previously authenticated connections of other users, bypassing server-side authentication controls entirely.
A critical connection reuse vulnerability exists in curl and libcurl between versions 7.64.1 and 8.21.0 inclusive when Negotiate authentication (SPNEGO) is configured with blank credentials. Because libcurl fails to track changes to the underlying operating system's ambient security context, persistent authenticated connections are incorrectly matched and shared between distinct user sessions, allowing subsequent users to execute requests with the authorization state of the prior user.
The vulnerability CVE-2026-19931 represents a structural flaw in how libcurl maintains and evaluates cached persistent connections authenticated via the Negotiate (SPNEGO) protocol. Under normal operational parameters, libcurl attempts to optimize network efficiency by retaining authenticated connections in an internal connection pool (cpool). When a application initiates a new HTTP request, libcurl inspects this pool to determine if an existing connection to the same endpoint can be safely reused.
This reuse logic depends on matching not only transport parameters like hostnames, ports, and protocols, but also security credentials. If a cached connection is authenticated under User A's identity, libcurl must reject matches for requests issued by User B. However, when Negotiate authentication is initiated with empty or blank credentials (signified by CURLOPT_USERPWD set to ":"), libcurl delegates the authentication challenge to the host operating system's ambient security provider, such as the Security Support Provider Interface (SSPI) on Windows or GSSAPI libraries on Unix-like platforms.
Because libcurl does not actively monitor changes to the ambient security context of the system or the active thread executing the request, it operates under the flawed assumption that all empty-credential requests originate from the same user context. This creates an attack surface in multi-threaded, impersonated, or multi-user applications where the calling security context changes dynamically. In these scenarios, a connection established by a highly privileged user can be matched and reused by a subsequent unprivileged user whose request is routed over the existing, pre-authenticated socket.
To trace the root cause of CVE-2026-19931, it is necessary to examine the evolution of Negotiate connection handling in libcurl. The flaw was introduced in commit 6c6035532383e300c712e4c1cd9fdd749ed5cf59, which decoupled the Negotiate authentication state (negotiatedata) from the transfer-specific structure (UrlState) and attached it directly to the connection-bound structure (connectdata). Prior to this commit, libcurl terminated the underlying TCP connection as soon as a Negotiate-authenticated transfer was complete, neutralizing any possibility of accidental reuse.
The migration of negotiatedata allowed libcurl to preserve established Negotiate TCP connections in the pool. When validating cached connections for potential reuse, libcurl utilizes the internal function url_match_auth_nego(). This function verifies that the authentication configuration of the active request aligns with that of the cached connection. However, the logic contained an explicit bypass: if conn->creds (representing the cached credentials) was evaluated as NULL, the function skipped any rigorous credential comparison, assuming that both connections used the identical, static ambient user context.
In multi-user systems or server-side application environments executing thread-level impersonation, this assumption is false. On Windows platforms, threads may dynamically impersonate distinct security principles via APIs like ImpersonateLoggedOnUser(). Similarly, Unix systems using GSSAPI may swap Kerberos credential caches (indicated by the KRB5CCNAME environment variable) between operations. Because the libcurl engine is blind to these external operating system-level state transitions, it incorrectly considers any two requests utilizing "blank credentials" as structurally equivalent. When User B issues a request to the same target host, the caching engine identifies the host match, evaluates conn->creds == NULL, ignores the identity divergence, and assigns User B's transfer to the socket authenticated as User A.
The remediation of this flaw was committed by Stefan Eissing in commit 7103a93b05bc69ea98ed9d05d02fa9eeba533f2f. The security patch addresses an architectural error in how libcurl handles connection management. Previously, connection maintenance tasks (such as connection pool upkeep, liveliness checks, and eviction strategies) were executed directly on the application handle (data) supplied by the calling thread. This pattern caused the application handle to temporarily bind to connections it was not actively utilizing, altering the state trackers and breaking the validation logic of data->state.recent_conn_id.
By running maintenance routines on the calling transfer handle, libcurl created a race and corruption scenario in connection matching. The patch introduces a dedicated, internal admin handle exclusively for administrative and maintenance operations, ensuring that user transfers never interact with or pollute the states of inactive cached connections. This separation preserves the integrity of recent_conn_id tracking, ensuring that connections are only eligible for reuse if they perfectly align with the calling user's isolated context.
// Conceptual representation of the fix in connection state binding
// BEFORE THE PATCH:
// Connection cleanup and maintenance routines were run on the active user context 'data'.
// This allowed state overlap and corrupts the connection validation markers.
CURLcode Curl_conn_cache_maintenance(struct Curl_easy *data) {
// State modification occurs on user-controlled handle
data->state.recent_conn_id = ...;
return CURLE_OK;
}
// AFTER THE PATCH:
// Maintenance is isolated using an internal administrative handle ('admin_data').
// User-specific transfer contexts remain completely separated from idle pooled sockets.
CURLcode Curl_conn_cache_maintenance(struct Curl_easy *admin_data) {
if(admin_data->internal_admin_handle) {
// Execute maintenance without touching active user handle states
perform_maintenance_tasks(admin_data);
}
return CURLE_OK;
}Additionally, this fix prevents the session-matching bypass because the internal states are no longer scrambled by background eviction loops. By maintaining strict separation of administrative contexts, the socket validation engine can reliably enforce credential verification boundaries.
Exploitation of CVE-2026-19931 does not require complex cryptographic attacks or memory corruption payloads; instead, it relies on the predictable behavior of the connection matching engine. The exploit scenario operates in environments where libcurl is integrated into a multi-threaded daemon, a web application gateway, or a middleware service that performs actions on behalf of multiple users using Integrated Windows Authentication (IWA) or Kerberos SSO.
To trigger the session hijack, an attacker must satisfy the following prerequisites:
CURLOPT_HTTPAUTH set to CURLAUTH_NEGOTIATE).CURLOPT_USERPWD set to ":"), thereby delegating to ambient Kerberos/GSSAPI contexts.Keep-Alive).The attack flow begins when User A (with high-level privileges) triggers an action. The application, impersonating User A, initiates a request through libcurl. The underlying GSSAPI/SSPI provider generates the required token, completes the handshake, and authenticates the TCP connection. The transaction finishes, and libcurl returns the connection to the pool. Next, User B (the attacker) initiates a transaction to the same server. The application switches thread context to User B and triggers a libcurl request. libcurl queries the pool, finds User A's idle, authenticated connection, matches it due to the NULL credential check bypass, and routes User B's request over it. The server processes User B's request under User A's identity, resulting in unauthenticated privilege escalation.
The impact of CVE-2026-19931 is rated Critical, with a CVSS v3.1 Base Score of 9.8. This score reflects the complete compromise of confidentiality, integrity, and availability within the trust boundary established between the client application and the backend service.
Because the session reuse bypass occurs entirely at the protocol transport layer within libcurl, security logging on the target server will not record any anomaly during the attack. The server simply receives a standard HTTP request over an already established, trusted TCP session that was authenticated during the initial SPNEGO handshake. Consequently, audit trails will attribute the attacker's unauthorized activities to the victim (User A), complicating incident response and forensics analysis.
In corporate environments, where Negotiate/Kerberos authentication is standard for single sign-on (SSO) to intranet portals, document management systems, and administrative APIs, this vulnerability exposes backend infrastructures to complete compromise. An attacker with low-privileged access to an application server can hijack active administrative connections to execute arbitrary state modifications, extract sensitive database files, or disable system availability.
The primary resolution for CVE-2026-19931 is upgrading the libcurl binary to version 8.22.0 or higher. For deployments where legacy or enterprise-stable releases are required, organizations must apply backported security updates containing the fix, such as versions 8.20.1, 8.16.1, or 8.14.2.
If compiling from source or updating packages is not immediately feasible, developers can apply an application-level workaround. This workaround prevents libcurl from caching or reusing persistent connections that utilize Negotiate authentication. By setting the CURLOPT_FORBID_REUSE parameter to 1L on every easy handle that performs Negotiate requests with blank credentials, the library is forced to close the TCP connection immediately upon completion of the transfer. This eliminates the risk of pool pollution and unauthorized reuse.
// Secure implementation of ambient Negotiate authentication to mitigate CVE-2026-19931
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://internal-api.corp.local/data");
// Configure SPNEGO / Negotiate authentication
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_NEGOTIATE);
// Explicitly use blank credentials for ambient user context delegation
curl_easy_setopt(curl, CURLOPT_USERPWD, ":");
// MITIGATION: Disable socket persistence to prevent downstream connection reuse hijacking
curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1L);
CURLcode res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}Security teams should also review authorization structures on the backend servers. Where possible, configuring the backend to require re-authentication per request (by disabling HTTP Keep-Alive or using transaction-scoped tokens) can serve as an additional defense-in-depth measure.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
curl curl | >= 7.64.1, <= 8.21.0 | 8.22.0 |
libcurl curl | >= 7.64.1, <= 8.21.0 | 8.22.0 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-488 (Exposure of Data Element to Wrong Session) |
| Attack Vector | Network (AV:N) |
| CVSS v3.1 Score | 9.8 (Critical) |
| EPSS Score | 0.01162 (Percentile: 65.60%) |
| Exploit Status | Proof-of-Concept / Analysis |
| CISA KEV Status | Not Listed |
| Affected Version Range | 7.64.1 to 8.21.0 |
The product associates a system resource or data element with the incorrect session, leading to exposure of information or control to an unauthorized user.
CVE-2026-118777 is a prototype pollution vulnerability (CWE-1321) in the Forge JavaScript cryptography and networking library (distributed on npm as node-forge) prior to version 1.4.1. The flaw resides in the forge.http client subsystem, where incoming HTTP cookie names and paths parsed from Set-Cookie response headers are stored directly into standard JavaScript objects without key validation or property isolation. By returning crafted Set-Cookie headers containing keys such as __proto__ or constructor, a malicious HTTP server can inject arbitrary properties into Object.prototype, attach attributes to the global Object constructor, or delete built-in prototype methods to cause an application-wide denial of service.
CVE-2026-118775 (GHSA-4642-5mcj-2rqw) is an integer overflow and validation flaw in the ASN.1 serialization module of Forge (node-forge) prior to version 1.4.1. The asn1.oidToDer() function fails to validate the range of the first two arcs of an Object Identifier (OID) and truncates the packed initial subidentifier to a single 8-bit integer. Applications that perform policy checks on untrusted OID strings before encoding them into Distinguished Encoding Rules (DER) format can be tricked into emitting DER bytes that correspond to a completely different, restricted OID.
CVE-2026-119194 is an algorithmic complexity vulnerability (CWE-407) in the pyasn1 library for Python, affecting versions 0.3.3 through 0.6.4. The flaw resides in the schemaless decoding routine ConstructedPayloadDecoderBase._decodeComponentsSchemaless used across BER, CER, and DER codecs. By sending an ASN.1 container populated with child components whose tag identifiers are separated by multiples of CPython's integer hash modulus (sys.hash_info.modulus), an unauthenticated attacker can force worst-case hash collisions in an unbounded Python set, degrading decoding performance from O(N) to O(N^2) and causing a Denial of Service (DoS).
CVE-2026-119195 is an algorithmic complexity vulnerability (CWE-407) in the pyasn1 library for Python, affecting all versions prior to 0.6.5. When decoding constructed strings or indefinite-length ANY types across BER, CER, and certain DER code paths, the payload decoders repeatedly concatenate incoming fragments onto an immutable bytes object using the += operator. Because Python bytes objects cannot be resized in-place, each fragment iteration allocates a new buffer and copies all previously accumulated bytes, resulting in quadratic O(N^2) time and memory copy complexity. An unauthenticated remote attacker can supply a highly fragmented ASN.1 stream to exhaust CPU cycles and stall application worker threads.
An algorithmic complexity vulnerability (CWE-407) in pyasn1 versions prior to 0.6.5 allows unauthenticated attackers to cause a Denial of Service (DoS) via crafted ASN.1 payloads. The flaw resides in the binary-encoded ASN.1 REAL mantissa deserialization routine within RealPayloadDecoder.valueDecoder. By performing iterative byte-string slicing and repeated bitwise shifts on a growing arbitrary-precision integer, the decoder exhibits quadratic time and memory allocation complexity relative to the mantissa length. Supplying a BER-, CER-, or DER-encoded payload with a large REAL mantissa causes excessive CPU consumption and blocks application worker processes.
A vulnerability classified under CWE-407 (Inefficient Algorithmic Complexity) exists in the pyasn1 library prior to version 0.6.5. When parsing constructed ASN.1 BIT STRING payloads under BER, CER, or schema-driven DER encoding rules, the BitStringPayloadDecoder repeatedly shifts and copies the entire accumulated bit value for each incoming fragment. Processing inputs with a large number of small constructed fragments induces quadratic CPU consumption, allowing unauthenticated remote attackers to cause a denial of service via resource exhaustion during the initial decoding phase.