Skip to main content

CVE-2025-46728: CWE-400: Uncontrolled Resource Consumption in yhirose cpp-httplib

High
VulnerabilityCVE-2025-46728cvecve-2025-46728cwe-400
Published: Tue May 06 2025 (05/06/2025, 00:45:25 UTC)
Source: CVE
Vendor/Project: yhirose
Product: cpp-httplib

Description

cpp-httplib is a C++ header-only HTTP/HTTPS server and client library. Prior to version 0.20.1, the library fails to enforce configured size limits on incoming request bodies when `Transfer-Encoding: chunked` is used or when no `Content-Length` header is provided. A remote attacker can send a chunked request without the terminating zero-length chunk, causing uncontrolled memory allocation on the server. This leads to potential exhaustion of system memory and results in a server crash or unresponsiveness. Version 0.20.1 fixes the issue by enforcing limits during parsing. If the limit is exceeded at any point during reading, the connection is terminated immediately. A short-term workaround through a Reverse Proxy is available. If updating the library immediately is not feasible, deploy a reverse proxy (e.g., Nginx, HAProxy) in front of the `cpp-httplib` application. Configure the proxy to enforce maximum request body size limits, thereby stopping excessively large requests before they reach the vulnerable library code.

AI-Powered Analysis

AILast updated: 07/06/2025, 19:41:38 UTC

Technical Analysis

CVE-2025-46728 is a high-severity vulnerability classified under CWE-400 (Uncontrolled Resource Consumption) affecting the yhirose cpp-httplib, a popular C++ header-only HTTP/HTTPS server and client library. Versions prior to 0.20.1 do not properly enforce configured size limits on incoming HTTP request bodies when the Transfer-Encoding header is set to chunked or when the Content-Length header is missing. Specifically, an attacker can send a chunked HTTP request without the required terminating zero-length chunk, causing the server to allocate memory indefinitely while waiting for the end of the request body. This uncontrolled memory allocation can exhaust system resources, leading to server crashes or unresponsiveness, effectively resulting in a denial-of-service (DoS) condition. The vulnerability does not impact confidentiality or integrity but severely affects availability. The issue was addressed in version 0.20.1 by enforcing size limits during the parsing of chunked requests and terminating connections immediately if limits are exceeded. For organizations unable to upgrade promptly, a recommended short-term mitigation is to deploy a reverse proxy such as Nginx or HAProxy in front of the cpp-httplib-based application. The proxy should be configured to enforce strict maximum request body size limits, preventing oversized or malformed requests from reaching the vulnerable library. No known exploits are currently reported in the wild, but the vulnerability is remotely exploitable without authentication or user interaction, increasing its risk profile. The CVSS v3.1 score is 7.5 (High), reflecting the ease of exploitation and significant impact on availability.

Potential Impact

For European organizations, the impact of this vulnerability can be substantial, especially for those relying on cpp-httplib in their C++ applications exposed to the internet or internal networks. Exploitation can lead to denial-of-service conditions, causing service outages, degraded performance, and potential disruption of critical business operations. This is particularly concerning for sectors such as finance, healthcare, telecommunications, and public services where high availability is essential. Additionally, prolonged unavailability could lead to reputational damage and regulatory scrutiny under frameworks like GDPR if service disruptions affect customer data access or processing. Since the vulnerability can be triggered remotely without authentication, attackers can easily target exposed services, increasing the risk of widespread disruption. The lack of known exploits in the wild currently provides a window for mitigation, but the vulnerability’s nature suggests it could be weaponized in automated DoS campaigns. Organizations using cpp-httplib in embedded systems or IoT devices may also face challenges due to limited patching capabilities, increasing the risk of persistent exposure.

Mitigation Recommendations

1. Immediate upgrade to cpp-httplib version 0.20.1 or later to ensure proper enforcement of request body size limits during chunked transfer encoding parsing. 2. If upgrading is not immediately feasible, deploy a reverse proxy (e.g., Nginx, HAProxy) in front of the vulnerable application. Configure the proxy to enforce strict maximum request body size limits and reject requests exceeding these limits before they reach the backend. 3. Implement network-level protections such as rate limiting and anomaly detection to identify and block suspicious traffic patterns indicative of DoS attempts. 4. Conduct thorough testing of the application’s handling of chunked requests post-mitigation to confirm that limits are enforced correctly and that malformed requests are rejected gracefully. 5. Monitor logs and network traffic for unusual spikes in request sizes or incomplete chunked requests that may indicate exploitation attempts. 6. For embedded or IoT deployments using cpp-httplib, evaluate the feasibility of firmware updates or network segmentation to isolate vulnerable devices. 7. Maintain an incident response plan to quickly address potential DoS incidents stemming from this vulnerability.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
GitHub_M
Date Reserved
2025-04-28T20:56:09.084Z
Cisa Enriched
true
Cvss Version
3.1
State
PUBLISHED

Threat ID: 682d981cc4522896dcbdac8c

Added to database: 5/21/2025, 9:08:44 AM

Last enriched: 7/6/2025, 7:41:38 PM

Last updated: 8/6/2025, 3:31:49 PM

Views: 25

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats