CVE-2026-31870 in Yhirose Cpp-Httplib
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 v...
Affects 1 product from 1 vendor. Facts below cite their sources.
Remotely exploitable over the network, low complexity, no authentication required, no user interaction needed, impact contained to the vulnerable component, no confidentiality impact, no integrity impact, full availability impact.
Affected products and versions
| Vendor | Product | Affected versions |
|---|---|---|
| Yhirose | Cpp-Httplib | < 0.37.1 |
A product listed here is affected only at the versions shown. Use the free check to test the exact version you run.
Fix and vendor advisory
No official vendor advisory link on record. See the CVE record.
Vendor PSIRT: [email protected]
Exploitation
| CISA known-exploited | Not in the CISA KEV catalog |
|---|---|
| Public exploit | Not confirmed |
Official 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.
Source: NIST NVD / MITRE CVE.
Record details
| CVE ID | CVE-2026-31870 |
|---|---|
| BreachSpider ID | BS-2026-GLOBAL-080996-H |
| CVSS vector | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| Published | 2026-03-11 |
| Last modified | 2026-06-17 |
| Weakness (CWE) | |
| Source | NVD |
Weakness definitions
CWE-248: CWE-248
Analysis AI-written, not human-reviewed
CVE-2026-31870 affects cpp-httplib versions prior to 0.37.1, where the library improperly handles the Content-Length header without validation or exception handling, leading to potential crashes or undefined behavior.
An attacker can exploit this vulnerability by sending a malicious HTTP response with a malformed Content-Length header to a cpp-httplib client using the streaming API. This can cause the client to throw an std::invalid_argument exception, potentially leading to a denial of service or other unintended behavior.
Questions
What is CVE-2026-31870?
CVE-2026-31870 affects cpp-httplib versions prior to 0.37.1, where the library improperly handles the Content-Length header without validation or exception handling, leading to potential crashes or undefined behavior.
What is the CVSS score for CVE-2026-31870?
CVE-2026-31870 has CVSS 7.5 (High). Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H. EPSS: 0.6%.
Is CVE-2026-31870 actively exploited?
No confirmed active exploitation of CVE-2026-31870 as of 2026-09-25.
How do I remediate CVE-2026-31870?
Priority: HIGH. PSIRT: [email protected]
What systems are affected by CVE-2026-31870?
CVE-2026-31870 affects Yhirose Cpp-Httplib.
For developers and AI agents
Run this check from your own code or agent
REST API
curl -s https://breachspider.com/api/v1/assets/correlate-cves \
-H "Authorization: Bearer $BREACHSPIDER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"assets":[{"asset_id":"dev-1","vendor":"Yhirose","product":"Cpp-Httplib","version":"1.0"}]}'
MCP for AI agents
# hosted: add as a connector
https://mcp.breachspider.com/mcp
# local
pipx install breachspider-mcp
Free trial: 14 days, 750 device checks, no card.
Page facts from NVD, MITRE, CISA and vendor advisories, record last modified 2026-06-17.