CVE-2026-77358: cpp-httplib use-after-free in TLS WebSocket client

CVE-2026-77358 · Severity: info · CVSS 7.5 · Published 2026-08-28

cpp-httplib is a C++ library used to build HTTP and WebSocket applications with encryption support. A flaw in the secure WebSocket client causes the library to free critical SSL/TLS session memory while still attempting to use it during connection shutdown, leading to potential crashes or unpredictable behavior when closing encrypted WebSocket connections.

Technologies: Yhirose Cpp-Httplib. Vendors: Yhirose.

Quick answers

Is CVE-2026-77358 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-77358 being exploited in the wild.
How severe is CVE-2026-77358?
Informational severity, with a CVSS score of 7.5, published 28 August 2026.
Which products and versions are affected?
Yhirose Cpp-Httplib 0.33.0 through 0.50.0.
Is there a fix for CVE-2026-77358?
A patch was published on 2026-08-28: Fixed in version 0.50.1 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-77358 attacked?
It is attacked over the network.
Am I affected by CVE-2026-77358?
Check whether you run Yhirose Cpp-Httplib at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

Technical details

The vulnerability is a use-after-free flaw in the WebSocketClient::shutdown_and_close() method. The root cause is an ordering bug: the TLS session is freed via tls::free_session() before the WebSocket close frame is sent via ws_->close(). However, the WebSocket object's internal SSLSocketStream holds a raw pointer to that freed session and attempts to read from and write to it when sending the close frame. This results in reading and writing to freed memory. The defect is reachable through normal client teardown (destructor), the connect path, and explicit shutdown calls. No authentication or special preconditions are required; the use-after-free occurs during ordinary connection closure with TLS-enabled WebSocket clients. Valgrind testing confirmed 49 memory errors including invalid reads and writes on a freed 7,608-byte SSL object. The issue was fixed in version 0.50.1 by reordering operations to complete the WebSocket close before freeing the TLS session.

Affected products

  • yhirose cpp-httplib 0.33.0 through 0.50.0

Timeline

  • 2026-08-21: disclosed
  • 2026-08-28: patched: Fixed in version 0.50.1

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.