CVE-2026-77866
SSRF protection bypass in safeurl via IPv6 addresses and unresolvable hosts
Refuses outbound IPv6 connections to loopback, private and reserved addresses from BEAM processes to mitigate CVE-2026-77866 in Slab safeurl.
Critical 9.0Vetted
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-77866 is a critical (CVSS 9.0) vulnerability in safeurl, published 15 September 2026. A vetted upatch, cve-2026-77866-safeurl-block, blocks it on running Linux machines with shirudo until safeurl is upgraded.
- Severity
- Critical 9.0 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
- Affected software
- safeurl (Slab)
- Upatch status
- Vetted, merged into the registry
- How to apply
- Build, sign and roll out with shirudo
Overview
CVE-2026-77866 (EEF-CVE-2026-77866), published on 15 September 2026, is a
Server-Side Request Forgery (SSRF) protection bypass in the Elixir
library safeurl. When SafeURL.validate/2 and SafeURL.allowed?/2
validate a URL against the default @reserved_ranges CIDR list or a
configured :blocklist, ip_in_ranges?/2 in lib/safeurl/safeurl.ex
matches only 4-tuple IPv4 addresses ({_, _, _, _}) and returns false
for every other value. An internal or loopback destination that is
rejected in its IPv4 form (such as 127.0.0.1 or 169.254.169.254) is
accepted when written as an IPv6 address (such as [::1] or
[::ffff:127.0.0.1]), IPv6 entries in :blocklist never match, and a
host that resolves to no IPv4 address (nil) is accepted regardless of
where it points.
Official description
Server-Side Request Forgery (SSRF) vulnerability in Slab safeurl allows an attacker who controls a validated URL to reach internal network destinations the library is configured to block. Only IPv4 addresses are matched against the reserved ranges and the blocklist. Every other address is treated as matching nothing, so a destination that is rejected in its IPv4 form is accepted when written as an IPv6 address, IPv6 entries in the blocklist never match, and a host that resolves to no IPv4 address is accepted regardless of where it points. Deployments that rely on the allowlist instead are unaffected, because there an unmatched address is rejected. This issue affects safeurl: from 0.1.0 onward.
Affected versions
This is an application vulnerability in the safeurl Hex package:
| Package | Affected | Fixed in |
|---|---|---|
safeurl (Hex) |
0.1.0 to 1.0.0 (>= 0.1.0) |
none published |
The BPF LSM programs run on any Linux kernel that supports BPF_LSM_MAC
with socket_connect and socket_sendmsg.
Sources
More references from NVD (3)
Mitigation
Two BPF LSM programs on lsm/socket_connect and lsm/socket_sendmsg
inspect the destination struct sockaddr when its family is AF_INET6.
If the IPv6 address is in a reserved or private range (::/128,
::1/128, fc00::/7, fe80::/10, fec0::/10, ff00::/8, or
::ffff:0:0/96 and 64:ff9b::/96 embedding any of safeurl's reserved
IPv4 ranges) and the calling process is a BEAM runtime task (beam*,
erlexec or elixir), the hook increments the refused per-CPU counter
and returns -EPERM.
Side effects
- Erlang and Elixir processes on the machine cannot connect or send
packets over IPv6 to loopback (
::1), link-local (fe80::/10), unique-local (fc00::/7), multicast (ff00::/8), or IPv4-mapped reserved addresses (::ffff:127.0.0.0/104,::ffff:10.0.0.0/104,::ffff:169.254.0.0/112,::ffff:172.16.0.0/108,::ffff:192.168.0.0/112). - IPv4 connections (including
127.0.0.1for local Erlang distribution or application ports), public IPv6 connections, and all connections by non-BEAM processes are unaffected.
Preemption model and cost
The programs keep no state beyond the refused per-CPU array counter,
updated with an atomic fetch-and-add, so they are safe under every
preemption model, including PREEMPT_LAZY, PREEMPT_DYNAMIC and
PREEMPT_RT. Every non-IPv6 socket operation exits after reading the
two-byte sa_family field, and public IPv6 destinations return before
checking the task's command or executable name.
The policy
175 lines of BPF C, attached at lsm/socket_connect and lsm/socket_sendmsg.
// 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>
#define AF_INET6 10
#define EPERM 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 has_scheduler_suffix(const char *s)
{
for (int i = 0; i < 6; i++) {
if (s[i] == '_' && s[i + 1] == 's' && s[i + 2] == 'c' &&
s[i + 3] == 'h' && s[i + 4] == 'e' && s[i + 5] == 'd')
return true;
if (s[i] == '_' && s[i + 1] == 'd' && s[i + 2] == 'i' &&
s[i + 3] == 'r' && s[i + 4] == 't' && s[i + 5] == 'y')
return true;
}
return false;
}
static __always_inline bool is_beam_name(const char *s)
{
if (s[0] == 'b' && s[1] == 'e' && s[2] == 'a' && s[3] == 'm' &&
(s[4] == 0 || s[4] == '.'))
return true;
if (s[0] == 'e' && s[1] == 'r' && s[2] == 'l' && s[3] == 'e' &&
s[4] == 'x' && s[5] == 'e' && s[6] == 'c' && s[7] == 0)
return true;
if (s[0] == 'e' && s[1] == 'l' && s[2] == 'i' && s[3] == 'x' &&
s[4] == 'i' && s[5] == 'r' && s[6] == 0)
return true;
if (has_scheduler_suffix(s))
return true;
return false;
}
static __always_inline bool current_is_beam(void)
{
struct task_struct *task = bpf_get_current_task_btf();
const struct dentry *exe = BPF_CORE_READ(task, mm, exe_file, f_path.dentry);
const unsigned char *ename = BPF_CORE_READ(exe, d_name.name);
char comm[16] = {};
char ebuf[16] = {};
if (bpf_get_current_comm(&comm, sizeof(comm)) == 0 && is_beam_name(comm))
return true;
if (ename && bpf_probe_read_kernel_str(ebuf, sizeof(ebuf), ename) > 0 &&
is_beam_name(ebuf))
return true;
return false;
}
static __always_inline bool ipv4_is_reserved(const __u8 *ip4)
{
if (ip4[0] == 0 || ip4[0] == 10 || ip4[0] == 127)
return true;
if (ip4[0] == 100 && (ip4[1] & 0xc0) == 64)
return true;
if (ip4[0] == 169 && ip4[1] == 254)
return true;
if (ip4[0] == 172 && (ip4[1] & 0xf0) == 16)
return true;
if (ip4[0] == 192 && ip4[1] == 0 && (ip4[2] == 0 || ip4[2] == 2))
return true;
if (ip4[0] == 192 && ip4[1] == 88 && ip4[2] == 99)
return true;
if (ip4[0] == 192 && ip4[1] == 168)
return true;
if (ip4[0] == 198 && (ip4[1] == 18 || ip4[1] == 19))
return true;
if (ip4[0] == 198 && ip4[1] == 51 && ip4[2] == 100)
return true;
if (ip4[0] == 203 && ip4[1] == 0 && ip4[2] == 113)
return true;
if (ip4[0] >= 224)
return true;
return false;
}
static __always_inline bool ipv6_is_reserved(const struct in6_addr *in6)
{
const __u8 *b = in6->in6_u.u6_addr8;
bool prefix_zero = true;
for (int i = 0; i < 10; i++) {
if (b[i] != 0)
prefix_zero = false;
}
if (prefix_zero) {
if (b[10] == 0 && b[11] == 0 && b[12] == 0 &&
b[13] == 0 && b[14] == 0 && (b[15] == 0 || b[15] == 1))
return true;
if (b[10] == 0xff && b[11] == 0xff)
return ipv4_is_reserved(&b[12]);
}
if (b[0] == 0x00 && b[1] == 0x64 && b[2] == 0xff && b[3] == 0x9b)
return ipv4_is_reserved(&b[12]);
if ((b[0] & 0xfe) == 0xfc)
return true;
if (b[0] == 0xfe && (b[1] & 0xc0) == 0x80)
return true;
if (b[0] == 0xfe && (b[1] & 0xc0) == 0xc0)
return true;
if (b[0] == 0xff)
return true;
return false;
}
static __always_inline int check_addr6(const struct sockaddr *address, int addrlen)
{
struct sockaddr_in6 sin6 = {};
__u16 family = 0;
if (!address || addrlen < (int)sizeof(family))
return 0;
if (bpf_probe_read_kernel(&family, sizeof(family), &address->sa_family))
return 0;
if (family != AF_INET6 || addrlen < (int)sizeof(sin6))
return 0;
if (bpf_probe_read_kernel(&sin6, sizeof(sin6), address))
return 0;
if (!ipv6_is_reserved(&sin6.sin6_addr))
return 0;
if (!current_is_beam())
return 0;
count_refused();
return -EPERM;
}
SEC("lsm/socket_connect")
int BPF_PROG(cve_2026_77866_connect, struct socket *sock,
struct sockaddr *address, int addrlen, int ret)
{
if (ret)
return earlier_verdict(ret);
return check_addr6(address, addrlen);
}
SEC("lsm/socket_sendmsg")
int BPF_PROG(cve_2026_77866_sendmsg, struct socket *sock,
struct msghdr *msg, int size, int ret)
{
if (ret)
return earlier_verdict(ret);
if (!msg)
return 0;
return check_addr6(msg->msg_name, msg->msg_namelen);
}
The package: name, license, the program and the CVE it fixes.
[package]
name = "cve-2026-77866"
description = "Refuses outbound IPv6 connections to loopback, private and reserved addresses from BEAM processes to mitigate CVE-2026-77866 in Slab safeurl"
license = "GPL-2.0 OR BSD-2-Clause"
[[upatches]]
source = "cve-2026-77866-safeurl-block.bpf.c"
[upatches.tree]
id = "cve-2026-77866-safeurl-block"
fixes = ["CVE-2026-77866"]
Process
How this upatch was written, checked and reviewed, from the registry’s history.
- 15 Sept 2026CVECVE published
- 25 Nov 2026Pull requestPull request #106 openedAdd CVE-2026-77866: Refuses outbound IPv6 connections to loopback, private and reserved addressesromanlab
- 25 Nov 2026CICheck entriespassed
- 25 Nov 2026CIingestpassed
- 25 Nov 2026CICompile with clang 23passed
- 25 Nov 2026ReviewReviewedqodo-code-review[bot] (automated)
- 25 Nov 2026MergeMerged #106romanlab
No human review is recorded on GitHub for this upatch yet.
Evidence
On an Elixir 1.18.3 service running safeurl 1.0.0 with default reserved-range blocking, the loaded upatch refused the outbound IPv6 loopback SSRF connection with EPERM while safeurl continued to reject IPv4 loopback.
- Tested
- 25 Nov 2026
- Target
- Slab safeurl 1.0.0 on Elixir 1.18.3 / Erlang/OTP, block_reserved=true, loopback HTTP service on 127.0.0.1:18080
- Kernel
- 7.4-shirudo-ci-20261123
- Architecture
- x86_64
- Distribution
- Ubuntu 26.04
| State | IPv6 loopback SSRF blocked | IPv4 loopback rejected by safeurl (HTTP 403) |
|---|---|---|
| Before loading | no (HTTP 200) | yes |
| Upatch loaded | yes (EPERM, HTTP 502) | yes |
| After unloading | no (HTTP 200) | yes |
tools-test.log Output of tools/test --setup before, while and after the upatch was loaded.
tools/test --setup, 2026-11-25T16:27:01Z Target: shirudo test VM, Linux 7.4-shirudo-ci-20261123, x86_64, swtpm cve-2026-77866 setup done SAFEURL_SERVICE_URL=http://127.0.0.1:18080 before reached safeurl accepted http://[::1]:38075/ and connected to IPv6 loopback loaded blocked the upatch refused the outbound IPv6 loopback connection (blocked:eperm) after reached safeurl accepted http://[::1]:40159/ and connected to IPv6 loopback 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.
git clone https://github.com/copper-helm/upatch-registry
cd upatch-registry
tools/build <shirudo-checkout> <keys-dir> 1.0.0 upatches/cve-2026-77866shirudo bpm push build/packages/cve-2026-77866-1.0.0.bee oci://<registry>/<namespace>/cve-2026-77866 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-77866-1.0.0.bee oci://<registry>/<namespace>/<tree> --tree-id <tree-id> --keys-dir <keys-dir>