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

Machine-generated threat intelligence

AILast updated: 03/18/2026, 19:04:56 UTC

Technical Analysis

The vulnerability CVE-2026-31870 affects cpp-httplib, a popular C++11 single-header HTTP/HTTPS library used for client-server communication. In versions prior to 0.37.1, when using the streaming API methods such as httplib::stream::Get or httplib::stream::Post, the library directly calls std::stoull() on the Content-Length header value received from the server without validating the input or handling exceptions. If the Content-Length header contains a non-numeric string 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). Since these exceptions are not caught within the library, the C++ runtime calls std::terminate(), causing the client application to crash immediately with a SIGABRT signal. This behavior can be triggered deterministically by any server response, including those from legitimate servers, redirected endpoints, third-party APIs, or malicious actors performing man-in-the-middle attacks. No authentication or user interaction is required to exploit this vulnerability, making it trivial for attackers to cause denial-of-service conditions on affected client applications. The issue is resolved in cpp-httplib version 0.37.1 by presumably adding input validation and exception handling around the Content-Length parsing logic.

Potential Impact

The primary impact of CVE-2026-31870 is a denial-of-service (DoS) condition caused by client application crashes. Applications using vulnerable versions of cpp-httplib for HTTP streaming can be forced to terminate unexpectedly by sending crafted HTTP responses with malicious Content-Length headers. This can disrupt service availability, degrade user experience, and potentially cause cascading failures in systems relying on these clients. Since the vulnerability can be exploited without authentication or user interaction and can be triggered by any server the client connects to, the attack surface is broad. Organizations integrating cpp-httplib in critical infrastructure, API clients, or embedded systems may face operational interruptions. While there is no direct impact on confidentiality or integrity, the availability impact is significant, especially for high-availability or real-time systems. The lack of known exploits in the wild currently limits immediate risk, but the ease of exploitation and deterministic crash behavior make this a high-risk vulnerability.

Mitigation Recommendations

To mitigate CVE-2026-31870, organizations should upgrade all instances of cpp-httplib to version 0.37.1 or later, where the vulnerability is fixed. If upgrading immediately is not feasible, developers should implement input validation and exception handling around the parsing of the Content-Length header in their client code to catch std::invalid_argument and std::out_of_range exceptions from std::stoull. Additionally, applying network-level controls such as validating HTTP responses from trusted servers, employing TLS with certificate validation to prevent man-in-the-middle attacks, and filtering or sanitizing HTTP headers can reduce exposure. Monitoring client application logs for unexpected crashes and implementing automated restarts or failover mechanisms can help maintain availability. Finally, conducting code reviews and fuzz testing on HTTP header parsing logic in custom integrations can identify similar issues proactively.

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/18/2026, 7:04:56 PM

Last updated: 4/28/2026, 9:23:44 AM

Views: 58

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 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