upatch.dev

CVE-2026-77775

Headroom Proxy Sends Upstream Requests to a Client-Supplied Base URL Without Address Validation

Refuses outbound connections from Headroom proxy to loopback, link-local, RFC 1918 and reserved addresses to mitigate CVE-2026-77775.

High 7.7Vetted

EPSS 0.6%: the estimated chance this CVE is exploited in the next 30 days, as of 24 Nov 2026.

At a glance

CVE-2026-77775 is a high (CVSS 7.7) vulnerability in Headroom, published 21 August 2026. A vetted upatch, cve-2026-77775-headroom-ssrf-block, blocks it on running Linux machines with shirudo until Headroom is upgraded.

Severity
High 7.7 CVSS 4.0
Chance of exploitation
0.6% in the next 30 days (EPSS, 24 Nov 2026)
Known exploited
No, not on CISA’s KEV list
Weakness
CWE-918
Affected software
Headroom (Headroom Labs)
Upatch status
Vetted, merged into the registry
How to apply
Build, sign and roll out with shirudo

Overview

CVE-2026-77775, "Headroom Proxy Sends Upstream Requests to a Client-Supplied Base URL Without Address Validation", was published on 20 August 2026. Headroom's LLM proxy lets a client override the upstream destination with the x-headroom-base-url HTTP request header. _resolve_openai_upstream_base in headroom/proxy/handlers/openai.py, _select_passthrough_base_url in headroom/providers/proxy_routes.py, and the passthrough route in headroom/providers/proxy_routes.py accept the client-supplied URL without rejecting loopback, link-local, RFC 1918, or reserved addresses. Because the proxy forwards the request and returns the upstream response to the caller, an attacker can reach internal services and cloud metadata endpoints (169.254.169.254) and read their responses.

Official description

Headroom's LLM proxy lets a client choose the upstream destination with the x-headroom-base-url request header. _resolve_openai_upstream_base in headroom/proxy/handlers/openai.py accepts the header value, requires only that it parse with an http or https scheme and a hostname, and returns it for use as the upstream base; _select_passthrough_base_url in headroom/providers/proxy_routes.py reads the same header for the passthrough routes. No check rejects loopback, link-local, or RFC 1918 destinations, and because the component is a proxy the upstream response is returned to the caller, so the request reaches internal services and cloud metadata addresses and their responses are disclosed. The Authorization header accompanying the request is forwarded unchanged to the caller-designated host. The pip console script binds 127.0.0.1 by default, but the reference docker-compose.yml ships --host 0.0.0.0 with published ports and no required HEADROOM_PROXY_TOKEN, which the server itself warns about at startup, so a deployment following the shipped compose exposes the affected data-plane routes to the network without authentication.

Affected versions

Application: headroom-ai versions before 0.36.1 (fixed in 0.36.1).

Kernels: any Linux kernel with BPF LSM and BTF enabled that shirudo supports.

Sources

More references from NVD (5)

Mitigation

The lsm/socket_connect program returns -EPERM when a process whose command name is headroom connects an AF_INET or AF_INET6 SOCK_STREAM socket to a non-public IP address:

Family Refused destination ranges
AF_INET 0.0.0.0/8, 10.0.0.0/8, 100.64.0.0/10, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.168.0.0/16, 198.18.0.0/15, 224.0.0.0/4, 240.0.0.0/4
AF_INET6 ::, ::1, ::ffff:0:0/96 mapped to any refused IPv4 range, fc00::/7, fe80::/10, ff00::/8

The program checks the socket type and destination address first and reads the current task's command name only when a stream socket connects to an internal address. It preserves any negative verdict from an earlier BPF LSM program on the same hook and increments key 0 of the refused per-CPU array on each refusal.

