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

Published Aug 27, 2026
·
Updated

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::shutdownandclose 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 Software

1 affected component
cpp-httplib>=0.33.0<=0.50.0, =0.50.1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade cpp-httplib to a version that resolves this vulnerability.

    Fixed in 0.50.1

Event History

Aug 27, 2026
CVE Published
via MITRE·10:37 PM
Data Sourced
via MITRE·10:37 PM
DescriptionWeakness

Frequently Asked Questions

1

Which deployments are affected?

Applications using cpp-httplib versions 0.33.0 through 0.50.0 with the TLS-enabled WebSocket client are affected. The issue occurs during teardown of a secure WebSocket connection.

2

Does exploitation require an unusual shutdown sequence?

No. Ordinary secure WebSocket connection teardown can reach the freed-then-used TLS session ordering through WebSocketClient::shutdown_and_close(), the client destructor, and the connect path.

3

What should be done to remediate the issue?

Upgrade cpp-httplib to version 0.50.1, which fixes the TLS session lifetime ordering.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203