Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2026-54919

CVE-2026-54919: Cpp-httplib Information Disclosure Flaw

CVE-2026-54919 is an information disclosure vulnerability in Yhirose Cpp-httplib that allows attackers to intercept and modify HTTPS traffic. This article covers technical details, affected versions, and mitigation.

Published:

CVE-2026-54919 Overview

CVE-2026-54919 is a certificate validation flaw [CWE-295] in cpp-httplib, a C++11 single-file header-only HTTP/HTTPS library. When built with CPPHTTPLIB_MBEDTLS_SUPPORT or CPPHTTPLIB_WOLFSSL_SUPPORT, the library skips certificate chain validation for connections made to IP-literal hosts. WebSocketClient on the Mbed TLS backend skips verification entirely. An attacker positioned to intercept traffic can present a crafted certificate and read or modify the encrypted session. Affected versions include Mbed TLS backend 0.31.0 through 0.46.1 and wolfSSL backend 0.33.0 through 0.46.1. The maintainer fixed the issue in version 0.47.0.

Critical Impact

Man-in-the-middle attackers can decrypt or tamper with HTTPS traffic when clients connect to IP-literal hosts, breaking TLS confidentiality and integrity guarantees.

Affected Products

  • yhirose cpp-httplib with Mbed TLS backend, versions 0.31.0 through 0.46.1
  • yhirose cpp-httplib with wolfSSL backend, versions 0.33.0 through 0.46.1
  • WebSocketClient on the Mbed TLS backend (verification skipped entirely)

Discovery Timeline

  • 2026-07-10 - CVE-2026-54919 published to NVD
  • 2026-07-14 - Last updated in NVD database

Technical Details for CVE-2026-54919

Vulnerability Analysis

The vulnerability stems from a defensive coding attempt that unintentionally disables TLS chain verification. When a client connects to a bare IP address, cpp-httplib avoids setting Server Name Indication (SNI) per RFC 6066. On the Mbed TLS and wolfSSL backends, the same code path also called set_verify_client(ctx, false), disabling chain validation for the entire session. SSLClient and Client in HTTPS mode therefore accept any server certificate presented during the handshake when the target is an IP literal. WebSocketClient on the Mbed TLS backend does not enable verification at all, extending the exposure to WebSocket over TLS sessions.

Root Cause

The library conflated hostname identity verification with certificate chain verification. Because set_hostname on Mbed TLS and wolfSSL also configures SNI, the code skipped that call for IP hosts and additionally disabled chain checks to avoid handshake failures. This left the client trusting any certificate signed by any authority, valid or otherwise.

Attack Vector

An attacker on the network path between the client and the server can intercept the TCP handshake and present a self-signed or attacker-controlled certificate. Because the chain is not validated, the TLS handshake completes and the attacker proxies or modifies plaintext application data. Exploitation requires network positioning (public Wi-Fi, compromised routers, ARP spoofing, or DNS redirection) and a client that connects to an IP address rather than a hostname.

c
 bool is_ip = is_ip_address(host);
 
-#ifdef CPPHTTPLIB_MBEDTLS_SUPPORT
-  if (is_ip && server_certificate_verification) {
-    set_verify_client(ctx, false);
-  } else {
-    set_verify_client(ctx, server_certificate_verification);
-  }
+#if defined(CPPHTTPLIB_MBEDTLS_SUPPORT) || defined(CPPHTTPLIB_WOLFSSL_SUPPORT)
+  // Chain verification happens during the handshake even for IP hosts; the
+  // certificate identity is verified post-handshake via verify_hostname()
+  set_verify_client(ctx, server_certificate_verification);
 #endif
 
   session = create_session(ctx, sock);
   if (!session) { return false; }
 
-  // RFC 6066: SNI must not be set for IP addresses
-  if (!is_ip) { set_sni(session, host.c_str()); }
-  if (server_certificate_verification) { set_hostname(session, host.c_str()); }
+  // RFC 6066: SNI must not be set for IP addresses. On Mbed TLS and wolfSSL
+  // set_hostname also sets SNI, so it must be skipped for IP hosts as well;
+  // their identity is checked post-handshake below instead.
+  if (!is_ip) {
+    if (server_certificate_verification) {
+      set_hostname(session, host.c_str());
+    } else {
+      set_sni(session, host.c_str());
+    }

Source: GitHub Commit fa981ce

Detection Methods for CVE-2026-54919

Indicators of Compromise

  • TLS handshakes from cpp-httplib clients to IP-literal endpoints completing with certificates signed by non-trusted or private certificate authorities.
  • Unexpected certificate fingerprints observed on outbound HTTPS connections to internal IP addresses.
  • WebSocket over TLS sessions from applications built with CPPHTTPLIB_MBEDTLS_SUPPORT accepting mismatched certificates.

Detection Strategies

  • Perform software composition analysis (SCA) to identify binaries and containers linking cpp-httplib versions 0.31.0 through 0.46.1 (Mbed TLS) or 0.33.0 through 0.46.1 (wolfSSL).
  • Inspect network traffic at egress for HTTPS connections to raw IPv4 or IPv6 literals rather than DNS names.
  • Correlate TLS certificate metadata (issuer, subject, fingerprint) with expected values for internal services.

Monitoring Recommendations

  • Log outbound TLS SNI values and destination IPs; alert on sessions to IP literals with missing SNI.
  • Deploy passive TLS inspection to record certificate chains presented to internal clients over time.
  • Track new or updated dependencies pulling cpp-httplib into build pipelines through SBOM generation.

How to Mitigate CVE-2026-54919

Immediate Actions Required

  • Upgrade cpp-httplib to version 0.47.0 or later and rebuild all affected artifacts.
  • Audit application code paths that pass IP-literal hosts to SSLClient, Client, or WebSocketClient.
  • Rotate credentials or tokens transmitted over affected clients if MITM exposure is suspected.

Patch Information

The fix is committed in fa981ce and shipped in the GitHub Release v0.47.0. The patch removes the IP-specific set_verify_client(ctx, false) branch and ensures chain validation occurs during the handshake, with hostname identity verified post-handshake via verify_hostname(). See the GitHub Security Advisory GHSA-8ffh-4p95-g3p2 for the full advisory.

Workarounds

  • Prefer hostnames over IP literals when connecting via cpp-httplib until the upgrade is deployed.
  • Switch to the OpenSSL backend, which is not affected by this specific bypass, if feasible.
  • Pin expected server certificate fingerprints in application code and reject mismatches before sending sensitive data.
bash
# Configuration example: verify the upgraded version and rebuild
git -C third_party/cpp-httplib fetch --tags
git -C third_party/cpp-httplib checkout v0.47.0
grep -R "CPPHTTPLIB_VERSION" third_party/cpp-httplib/httplib.h
cmake --build build --target clean
cmake --build build --config Release

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.