Skip to content
Heist/ feed
Back to feed
High

cpp-httplib Affected by Remote Process Crash via Malformed Content-Length Response Header

Type: advisorySources: OSV

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.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2026-31870
Confirmed fixed CVEs
Not specified
Updated in this feed
2 Nov 2026, 20:05 UTC · Revision 1

Source evidence

cpp-httplib Affected by Remote Process Crash via Malformed Content-Length Response Header

core-osv · Original source

Published 11 Mar 2026, 17:57 UTC

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.

osv:CVE-2026-31870
Complete source record
{
  "id": "d3b501cbca6fd62b0e152393cd60ff55a679fe6fb0b0af403a36efcf3d551173",
  "url": "https://osv.dev/vulnerability/CVE-2026-31870",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "cpp-httplib Affected by Remote Process Crash via Malformed Content-Length Response Header",
    "summary": "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.",
    "evidence": "osv:CVE-2026-31870",
    "products": [],
    "severity": "high",
    "structured": {
      "id": "CVE-2026-31870",
      "aliases": [
        "CVE-2026-31870",
        "GHSA-39q5-hh6x-jpxx"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/yhirose/cpp-httplib",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "68fa9bce0f1abb27fc7507c372c6ac0b75f8a878"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "0.37.1"
                      }
                    ],
                    "source": "AFFECTED_FIELD",
                    "strategy": "StringRangeExpression"
                  },
                  {
                    "cpe": "cpe:2.3:a:yhirose:cpp-httplib:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "0.37.1"
                      }
                    ],
                    "source": "CPE_RANGE"
                  }
                ]
              }
            }
          ],
          "versions": [
            "v0.37.0",
            "v0.35.0",
            "v0.34.0",
            "latest",
            "v0.33.1",
            "v0.33.0",
            "v0.32.0",
            "v0.31.0",
            "v0.30.2",
            "v0.30.1",
            "v0.30.0",
            "v0.29.0",
            "v0.28.0",
            "v0.27.0",
            "v0.26.0",
            "v0.25.0",
            "v0.24.0",
            "v0.23.1",
            "v0.23.0",
            "v0.22.0",
            "v0.21.0",
            "v0.20.1",
            "v0.20.0",
            "v0.19.0",
            "v0.18.7",
            "v0.18.6",
            "v0.18.5",
            "v0.18.4",
            "v0.18.3",
            "v0.18.2",
            "v0.18.1",
            "v0.18.0",
            "v0.17.3",
            "v0.17.2",
            "v0.17.1",
            "v0.17.0",
            "v0.16.3",
            "v0.16.2",
            "v0.16.1",
            "v0.16.0",
            "v0.15.3",
            "v0.15.2",
            "v0.15.1",
            "v0.15.0",
            "v0.14.3",
            "v0.14.2",
            "v0.14.1",
            "v0.14.0",
            "v0.13.3",
            "v0.13.2",
            "v0.13.1",
            "v0.13.0",
            "v0.12.6",
            "v0.12.5",
            "v0.12.4",
            "v0.12.3",
            "v0.12.2",
            "v0.12.1",
            "v0.12.0",
            "v0.11.4",
            "v0.11.3",
            "v0.11.2",
            "v0.11.1",
            "v0.11.0",
            "v0.10.9",
            "v0.10.8",
            "v0.10.7",
            "v0.10.6",
            "v0.10.5",
            "v0.10.4",
            "v0.10.3",
            "v0.10.2",
            "v0.10.1",
            "v0.10.0",
            "v0.9.10",
            "v0.9.9",
            "v0.9.8",
            "v0.9.7",
            "v0.9.6",
            "v0.9.5",
            "v0.9.4",
            "v0.9.3",
            "v0.9.2",
            "v0.9.1",
            "v0.9.0",
            "v0.8.9",
            "v0.8.8",
            "v0.8.7",
            "v0.8.6",
            "v0.8.5",
            "v0.8.4",
            "v0.8.3",
            "v0.8.2",
            "v0.8.1",
            "v0.8.0",
            "v0.7.18",
            "v0.7.17",
            "v0.7.16",
            "v0.7.15",
            "v0.7.14",
            "v0.7.13",
            "v0.7.12",
            "v0.7.11",
            "v0.7.10",
            "v0.7.9",
            "v0.7.8",
            "v0.7.7",
            "v0.7.6",
            "v0.7.5",
            "v0.7.4",
            "v0.7.3",
            "v0.7.2",
            "v0.7.1",
            "v0.7.0",
            "v0.6.7",
            "v0.6.6",
            "v0.6.5",
            "v0.6.4",
            "v0.6.3",
            "v0.6.2",
            "v0.6.1",
            "v0.6.0",
            "v0.5.13",
            "v0.5.12",
            "v0.5.11",
            "v0.5.10",
            "v0.5.9",
            "v0.5.8",
            "v0.5.7",
            "v0.5.6",
            "v0.5.5",
            "v0.5.4",
            "v0.5.3",
            "v0.5.2",
            "v0.5.1",
            "v0.5.0",
            "v0.4.2",
            "v0.4.1",
            "v0.4.0",
            "v0.3.3",
            "v0.3.2",
            "v0.3.1",
            "v0.3.0",
            "v0.2.6",
            "v0.2.5",
            "v0.2.4",
            "v0.2.3",
            "v0.2.2",
            "v0.2.1",
            "v0.2.0"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-31870.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:23.069620315Z",
      "provider": "osv",
      "references": [
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/31xxx/CVE-2026-31870.json",
        "https://github.com/yhirose/cpp-httplib/security/advisories/GHSA-39q5-hh6x-jpxx",
        "https://nvd.nist.gov/vuln/detail/CVE-2026-31870"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-248"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/31xxx/CVE-2026-31870.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-31870",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 489596,
  "published_at": "2026-03-11T17:57:49.744+00:00"
}