Skip to main content

cpp-httplib CVE-2026-77358

HIGH
Use After Free (CWE-416)
2026-08-27 GitHub_M
8.2
CVSS 4.0 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Force or await TLS WebSocket connection teardown (disconnect, reconnect, or scope exit)
  2. Delivery
    `shutdown_and_close` frees SSL session object
  3. Exploit
    `SSLSocketStream` retains dangling raw pointer to freed session
  4. Install
    WebSocket close frame transmitted through dangling pointer
  5. C2
    OpenSSL reads and writes freed memory
  6. Execute
    Client process memory corrupted
  7. Impact
    Application crash (denial of service)

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Memory lifecycle management
MITRE ATT&CK

2 techniques across 2 tactics: Execution, Privilege Escalation

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires that the consuming application uses cpp-httplib's TLS WebSocket client (WebSocketClient with a wss:// endpoint) in versions 0.33.0 through 0.50.0. The defect fires on three code paths: (1) the WebSocketClient destructor executing while the WebSocket is still open - i.e., the client object goes out of scope without an explicit close() call; (2) a call to connect() on an already-open client, which internally calls shutdown_and_close on the current connection; (3) a direct call to shutdown_and_close with the WebSocket still open. Plain HTTP, plain HTTPS (non-WebSocket), and unencrypted ws:// connections are not affected. No authentication is required to reach the vulnerable paths, but the vulnerable application must be actively using TLS WebSocket connections - deployments that use cpp-httplib only for HTTP or HTTPS request/response (non-WebSocket) are not exposed.

Impact

The CVSS 4.0 score of 8.2 (AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H) correctly characterizes the primary risk: network-reachable, unauthenticated availability destruction against any application using TLS WebSocket connections. The AT:P qualifier (attack requirements present) acknowledges that wss:// usage must be in scope - plain HTTP and non-WebSocket HTTPS are unaffected. CVSS shows VC:N and VI:N, limiting the impact to availability; however, the intelligence feed tags include 'Information Disclosure,' which is not reflected in the vector - this discrepancy is unresolved and should be verified against the full GHSA advisory. EPSS data is absent from the provided intelligence, so exploitation probability cannot be quantified from that signal. KEV is not listed and no standalone POC exists beyond the regression tests shipped in 0.50.1, so the current signal is confirmed-vulnerability-with-patch rather than active exploitation. The most operationally significant risk factor is the header-only, statically compiled nature of the library: vulnerable versions are baked into consuming application binaries and will persist in deployed artifacts until each application is recompiled against 0.50.1, creating a supply-chain lag that extends the effective exposure window beyond the patch release date.

Exploit ScenarioDerived

A network server that deliberately drops or cycles a wss:// connection against a client application using cpp-httplib 0.33.0-0.50.0 can cause the client to trigger the use-after-free automatically during reconnection or teardown, crashing the client process. No crafted payload or authentication bypass is needed - the connect() call on the still-open client invokes shutdown_and_close, frees the TLS session, and then writes the WebSocket close frame through the dangling pointer. The regression tests added in 0.50.1 demonstrate both the destructor and reconnect paths reliably reproduce the memory corruption under ASan or Valgrind.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
No patch listed yet 0.3% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Aug 27, 2026

Use-after-free in cpp-httplib's TLS WebSocket client (versions 0.33.0 through 0.50.0) corrupts process memory during ordinary secure WebSocket teardown, causing denial of service in any application that embeds this header-only C++ library with wss:// connections. The SSL/TLS session object is freed in WebSocketClient::shutdown_and_close before the WebSocket close frame is transmitted, but the underlying SSLSocketStream retains a raw pointer to the freed session and dereferences it during the close handshake. The defect is reachable through three distinct paths - the client destructor, an explicit shutdown_and_close call, and the connect() reconnect path - meaning routine connection lifecycle events, not crafted adversarial input, reliably trigger the corruption. No KEV listing or standalone public exploit exists at time of analysis; vendor-released patch version 0.50.1 is available.

RemediationAI

The primary fix is to upgrade cpp-httplib to version 0.50.1, which reorders the teardown sequence in WebSocketClient so the WebSocket close frame is dispatched while the TLS session is still live, then frees both objects in the correct order. Because cpp-httplib is a single-header library, upgrading requires replacing httplib.h in the consuming project and recompiling; no dynamic library update is sufficient. The fix commit is verifiable at https://github.com/yhirose/cpp-httplib/commit/2f986fd5e56e7c5f686d965174516360930f371d and the advisory is at https://github.com/yhirose/cpp-httplib/security/advisories/GHSA-w7p7-f35j-mw7q. If an immediate recompile is not feasible, the defect can be avoided by always calling client.close() explicitly on every WebSocketClient instance before it goes out of scope or before any subsequent connect() call - this bypasses the vulnerable shutdown_and_close code path. This workaround is fragile across exception paths and early returns, so it must be applied at every exit point, including exception handlers; it should be treated as a temporary bridge to the patch only.

Affects your stack

Find out whether the stacks and servers you run are on an affected version.

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

