Memory Exhaustion Vulnerability in cpp-httplib: Uncontrolled Memory Allocation via Chunked Requests

cpp-httplib Updated 02 Oct 2025

Summary

06/05/2025
N/A
No i
Unrated
Not published

CVE-2025-46728: cpp-httplib is a C++ header-only HTTP/HTTPS server and client library. Affects cpp-httplib versions < 7b752106ac42bd5b907793950d9125a0972c8e8e. No fix is published. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

cpp-httplib is a C++ header-only library that provides HTTP and HTTPS server and client functionalities. It is designed for simplicity and ease of use, allowing developers to integrate HTTP capabilities into their applications without the need for extensive configuration. However, prior to version 0.20.1, cpp-httplib had a critical vulnerability that allowed attackers to exploit the library's handling of incoming request bodies, particularly when using chunked transfer encoding or omitting the Content-Length header.

Vulnerability Detail

The vulnerability arises from the library's failure to enforce size limits on incoming request bodies when 'Transfer-Encoding: chunked' is utilized or when no 'Content-Length' header is present. This oversight allows a remote attacker to send a chunked request that lacks the terminating zero-length chunk, leading to uncontrolled memory allocation on the server. As a result, the server may experience memory exhaustion, causing it to crash or become unresponsive. The issue has been addressed in version 0.20.1, which implements strict limits during the parsing of incoming requests.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

If immediate updating is not feasible, a short-term workaround is to deploy a reverse proxy in front of the cpp-httplib application. For instance, you can use Nginx or HAProxy to enforce maximum request body size limits. Below is an example configuration for Nginx:

server {

    listen 80;
    server_name your_domain.com;

    location / {
        client_max_body_size 1M;  # Set your desired limit
        proxy_pass http://localhost:YOUR_CPP_HTTPLIB_PORT;
    }
}

Conclusion

The cpp-httplib library has a critical vulnerability that can lead to memory exhaustion due to improper handling of incoming request bodies. It is essential to update to version 0.20.1 or later to mitigate this risk. Alternatively, deploying a reverse proxy can serve as a temporary solution until the library is updated.

See every vulnerability recorded for cpp-httplib →

Share this vulnerability

FAQ

The vulnerability can lead to uncontrolled memory allocation, potentially exhausting system memory and causing the server to crash or become unresponsive.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without requiring any signup.

All versions prior to 0.20.1 are affected by this vulnerability.

Yes, updating to version 0.20.1 or later of cpp-httplib resolves the vulnerability.

Vulert monitors and alerts in real-time for open-source vulnerabilities using just a manifest file like package-lock.json, allowing you to keep your applications secure.

Related vulnerabilities

Recent vulnerabilities recorded for cpp-httplib.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback