Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

CVE-2026-31870: CWE-248: Uncaught Exception in yhirose cpp-httplib

0
High
VulnerabilityCVE-2026-31870cvecve-2026-31870cwe-248
Published: Wed Mar 11 2026 (03/11/2026, 17:57:49 UTC)
Source: CVE Database V5
Vendor/Project: yhirose
Product: cpp-httplib

Description

cpp-httplib is a C++11 single-file header-only cross platform HTTP/HTTPS library. Prior to 0.37.1, when a cpp-httplib client uses the streaming API (httplib::stream::Get, httplib::stream::Post, etc.), the library calls std::stoull() directly on the Content-Length header value received from the server with no input validation and no exception handling. std::stoull throws std::invalid_argument for non-numeric strings and std::out_of_range for values exceeding ULLONG_MAX. Since nothing catches these exceptions, the C++ runtime calls std::terminate(), which kills the process with SIGABRT. Any server the client connects to — including servers reached via HTTP redirects, third-party APIs, or man-in-the-middle positions can crash the client application with a single HTTP response. No authentication is required. No interaction from the end user is required. The crash is deterministic and immediate. This vulnerability is fixed in 0.37.1.

AI-Powered Analysis

AILast updated: 03/11/2026, 18:48:09 UTC

Technical Analysis

The cpp-httplib library, a popular single-header C++11 HTTP/HTTPS client and server library, contains a critical vulnerability identified as CVE-2026-31870. This vulnerability stems from improper handling of the Content-Length HTTP header when using the streaming API methods such as httplib::stream::Get and httplib::stream::Post. Specifically, the library calls std::stoull() directly on the Content-Length header value without validating the input or catching exceptions. If the Content-Length header contains non-numeric characters or a numeric value exceeding the maximum unsigned long long integer (ULLONG_MAX), std::stoull throws exceptions (std::invalid_argument or std::out_of_range). Because the library does not catch these exceptions, the C++ runtime invokes std::terminate(), causing the client process to abort immediately with a SIGABRT signal. This results in a deterministic and immediate denial-of-service condition. The vulnerability can be exploited by any server the client connects to, including legitimate servers, redirected endpoints, third-party APIs, or attackers positioned in man-in-the-middle roles. No authentication or user interaction is required to exploit this flaw, making it highly accessible. The vulnerability affects all versions of cpp-httplib prior to 0.37.1, where the issue has been fixed by adding proper input validation and exception handling around the Content-Length header parsing. The CVSS v3.1 base score is 7.5, reflecting a high severity due to network attack vector, no privileges or user interaction required, and a high impact on availability (denial of service). No known exploits are reported in the wild as of the publication date.

Potential Impact

This vulnerability can cause immediate and deterministic crashes of any client application using vulnerable versions of cpp-httplib when connecting to a malicious or misconfigured server. The impact is a denial-of-service condition that affects availability, potentially disrupting critical services relying on cpp-httplib for HTTP communications. Since cpp-httplib is a widely used library in C++ projects, including embedded systems, IoT devices, and backend services, the scope of affected systems is broad. Attackers can exploit this vulnerability remotely without authentication or user interaction, increasing the risk of widespread disruption. Organizations using cpp-httplib in their software stacks may experience service outages, degraded reliability, or forced downtime. Additionally, attackers controlling man-in-the-middle positions or malicious third-party APIs can weaponize this flaw to crash client applications, potentially as part of larger attack campaigns. Although confidentiality and integrity are not directly impacted, the availability impact alone can have significant operational and reputational consequences.

Mitigation Recommendations

To mitigate this vulnerability, organizations should upgrade all instances of cpp-httplib to version 0.37.1 or later, where the issue is fixed by adding input validation and exception handling around the Content-Length header parsing. If upgrading immediately is not feasible, developers should implement custom exception handling around calls to the streaming API to catch std::invalid_argument and std::out_of_range exceptions from std::stoull and prevent process termination. Additionally, validating the Content-Length header value before passing it to std::stoull can prevent malformed inputs from triggering exceptions. Network-level mitigations include filtering or blocking suspicious HTTP responses with malformed Content-Length headers, especially from untrusted or third-party servers. Employing TLS with strict certificate validation can reduce man-in-the-middle attack risks. Monitoring client application logs for unexpected crashes or SIGABRT signals can help detect exploitation attempts. Finally, developers should audit other parts of their codebase for similar unchecked exception risks when parsing external inputs.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Data Version
5.2
Assigner Short Name
GitHub_M
Date Reserved
2026-03-09T19:02:25.014Z
Cvss Version
3.1
State
PUBLISHED

Threat ID: 69b1b88a2f860ef943602159

Added to database: 3/11/2026, 6:46:34 PM

Last enriched: 3/11/2026, 6:48:09 PM

Last updated: 3/14/2026, 1:07:36 AM

Views: 25

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses