CVE-2026-46527

cpp-httplib: Malicious `X-Forwarded-For` Under Trusted-Proxy Configuration Triggers Empty `vector::front()`, Leading to Undefined Behavior and Server Crash

Published May 29, 2026 CVSS 4.0 · 8.7 High EPSS < 1% KEV · Not listed
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.

Analysis

AI-generated

Technical impact

cpp‑httplib allows an attacker to trigger a crash by sending a malformed X‑Forwarded‑For header when the server has been configured with trusted proxies. The library calls the front() method on a std::vector that is empty, which is undefined behavior in C++. On common implementations this results in abnormal process termination, effectively denying service to legitimate clients.

Affected Systems

The vulnerability affects the yhirose:cpp‑httplib library in all releases prior to 0.44.0. Any project integrating these older versions and enabling Server::set_trusted_proxies() is at risk.

Risk and Exploitability

The CVSS score is 8.7, indicating a high‑severity flaw. The EPSS score is not reported, and the vulnerability is not listed in CISA’s KEV catalog. The attack vector is inferred to be remote, requiring the attacker to send a crafted HTTP request to a target server that has configured trusted proxies.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade cpp‑httplib to version 0.44.0 or later.
  • If a trusted‑proxy list is required, replace Server::set_trusted_proxies() with a custom implementation that validates the X‑Forwarded‑For header and ensures the vector contains at least one valid IP segment before accessing front().
  • Review and update any downstream code that parses the X‑Forwarded‑For header to guard against empty vectors or otherwise malformed input.

Generated by OpenCVE AI on May 29, 2026 at 21:27 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
CPEs cpe:2.3:a:yhirose:cpp-httplib:*:*:*:*:*:*:*:*
Metrics cvssV3_1

{'score': 7.5, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H'}

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Yhirose
Yhirose cpp-httplib
Vendors & Products Yhirose
Yhirose cpp-httplib
Type Values Removed Values Added
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.
Title cpp-httplib: Malicious `X-Forwarded-For` Under Trusted-Proxy Configuration Triggers Empty `vector::front()`, Leading to Undefined Behavior and Server Crash
Weaknesses CWE-476
References
Metrics cvssV4_0

{'score': 8.7, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N'}

Weaknesses

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Jun 1, 2026, 1:52 PM
Reserved
May 14, 2026, 7:12 PM
Status
Analyzed
Published
May 29, 2026, 8:16 PM
Modified
Jul 22, 2026, 6:10 AM