upatch.dev

CVE-2026-82270

Portkey AI Gateway Server-Side Request Forgery via /v1/proxy/*

Refuses outbound connections from Node.js processes to internal and metadata addresses to mitigate Portkey AI Gateway SSRF (CVE-2026-82270).

High 8.7Vetted

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

At a glance

CVE-2026-82270 is a high (CVSS 8.7) vulnerability in Portkey AI Gateway, published 28 August 2026. A vetted upatch, cve-2026-82270-ssrf-block, blocks it on running Linux machines with shirudo until Portkey AI Gateway is upgraded.

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

Overview

CVE-2026-82270 is a server-side request forgery (SSRF) vulnerability in Portkey AI Gateway (@portkey-ai/gateway) through version 1.15.2, published on 28 August 2026. In src/index.ts, the /v1/proxy/* route is registered (app.post('/v1/proxy/*', proxyHandler)) without the requestValidator middleware that checks x-portkey-custom-host via isValidCustomHost. An unauthenticated caller can send a POST /v1/proxy/* request with x-portkey-custom-host pointing to a loopback, RFC 1918 private, link-local or cloud metadata address (169.254.169.254, fd00:ec2::254), and proxyHandler forwards the request body and Authorization headers to that internal target. In addition, outbound fetch calls follow HTTP redirects by default, allowing an allowlisted external host to redirect requests to internal addresses.

Official description

Portkey AI Gateway through 1.15.2 contains a server-side request forgery vulnerability in the /v1/proxy/* route that lacks requestValidator middleware. Attackers can set the x-portkey-custom-host header to internal addresses and forward requests with Authorization headers to reach internal services and exfiltrate provider API keys.

Affected versions

This is an application vulnerability in Portkey AI Gateway (@portkey-ai/gateway) through 1.15.2 (confirmed at commit 669825cbe89ee51569918b8f78a9db486fd69dd4). The upatch runs on any Linux kernel supported by shirudo with BPF LSM and BTF enabled.

Sources

More references from NVD (4)

Mitigation

The BPF LSM program cve_2026_82270_ssrf_block attaches to lsm/socket_connect and returns -EPERM when a process whose command name or executable is node attempts to connect an AF_INET or AF_INET6 socket to any of the internal or reserved ranges denied by isValidCustomHost in src/middlewares/requestValidator/index.ts:

  • IPv4: 0.0.0.0/8, 10.0.0.0/8, 100.64.0.0/10 (CGNAT), 127.0.0.0/8 (loopback), 169.254.0.0/16 (link-local and cloud metadata 169.254.169.254), 172.16.0.0/12, 192.0.0.0/24, 192.0.2.0/24, 192.168.0.0/16, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24 and 224.0.0.0/3 (multicast and reserved).
  • IPv6: ::1/128, ::/128, fc00::/7 (unique-local, including fd00:ec2::254), fe80::/10 (link-local), fec0::/10 (site-local), ff00::/8, 2001:db8::/32, and IPv4-mapped (::ffff:0:0/96), IPv4-compatible (::/96), NAT64 (64:ff9b::/96) and 6to4 (2002::/16) embeddings of the blocked IPv4 ranges.

The program checks the socket family and destination address first, and inspects the current task's command or executable name only when the destination falls in a blocked range. Because lsm/socket_connect runs in the kernel on every outbound connection attempt, it stops both direct /v1/proxy/* requests and HTTP redirects to internal addresses. Refusals are counted in the refused per-CPU array map at key 0.

Side effects

  • Any node process on the machine is refused outbound AF_INET and AF_INET6 connections to loopback, private, link-local, CGNAT and metadata addresses. Inbound connections to Portkey AI Gateway on loopback or private interfaces continue to work because accept does not call socket_connect.
  • Local model backends (such as Ollama on loopback) or Redis cache backends (REDIS_CONNECTION_STRING) hosted on loopback or RFC 1918 addresses cannot be reached by node over TCP/IP while the upatch is loaded.
  • Non-node processes on the host (including sshd, system services, curl and python3) are unaffected.

Preemption model and cost

The program keeps no shared state beyond a single per-CPU counter updated with __sync_fetch_and_add, so it is safe under every kernel preemption model, including PREEMPT_LAZY, PREEMPT_DYNAMIC with preemptible RCU, and PREEMPT_RT. Connections to public IPv4 or IPv6 addresses and non-IP sockets return after reading the address family and destination IP without querying task state or maps.

The policy

160 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

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 name_is_node(const struct dentry *dentry)
{
	const unsigned char *name = BPF_CORE_READ(dentry, d_name.name);
	char buf[8] = {};

	if (!dentry || BPF_CORE_READ(dentry, d_name.len) != 4)
		return false;
	if (bpf_probe_read_kernel_str(buf, sizeof(buf), name) < 0)
		return false;
	return buf[0] == 'n' && buf[1] == 'o' && buf[2] == 'd' &&
	       buf[3] == 'e' && buf[4] == '\0';
}

static __always_inline bool current_is_node(void)
{
	char comm[16] = {};
	struct task_struct *task;
	const struct dentry *exe;

	if (bpf_get_current_comm(&comm, sizeof(comm)) == 0 &&
	    comm[0] == 'n' && comm[1] == 'o' && comm[2] == 'd' &&
	    comm[3] == 'e' && comm[4] == '\0')
		return true;
	task = bpf_get_current_task_btf();
	exe = BPF_CORE_READ(task, mm, exe_file, f_path.dentry);
	return name_is_node(exe);
}

static __always_inline bool ipv4_is_blocked(__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 & 0xffffff00U) == 0xc0000000U)
		return true;
	if ((ip & 0xffffff00U) == 0xc0000200U)
		return true;
	if ((ip & 0xffff0000U) == 0xc0a80000U)
		return true;
	if ((ip & 0xfffe0000U) == 0xc6120000U)
		return true;
	if ((ip & 0xffffff00U) == 0xc6336400U)
		return true;
	if ((ip & 0xffffff00U) == 0xcb007100U)
		return true;
	if ((ip & 0xe0000000U) == 0xe0000000U)
		return true;
	return false;
}

static __always_inline bool ipv6_is_blocked(const struct in6_addr *addr6)
{
	__u32 w0 = bpf_ntohl(BPF_CORE_READ(addr6, in6_u.u6_addr32[0]));
	__u32 w1 = bpf_ntohl(BPF_CORE_READ(addr6, in6_u.u6_addr32[1]));
	__u32 w2 = bpf_ntohl(BPF_CORE_READ(addr6, in6_u.u6_addr32[2]));
	__u32 w3 = bpf_ntohl(BPF_CORE_READ(addr6, in6_u.u6_addr32[3]));

	if (w0 == 0 && w1 == 0 && w2 == 0)
		return ipv4_is_blocked(w3) || w3 == 1;
	if (w0 == 0 && w1 == 0 && w2 == 0x0000ffffU)
		return ipv4_is_blocked(w3);
	if (w0 == 0x0064ff9bU && w1 == 0 && w2 == 0)
		return ipv4_is_blocked(w3);
	if ((w0 & 0xffff0000U) == 0x20020000U)
		return ipv4_is_blocked((w0 << 16) | (w1 >> 16));
	if ((w0 & 0xfe000000U) == 0xfc000000U)
		return true;
	if ((w0 & 0xffc00000U) == 0xfe800000U)
		return true;
	if ((w0 & 0xffc00000U) == 0xfec00000U)
		return true;
	if ((w0 & 0xff000000U) == 0xff000000U)
		return true;
	if (w0 == 0x20010db8U)
		return true;
	return false;
}

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

	if (ret)
		return earlier_verdict(ret);
	if (!address || addrlen < (int)sizeof(family))
		return 0;
	family = BPF_CORE_READ(address, sa_family);
	if (family == AF_INET) {
		const struct sockaddr_in *sin;
		__u32 ip;

		if (addrlen < (int)sizeof(*sin))
			return 0;
		sin = (const struct sockaddr_in *)address;
		ip = bpf_ntohl(BPF_CORE_READ(sin, sin_addr.s_addr));
		if (!ipv4_is_blocked(ip) || !current_is_node())
			return 0;
		count_refused();
		return -EPERM;
	}
	if (family == AF_INET6) {
		const struct sockaddr_in6 *sin6;

		if (addrlen < (int)sizeof(*sin6))
			return 0;
		sin6 = (const struct sockaddr_in6 *)address;
		if (!ipv6_is_blocked(&sin6->sin6_addr) || !current_is_node())
			return 0;
		count_refused();
		return -EPERM;
	}
	return 0;
}

Process

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

  1. 28 Aug 2026CVECVE published
  2. 25 Nov 2026Pull requestPull request #90 openedAdd CVE-2026-82270: Refuses outbound connections from Node.js processes to internal and metadataromanlab
  3. 25 Nov 2026CICheck entriespassed
  4. 25 Nov 2026CIingestpassed
  5. 25 Nov 2026CICompile with clang 23passed
  6. 25 Nov 2026ReviewReviewedqodo-code-review[bot] (automated)
  7. 25 Nov 2026MergeMerged #90romanlab

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

Evidence

On Portkey AI Gateway 1.15.2, the /v1/proxy/* SSRF probe connected out to the internal loopback listener before and after the upatch was loaded, and was refused at lsm/socket_connect while the upatch was loaded.

Tested
25 Nov 2026
Target
Portkey AI Gateway (@portkey-ai/gateway) 1.15.2 on Node.js
Kernel
7.4-shirudo-ci-20261123
Architecture
x86_64
Results
StateOutbound SSRF connection to loopback listener blocked
Before loadingno
Upatch loadedyes
After unloadingno
tools-test.log Output of tools/test --setup on a shirudo test VM.
tools/test --setup, 2026-11-25T15:39:47Z
Target: shirudo test VM, Linux 7.4-shirudo-ci-20261123, x86_64, swtpm
cve-2026-82270
  setup   done         GATEWAY_URL=http://127.0.0.1:8787
  before  reached      Portkey AI Gateway forwarded /v1/proxy/* request to http://127.0.0.1:46667 (HTTP 500)
  loaded  blocked      Portkey AI Gateway outbound connection to http://127.0.0.1:42115 was refused (HTTP 500)
  after   reached      Portkey AI Gateway forwarded /v1/proxy/* request to http://127.0.0.1:40413 (HTTP 500)
  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-82270
Publish and roll out
shirudo bpm push build/packages/cve-2026-82270-1.0.0.bee oci://<registry>/<namespace>/cve-2026-82270 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-82270-1.0.0.bee oci://<registry>/<namespace>/<tree> --tree-id <tree-id> --keys-dir <keys-dir>