Side effects

  • Any outbound TCP connection from a process named headroom to a loopback, link-local, RFC 1918, carrier-grade NAT, benchmarking, multicast, or reserved IPv4/IPv6 address fails with EPERM, and Headroom returns HTTP 502 (connection_error) to the client.
  • Outbound TCP connections from headroom to public upstream LLM APIs keep working.
  • A deployment that intentionally connects from headroom to an internal or on-premises upstream LLM gateway or local database over TCP is also refused while this upatch is loaded.

Preemption model and cost

The program is written for preemptible RCU and keeps no shared state other than the refused per-CPU counter, which it updates with an atomic fetch-and-add so interleaved runs on the same CPU cannot lose counts. On ordinary connections to public IP addresses or non-stream sockets, the program checks the socket type, address family, and IP prefix in registers and returns without calling any helper.

The policy

132 lines of BPF C, attached at lsm/socket_connect.

// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause

#include "vmlinux.h"
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
#include <bpf/bpf_core_read.h>
#include <bpf/bpf_endian.h>

#define EPERM	1
#define AF_INET	2
#define AF_INET6 10
#define SOCK_STREAM 1

char _license[] SEC("license") = "Dual BSD/GPL";

struct {
	__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
	__uint(max_entries, 1);
	__type(key, __u32);
	__type(value, __u64);
} refused SEC(".maps");

static __always_inline void count_refused(void)
{
	__u32 key = 0;
	__u64 *value = bpf_map_lookup_elem(&refused, &key);

	if (value)
		__sync_fetch_and_add(value, 1);
}

static __always_inline int earlier_verdict(int ret)
{
	return ret >= -4095 && ret < 0 ? ret : -EPERM;
}

static __always_inline bool current_is_headroom(void)
{
	char comm[16] = {};

	if (bpf_get_current_comm(&comm, sizeof(comm)))
		return false;
	return comm[0] == 'h' && comm[1] == 'e' && comm[2] == 'a' &&
	       comm[3] == 'd' && comm[4] == 'r' && comm[5] == 'o' &&
	       comm[6] == 'o' && comm[7] == 'm' && comm[8] == '\0';
}

static __always_inline bool ipv4_is_internal(__u32 ip)
{
	if ((ip & 0xff000000U) == 0x00000000U)
		return true;
	if ((ip & 0xff000000U) == 0x0a000000U)
		return true;
	if ((ip & 0xffc00000U) == 0x64400000U)
		return true;
	if ((ip & 0xff000000U) == 0x7f000000U)
		return true;
	if ((ip & 0xffff0000U) == 0xa9fe0000U)
		return true;
	if ((ip & 0xfff00000U) == 0xac100000U)
		return true;
	if ((ip & 0xffff0000U) == 0xc0a80000U)
		return true;
	if ((ip & 0xfffe0000U) == 0xc6120000U)
		return true;
	if ((ip & 0xe0000000U) == 0xe0000000U)
		return true;
	if ((ip & 0xf0000000U) == 0xf0000000U)
		return true;
	return false;
}

static __always_inline bool ipv6_is_internal(const struct in6_addr *addr)
{
	__u32 w0 = bpf_ntohl(addr->in6_u.u6_addr32[0]);
	__u32 w1 = bpf_ntohl(addr->in6_u.u6_addr32[1]);
	__u32 w2 = bpf_ntohl(addr->in6_u.u6_addr32[2]);
	__u32 w3 = bpf_ntohl(addr->in6_u.u6_addr32[3]);

	if (w0 == 0 && w1 == 0 && w2 == 0 && (w3 == 0 || w3 == 1))
		return true;
	if (w0 == 0 && w1 == 0 && w2 == 0x0000ffffU)
		return ipv4_is_internal(w3);
	if ((w0 & 0xfe000000U) == 0xfc000000U)
		return true;
	if ((w0 & 0xffc00000U) == 0xfe800000U)
		return true;
	if ((w0 & 0xff000000U) == 0xff000000U)
		return true;
	return false;
}