cpp-httplib (CPE: cpe:2.3:a:yhirose:cpp-httplib:*:*:*:*:*:*:*:*) is a single-header C++ library providing HTTP/1.1, HTTP/2, and WebSocket client/server functionality with optional TLS support via OpenSSL. CWE-416 (Use After Free) is the root cause class: WebSocketClient::shutdown_and_close calls OpenSSL's session-free routine and nullifies its own pointer, but the WebSocket object holds a separate SSLSocketStream that retains an independent raw pointer to the same, now-freed, SSL structure. When the WebSocket subsequently attempts to send the RFC 6455 close frame, it reads and writes through this dangling pointer into freed memory. Because C++ destructor ordering is deterministic - the destructor calls shutdown_and_close - and because calling connect() on an open client also invokes shutdown_and_close on the existing connection before establishing the new one, the bug is not limited to an unusual teardown API: it manifests on every natural connection lifecycle event involving a still-open TLS WebSocket. The fix (commit 2f986fd) reorders operations so ws_->close() and ws_.reset() execute while the TLS session pointer is still valid, then frees the session afterward.

Know when Cpp Httplib gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (GitHub_M) PRIMARY 8.2 HIGH
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
vuln.today AI 7.5 HIGH

Teardown path is network-reachable with no authentication; only availability is impacted as the dangling TLS pointer causes a crash, not data exposure.

3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
4.0 AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
SUSE 5.0 MEDIUM
AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
Present
Privileges Required
None
User Interaction
None
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
None
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

DescriptionCVE.org

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.

Executive ViewAI

Why It Matters

Applications embedding cpp-httplib versions 0.33.0-0.50.0 face service-level denial-of-service risk from a use-after-free vulnerability triggered during routine WebSocket connection lifecycle events, with no public exploit identified at time of analysis. The vulnerability affects any service built on these library versions and will cause process crashes during normal connection teardown. Patch 0.50.1 is available and must be deployed across all affected applications to restore stability.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.3%
Top 79% exploitable
Prevalence
Medium
widely used C++ header-only HTTP library across embedded and desktop C++ applications
Social Media
1
Sightings
Data Quality
7 sources
Confidence: High
NVD CVE.org EPSS Vulnrichment Vendor CIRCL GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.3%
Patch available No
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Out-of-Cycle
Exploitation
Poc
System Exposure· derived
Open
Automatable
Yes
Human Impact
High
Technical Impact
Total

Priority Score

41
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +41
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Use-after-free vulnerabilities occur when a program continues to access memory through a pointer after that memory has been deallocated.

Memory corruption occurs when a program writes data beyond the boundaries of allocated memory regions or accesses memory in unintended ways, violating the integrity of the process's address space.

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

Affected Products (CPE)CVE.org

cpe:2.3:a:yhirose:cpp-httplib:*:*:*:*:*:*:*:*
CVE-2025-66570 CRITICAL POC
10.0 Dec 05

cpp-httplib is a C++11 single-file header-only cross platform HTTP/HTTPS library. Prior to 0.27.0, a vulnerability allow

CVE-2025-53628 HIGH POC
8.8 Jul 10

CVE-2025-53628 is a memory exhaustion vulnerability in cpp-httplib versions prior to 0.20.1 that allows unauthenticated

CVE-2025-46728 HIGH POC
7.5 May 06

cpp-httplib is a C++ header-only HTTP/HTTPS server and client library. Rated high severity (CVSS 7.5), this vulnerabilit

CVE-2025-52887 HIGH POC
7.5 Jun 26

cpp-httplib is a C++11 single-file header-only cross platform HTTP/HTTPS library. In version 0.21.0, when many http head

CVE-2025-53629 HIGH POC
7.5 Jul 10

CVE-2025-53629 is a Denial of Service vulnerability in cpp-httplib versions prior to 0.23.0 that allows unauthenticated

CVE-2026-22776 HIGH POC
7.5 Jan 12

cpp-httplib versions prior to 0.30.1 are vulnerable to denial of service attacks due to insufficient validation of decom

CVE-2026-28435 HIGH POC
7.5 Mar 04

cpp-httplib is a C++11 single-file header-only cross platform HTTP/HTTPS library. [CVSS 7.5 HIGH]

CVE-2026-21428 HIGH POC
7.5 Jan 01

Cpp-Httplib versions up to 0.30.0 contains a vulnerability that allows attackers to add extra headers, modify request bo

CVE-2020-11709 HIGH POC
7.5 Apr 12

cpp-httplib through 0.5.8 does not filter \r\n in parameters passed into the set_redirect and set_header functions, whic

CVE-2026-45372 CRITICAL
9.9 May 29

HTTP response/header injection in cpp-httplib server versions prior to 0.44.0 allows remote unauthenticated attackers to

CVE-2026-29076 MEDIUM POC
5.9 Mar 07

Remote denial of service in cpp-httplib prior to version 0.37.0 allows unauthenticated attackers to crash server process

CVE-2025-66577 MEDIUM POC
5.3 Dec 05

A security vulnerability in cpp-httplib (CVSS 5.3) that allows attacker-controlled http headers. Risk factors: public Po

Vendor StatusVendor

SUSE

Severity: Moderate
Product Status
SUSE Linux Enterprise Desktop 15 SP7 Not-Affected
SUSE Linux Enterprise Module for Development Tools 15 SP7 Not-Affected
SUSE Linux Enterprise Server 15 SP7 Not-Affected
SUSE Linux Enterprise Server 16.0 Not-Affected
SUSE Linux Enterprise Server 16.0 Not-Affected

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy