CRITICAL🇵🇱 Wersja polska

CVE-2025-66570

CVSS 10.0v3.1pub. 2025-12-05upd. 2025-12-10

cpp-httplib is a C++11 single-file header-only cross platform HTTP/HTTPS library. Prior to 0.27.0, a vulnerability allows attacker-controlled HTTP headers to influence server-visible metadata, logging, and authorization decisions. An attacker can inject headers named REMOTE_ADDR, REMOTE_PORT, LOCAL_ADDR, LOCAL_PORT that are parsed into the request header multimap via read_headers() in httplib.h (headers.emplace), then the server later appends its own internal metadata using the same header names in Server::process_request without erasing duplicates. Because Request::get_header_value returns the first entry for a header key (id == 0) and the client-supplied headers are parsed before server-inserted headers, downstream code that uses these header names may inadvertently use attacker-controlled values. Affected files/locations: cpp-httplib/httplib.h (read_headers, Server::process_request, Request::get_header_value, get_header_value_u64) and cpp-httplib/docker/main.cc (get_client_ip, nginx_access_logger, nginx_error_logger). Attack surface: attacker-controlled HTTP headers in incoming requests flow into the Request.headers multimap and into logging code that reads forwarded headers, enabling IP spoofing, log poisoning, and authorization bypass via header shadowing. This vulnerability is fixed in 0.27.0.

🤖 AI Analysis
How it works

The read_headers() function in httplib.h parses all headers of an incoming HTTP request into a shared multimap structure, including headers with names reserved for internal server metadata (REMOTE_ADDR, REMOTE_PORT, LOCAL_ADDR, LOCAL_PORT). Subsequently, Server::process_request appends its own values for these same headers, but without first removing previously inserted entries. Since Request::get_header_value returns the first matching entry (id == 0), and headers supplied by the client are parsed before server metadata, the application code reads values controlled by the attacker instead of actual system values. This also applies to the logging code in docker/main.cc (functions get_client_ip, nginx_access_logger, nginx_error_logger).

Impact

An attacker can spoof the client IP address visible on the server side (IP spoofing), poison application logs with injected values (log poisoning), and bypass authorization mechanisms based on these headers (authorization bypass via header shadowing).

Mitigation & patch

The cpp-httplib library should be updated to version 0.27.0 or later, in which the issue was fixed (commit ac9ebb0ee333ce8bf13523f487bdfad9518a2aff). Until an update is applied, it is recommended to implement filtering of incoming request headers at the reverse proxy or WAF level to block headers named REMOTE_ADDR, REMOTE_PORT, LOCAL_ADDR, and LOCAL_PORT before they reach the application.

Who is affected

Yhirose cpp-httplib library (httplib.h) in all versions before 0.27.0

Analysis generated by Claude AI (Anthropic) based on NVD data. Always verify with vendor.
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N
  • Yhirose Cpp Httplib

    APP
    Yhirose
    < 0.27.0
🔵
CHECK WITH VENDOR
No clear patch data available. Check vendor references.
Tags
Container
CWE
References

Related vulnerabilities

CVE-2026-45372CRITICAL9.9PL ✓ten sam produkt

cpp-httplib: HTTP response splitting poprzez header injection (CRLF injection)

CVE-2026-46527HIGH8.7ten sam produkt

cpp-httplib is a C++11 single-file header-only cross platform HTTP/HTTPS library. Prior to 0.44.0, When the se...

CVE-2026-33745HIGH7.4ten sam produkt

cpp-httplib is a C++11 single-file header-only cross platform HTTP/HTTPS library. Prior to 0.39.0, the cpp-htt...

CVE-2026-32627HIGH8.7ten sam produkt

cpp-httplib is a C++11 single-file header-only cross platform HTTP/HTTPS library. Prior to 0.37.2, when a cpp-...

CVE-2026-31870HIGH7.5ten sam produkt

cpp-httplib is a C++11 single-file header-only cross platform HTTP/HTTPS library. Prior to 0.37.1, when a cpp-...