CVE-2025-52887 cpp-httplib has unlimited number of http header fields, which causes memory leak

High 7.5 Published Updated

Attackers can exhaust system memory by sending unlimited HTTP headers, causing server crashes or unresponsiveness in applications using this C++ library.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2025-52887?

CVE-2025-52887 is a high-severity denial of service vulnerability in yhirose cpp-httplib, published on 26 Jun 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

cpp-httplib is a C++11 single-file header-only cross platform HTTP/HTTPS library. In version 0.21.0, when many http headers fields are passed in, the library does not limit the number of headers, and the memory associated with the headers will not be released when the connection is disconnected. This leads to potential exhaustion of system memory and results in a server crash or unresponsiveness. Version 0.22.0 contains a patch for the issue.

Weakness: CWE-400

Which versions are affected by CVE-2025-52887?

It affects 1 product.

Products include Yhirose Cpp-Httplib.

How do I fix CVE-2025-52887?

Upgrade to a fixed version.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is CVE-2025-52887 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-52887 exists.

Sources

Also known as GHSA-xjhg-gf59-p92h, OESA-2025-1721, OESA-2025-1722, OESA-2025-1723, OESA-2025-1724, OESA-2025-1829 and 1 more.

Is CVE-2025-52887 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free