SEC("lsm/socket_connect")
int BPF_PROG(cve_2026_77775_connect, struct socket *sock,
	     struct sockaddr *address, int addrlen, int ret)
{
	__u16 family = 0;

	if (ret)
		return earlier_verdict(ret);
	if (!sock || !address || BPF_CORE_READ(sock, type) != SOCK_STREAM)
		return 0;
	if (addrlen < (int)sizeof(family) ||
	    bpf_probe_read_kernel(&family, sizeof(family), &address->sa_family))
		return 0;
	if (family == AF_INET) {
		struct sockaddr_in sin = {};
		__u32 ip;

		if (addrlen < (int)sizeof(sin) ||
		    bpf_probe_read_kernel(&sin, sizeof(sin), address))
			return 0;
		ip = bpf_ntohl(sin.sin_addr.s_addr);
		if (!ipv4_is_internal(ip))
			return 0;
	} else if (family == AF_INET6) {
		struct sockaddr_in6 sin6 = {};

		if (addrlen < (int)sizeof(sin6) ||
		    bpf_probe_read_kernel(&sin6, sizeof(sin6), address))
			return 0;
		if (!ipv6_is_internal(&sin6.sin6_addr))
			return 0;
	} else {
		return 0;
	}
	if (!current_is_headroom())
		return 0;
	count_refused();
	return -EPERM;
}

Process

How this upatch was written, checked and reviewed, from the registry’s history.

  1. 21 Aug 2026CVECVE published
  2. 25 Nov 2026Pull requestPull request #71 openedAdd CVE-2026-77775: Refuses outbound connections from Headroom proxy to loopback, link-local, RFCromanlab
  3. 25 Nov 2026CIUpdate upatch.devpassed
  4. 25 Nov 2026CICIpassed
  5. 25 Nov 2026MergeMerged #71romanlab

No human review is recorded on GitHub for this upatch yet.

Evidence

On a vulnerable Headroom 0.29.0 proxy, the loaded upatch refused the x-headroom-base-url SSRF connection to a loopback target and the proxy returned HTTP 502, while requests before loading and after unloading reached the target.

Tested
25 Nov 2026
Target
headroom-ai 0.29.0 proxy on Python 3.12, listening on 127.0.0.1:8787
Kernel
7.4-shirudo-ci-20261123
Architecture
x86_64
Distribution
Ubuntu 26.04
Results
StateSSRF via x-headroom-base-url blockedProxy response to loopback x-headroom-base-url
Before loadingnoHTTP 200 (probe body returned)
Upatch loadedyesHTTP 502 (connection refused by LSM)
After unloadingnoHTTP 200 (probe body returned)
tools-test.log Output of tools/test --setup showing the probe reaching the loopback listener before and after, and being blocked while loaded.
tools/test --setup, 2026-11-25T14:02:10Z
Target: shirudo test VM, Linux 7.4-shirudo-ci-20261123, x86_64, swtpm
cve-2026-77775
  setup   done         HEADROOM_URL=http://127.0.0.1:8787
  before  reached      proxy forwarded request to 127.0.0.1:38995 and returned probe body
  loaded  blocked      proxy connection to loopback target failed with HTTP 502
  after   reached      proxy forwarded request to 127.0.0.1:42319 and returned probe body
  PASS: reached before, blocked while loaded, reached again after

Use it

Build the upatch from source, sign it with your own shirudo key, and publish it to your own OCI registry. Machines that follow your upatch tree load it within about a minute.

Build and sign
git clone https://github.com/copper-helm/upatch-registry
cd upatch-registry
tools/build <shirudo-checkout> <keys-dir> 1.0.0 upatches/cve-2026-77775
Publish and roll out
shirudo bpm push build/packages/cve-2026-77775-1.0.0.bee oci://<registry>/<namespace>/cve-2026-77775 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-77775-1.0.0.bee oci://<registry>/<namespace>/<tree> --tree-id <tree-id> --keys-dir <keys-dir>