CVE-2026-46527: cpp-httplib: Malicious `X-Forwarded-For` Under Trusted-Proxy Configuration Triggers Empty `vector::front()`, Leading to Undefined Behavior and Server Crash
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::settrustedproxies() 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 getclientip(), 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.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
cpp-httplibto a version that resolves this vulnerability.Fixed in 0.44.0
Event History
Frequently Asked Questions
What is the severity of CVE-2026-46527?
CVE-2026-46527 has a severity rating of high with a score of 8.7.
How do I fix CVE-2026-46527?
To fix CVE-2026-46527, update cpp-httplib to version 0.44.0 or later.
What causes CVE-2026-46527?
CVE-2026-46527 is caused by a malicious `X-Forwarded-For` header that triggers undefined behavior and a server crash when handling trusted proxies.
What are the consequences of CVE-2026-46527?
The consequences of CVE-2026-46527 can include server crashes and potential service disruptions.
Which software is affected by CVE-2026-46527?
CVE-2026-46527 affects the cpp-httplib library used for HTTP/HTTPS communications.