Executive brief
cpp-httplib is a widely used C++ library for adding web server and client functionality to applications. A vulnerability exists where a specially crafted web request can cause the server to crash, leading to a denial of service. This occurs specifically when the server is configured to trust certain network proxies and receives a malformed header. This could disrupt business operations by taking down services that rely on this library for communication.
Technical details
A logic flaw exists in the `get_client_ip()` function of `httplib.h`. When `Server::set_trusted_proxies()` is configured with a non-empty list, the server attempts to parse the `X-Forwarded-For` header. If an attacker sends a request with an empty, whitespace-only, or comma-only `X-Forwarded-For` header, the `detail::split` function fails to populate the `ip_list` vector. The code subsequently calls `ip_list.front()` on the empty vector, which is undefined behavior in C++. In most environments, this results in a segmentation fault or abnormal process termination. The vulnerability is reachable without authentication over the network. It is fixed in version 0.44.0.
Affected products
- yhirose cpp-httplib < 0.44.0
Timeline
- 2026-05-16: advisory: GitHub Security Advisory published
- 2026-05-29: disclosed: CVE published to NVD