CVE-2026-46527
Undergoing Analysis Undergoing Analysis - In Progress
Denial of Service in cpp-httplib via X-Forwarded-For Header

Publication date: 2026-05-29

Last updated on: 2026-05-29

Assigner: GitHub, Inc.

Description
cpp-httplib is a C++11 single-file header-only cross platform HTTP/HTTPS library. Prior to 0.44.0, When the server has called Server::set_trusted_proxies() with a non-empty trusted-proxy list, an attacker can send an HTTP request that includes an X-Forwarded-For header whose value parses to no valid IP segments. The code path then executes get_client_ip(), which calls front() on an empty std::vectorβ€”undefined behavior in C++. On typical implementations this manifests as abnormal process termination (denial of service). With Sanitizers enabled, you get an explicit runtime diagnostic. This vulnerability is fixed in 0.44.0.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-05-29
Last Modified
2026-05-29
Generated
2026-05-30
AI Q&A
2026-05-30
EPSS Evaluated
N/A
NVD
EUVD
Affected Vendors & Products
Showing 2 associated CPEs
Vendor Product Version / Range
cpp-httplib cpp-httplib to 0.44.0 (exc)
yhirose cpp-httplib to 0.44.0 (exc)
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-476 The product dereferences a pointer that it expects to be valid but is NULL.
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?

CVE-2026-46527 is a vulnerability in the cpp-httplib library versions prior to 0.44.0. It occurs when a server uses the set_trusted_proxies() function with a non-empty list of trusted proxies. An attacker can send an HTTP request with a specially crafted X-Forwarded-For header that contains no valid IP segments, such as an empty string or only commas or whitespace.

This causes the get_client_ip() function to process an empty vector of IP addresses and call the front() method on it, which is undefined behavior in C++. This typically leads to abnormal process termination or a server crash, resulting in a denial of service.

The vulnerability arises because the code assumes the vector will always have at least one IP address but does not check for an empty vector before calling front(). It only affects deployments that configure trusted proxies.


How can this vulnerability impact me? :

This vulnerability can cause your server to crash or terminate abnormally when it processes a malicious HTTP request with a crafted X-Forwarded-For header. This results in a denial of service (DoS), making your service unavailable to legitimate users.


How can this vulnerability be detected on my network or system? Can you suggest some commands?

This vulnerability can be detected by monitoring for abnormal process termination or crashes in servers using cpp-httplib versions prior to 0.44.0 when configured with non-empty trusted proxy lists.

Specifically, detection involves checking if the server crashes or terminates abnormally after receiving HTTP requests with malformed X-Forwarded-For headers containing no valid IP segments, such as empty strings, comma-only values, or whitespace-only strings.

If Sanitizers are enabled during runtime, explicit diagnostics or runtime errors related to undefined behavior in C++ (such as calling front() on an empty vector) can help identify the issue.

  • Send test HTTP requests with X-Forwarded-For headers set to values like "", ",", or " " to see if the server crashes.
  • Use network monitoring tools (e.g., tcpdump, Wireshark) to capture and analyze incoming HTTP requests for suspicious X-Forwarded-For headers.
  • Check server logs for unexpected crashes or termination events correlated with requests containing malformed X-Forwarded-For headers.

What immediate steps should I take to mitigate this vulnerability?

The immediate mitigation step is to upgrade the cpp-httplib library to version 0.44.0 or later, where this vulnerability is fixed.

If upgrading is not immediately possible, avoid configuring the server with a non-empty trusted proxy list using Server::set_trusted_proxies(), as the vulnerability only affects deployments with trusted proxies configured.

Additionally, implement input validation to ensure that the X-Forwarded-For header contains valid IP segments before processing.

Consider enabling runtime sanitizers during development or testing to detect undefined behavior early.


Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart