Vulnerability · Published Aug 27, 2026 · Assigned by GitHub_M

CVE-2026-77358cpp-httplib: Use-after-free of TLS session in WebSocketClient::shutdown_and_close()

High 8.2

In plain English

A high-severity use-after-free in cpp-httplib from yhirose. Proof-of-concept exploit code is public. The chance it is exploited in the next 30 days is estimated at 0.4% (higher than 39% of all known vulnerabilities).

Severity (CVSS 4.0)8.2High
Exploit odds (30 days)0.4%top 61.2% of all CVEs
Exploited in the wildNo reportsCISA SSVC: poc
Attack toolingNoneno public tooling known

Official description

cpp-httplib is a C++ header-only HTTP/HTTPS library. In versions 0.33.0 through 0.50.0, the TLS-enabled WebSocket client frees the TLS session before closing the WebSocket that still uses it, producing a use-after-free. In WebSocketClient::shutdown_and_close the SSL object is freed and the pointer cleared, but the subsequent WebSocket close still sends a close frame through the SSL socket stream, which holds a raw copy of the now-dangling session pointer and reads from and writes to the freed memory. The same freed-then-used ordering is reachable through the client's destructor and its connect path, so ordinary teardown of a secure WebSocket connection triggers the defect. This issue is fixed in version 0.50.1.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12cpp-httplibno fix listedDEBIAN-CVE-2026-77358
Debian:13cpp-httplibno fix listedDEBIAN-CVE-2026-77358
Debian:14cpp-httplibno fix listedDEBIAN-CVE-2026-77358
Ubuntu:26.10cpp-httplibno fix listedUBUNTU-CVE-2026-77358

Affected products (as reported)

VendorProductVersions
yhirose cpp-httplib >= 0.33.0, < 0.50.

Weakness: CWE-416 · Vector: CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N

References