CVE-2026-81889
elFinder: SSRF protection bypass via DNS rebinding in the `fsock_get_contents()` fallback
Refuses outbound TCP connections from PHP processes to loopback, private and link-local addresses to mitigate CVE-2026-81889.
High 8.6Vetted
EPSS 0.5%: the estimated chance this CVE is exploited in the next 30 days, as of 24 Nov 2026.
At a glance
CVE-2026-81889 is a high (CVSS 8.6) vulnerability in elFinder, published 31 August 2026. A vetted upatch, cve-2026-81889-ssrf-block, blocks it on running Linux machines with shirudo until elFinder is upgraded.
- Severity
- High 8.6 CVSS 3.1
- Chance of exploitation
- 0.5% in the next 30 days (EPSS, 24 Nov 2026)
- Known exploited
- No, not on CISA’s KEV list
- Weakness
- CWE-918
- Affected software
- elFinder (Studio-42)
- Upatch status
- Vetted, merged into the registry
- How to apply
- Build, sign and roll out with shirudo
Overview
CVE-2026-81889 (GHSA-8x3q-jpjh-qh5c), published on 31 August 2026, is a server-side request forgery protection bypass in elFinder prior to 2.1.70. During a URL upload in php/elFinder.class.php, get_remote_contents() calls validate_address(), which resolves the hostname once with gethostbyname(), rejects loopback (127.0.0.0/8), private (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), and link-local (169.254.0.0/16) IPv4 addresses, and stores the validated address in $info['ip']. When the PHP cURL extension (curl_exec()) is unavailable, get_remote_contents() falls back to fsock_get_contents(), which calls fsockopen() with $arr['host'] instead of $info['ip']. That triggers a second DNS resolution. With DNS rebinding, an attacker can return a public IPv4 address for validate_address() and a loopback or private address for fsockopen(), causing elFinder to fetch an internal HTTP response and save its body as an uploaded file in the volume. In addition, after get_remote_contents() succeeds in upload(), get_headers($url, true) requests the original hostname again without pinning $info['ip'], giving a blind SSRF path even when curl_get_contents() is used.
Official description
elFinder is an open-source file manager for web, written in JavaScript using jQuery UI. Prior to 2.1.70, elFinder URL uploads in php/elFinder.class.php can bypass server-side request forgery protections when PHP cURL is unavailable because validate_address() validates $info['ip'], but get_remote_contents() selects fsock_get_contents(), which connects to $arr['host'] and performs a second DNS resolution. An attacker able to submit a URL upload can use DNS rebinding to have the first resolution return a public address and the connection resolution return a loopback or private address, causing the internal HTTP response body to be stored as an uploaded file and made readable through elFinder. After a successful fetch, get_headers($url, true) separately requests the original hostname without reusing the validated and pinned connection, creating an additional blind server-side request forgery path even when curl_get_contents() is selected. This issue is fixed in version 2.1.70.
Affected versions
This is an application vulnerability in elFinder prior to 2.1.70 (fixed in 2.1.70 by commits 6d997386cd0f and 191372c1bbeb). The upatch uses the socket_connect LSM hook, which is stable across Linux kernels with CONFIG_BPF_LSM.
Sources
More references from NVD (4)
Mitigation
The BPF LSM program cve_2026_81889_connect attaches to lsm/socket_connect and returns -EPERM when all of the following hold:
- The socket type is
SOCK_STREAM. - The destination socket address is an internal IPv4 or IPv6 address:
- IPv4
0.0.0.0/8,127.0.0.0/8(loopback),10.0.0.0/8,172.16.0.0/12,192.168.0.0/16(RFC 1918 private), or169.254.0.0/16(link-local and cloud metadata), matching the rangesvalidate_address()forbids. - IPv6
::,::1, IPv4-mapped::ffff:0:0/96in any of the IPv4 ranges above, unique-localfc00::/7, or link-localfe80::/10.
- IPv4
- The calling task's
commor executable name (mm->exe_file) isphp,php-*(such asphp-fpmorphp-cgi), orphp<digit>*(such asphp8.4).
Because lsm/socket_connect inspects the resolved IP address passed to connect() inside the kernel, a second DNS resolution that rebinds to a loopback, private, or link-local address is refused before a TCP handshake begins. A refusal from an earlier BPF LSM program on the same hook is preserved. Refusals are counted in the refused per-CPU array map at key 0.
Side effects
- Outbound TCP (
SOCK_STREAM) connections from PHP processes (php,php-fpm,php-cgi) to loopback, RFC 1918 private, and link-local IP addresses fail withEPERM. - If the PHP application on the same host connects over TCP to a database, cache, or backend on loopback or a private network (rather than over a Unix domain socket), those TCP connections will also be refused while the upatch is loaded.
- Inbound HTTP connections accepted by PHP or a web server, Unix domain sockets (
AF_UNIX), UDP DNS queries (SOCK_DGRAM, including to127.0.0.53:53), and outbound TCP connections from PHP to public IP addresses continue to work. - Not covered: elFinder deployments running under Apache
mod_phpwhere the worker process is namedapache2orhttpdrather thanphp*.
Preemption model and cost
The program holds no state other than the refused per-CPU counter map, which is updated with __sync_fetch_and_add, making it safe under every kernel preemption model, including preemptible RCU and PREEMPT_RT. On every socket_connect call, non-stream sockets exit after reading sock->type, and AF_UNIX or public-address connects exit after inspecting the socket address, before reading the current task's name or executable.
The policy
124 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_endian.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
#include <bpf/bpf_core_read.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 is_internal_ipv4(__u32 ip)
{
return (ip >> 24) == 0 ||
(ip >> 24) == 127 ||
(ip >> 24) == 10 ||
(ip & 0xfff00000U) == 0xac100000U ||
(ip >> 16) == 0xc0a8U ||
(ip >> 16) == 0xa9feU;
}
static __always_inline bool is_internal_sockaddr(const struct sockaddr *address,
int addrlen)
{
__u16 family = 0;
if (!address || addrlen < (int)sizeof(family) ||
bpf_probe_read_kernel(&family, sizeof(family), &address->sa_family))
return false;
if (family == AF_INET) {
struct sockaddr_in sin = {};
if (addrlen < (int)sizeof(sin) ||
bpf_probe_read_kernel(&sin, sizeof(sin), address))
return false;
return is_internal_ipv4(bpf_ntohl(sin.sin_addr.s_addr));
}
if (family == AF_INET6) {
struct sockaddr_in6 sin6 = {};
__u32 w0, w1, w2, w3;
if (addrlen < (int)sizeof(sin6) ||
bpf_probe_read_kernel(&sin6, sizeof(sin6), address))
return false;
w0 = bpf_ntohl(sin6.sin6_addr.in6_u.u6_addr32[0]);
w1 = bpf_ntohl(sin6.sin6_addr.in6_u.u6_addr32[1]);
w2 = bpf_ntohl(sin6.sin6_addr.in6_u.u6_addr32[2]);
w3 = bpf_ntohl(sin6.sin6_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 is_internal_ipv4(w3);
return (w0 & 0xfe000000U) == 0xfc000000U ||
(w0 & 0xffc00000U) == 0xfe800000U;
}
return false;
}
static __always_inline bool is_php_name(const char *s)
{
if (s[0] != 'p' || s[1] != 'h' || s[2] != 'p')
return false;
return s[3] == 0 || s[3] == '-' ||
(s[3] >= '0' && s[3] <= '9');
}
static __always_inline bool current_is_php(void)
{
char comm[16] = {};
if (bpf_get_current_comm(comm, sizeof(comm)) == 0 && is_php_name(comm))
return true;
struct task_struct *task = bpf_get_current_task_btf();
const unsigned char *name = BPF_CORE_READ(task, mm, exe_file,
f_path.dentry, d_name.name);
char exe[8] = {};
if (!name || bpf_probe_read_kernel_str(exe, sizeof(exe), name) < 0)
return false;
return is_php_name(exe);
}
SEC("lsm/socket_connect")
int BPF_PROG(cve_2026_81889_connect, struct socket *sock,
struct sockaddr *address, int addrlen, int ret)
{
if (ret)
return earlier_verdict(ret);
if (!sock || BPF_CORE_READ(sock, type) != SOCK_STREAM)
return 0;
if (!is_internal_sockaddr(address, addrlen) || !current_is_php())
return 0;
count_refused();
return -EPERM;
}
The package: name, license, the program and the CVE it fixes.
[package]
name = "cve-2026-81889"
description = "Refuses outbound TCP connections from PHP processes to loopback, private and link-local addresses to mitigate CVE-2026-81889"
license = "GPL-2.0 OR BSD-2-Clause"
[[upatches]]
source = "cve-2026-81889-ssrf-block.bpf.c"
[upatches.tree]
id = "cve-2026-81889-ssrf-block"
fixes = ["CVE-2026-81889"]
Process
How this upatch was written, checked and reviewed, from the registry’s history.
- 31 Aug 2026CVECVE published
- 25 Nov 2026Pull requestPull request #78 openedAdd CVE-2026-81889: Refuses outbound TCP connections from PHP processes to loopback, private andromanlab
- 25 Nov 2026CIUpdate upatch.devpassed
- 25 Nov 2026CICIpassed
- 25 Nov 2026MergeMerged #78romanlab
No human review is recorded on GitHub for this upatch yet.
Evidence
On elFinder 2.1.69 without cURL, a DNS-rebound URL upload fetched an internal loopback HTTP resource and stored it in files/ before and after the upatch was loaded, and was refused at socket_connect while the upatch was loaded.
- Tested
- 25 Nov 2026
- Target
- elFinder 2.1.69 on PHP CLI web server with curl_init and curl_exec disabled, loopback only
- Kernel
- 7.4-shirudo-ci-20261123
- Architecture
- x86_64
- Distribution
- Ubuntu 26.04
| State | DNS-rebound URL upload reaches 127.0.0.1:9001 and writes file |
|---|---|
| Before loading | yes (reached) |
| Upatch loaded | no (blocked, 4 A queries, TCP connect refused) |
| After unloading | yes (reached) |
tools-test.log Output of tools/test --setup on the shirudo test VM showing before, loaded and after results.
tools/test --setup, 2026-11-25T14:30:49Z Target: shirudo test VM, Linux 7.4-shirudo-ci-20261123, x86_64, swtpm cve-2026-81889 setup done ELFINDER_URL=http://127.0.0.1:8080/php/connector.minimal.php ELFINDER_FILES=/opt/upatch-payload/cve-2026-81889/elFinder-2.1.69/files ELFINDER_HELPER_URL=http://127.0.0.1:9001 before reached URL upload fetched upatch-probe-0154bee5edbf.txt from 127.0.0.1:9001 via DNS rebinding and wrote it to files/; removed it loaded blocked elFinder resolved upatch-probe-ebf931848f94.rebind.test to 127.0.0.1 (4 A queries) and its TCP connect was refused after reached URL upload fetched upatch-probe-acc28c3e7b8e.txt from 127.0.0.1:9001 via DNS rebinding and wrote it to files/; removed it 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-81889shirudo bpm push build/packages/cve-2026-81889-1.0.0.bee oci://<registry>/<namespace>/cve-2026-81889 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-81889-1.0.0.bee oci://<registry>/<namespace>/<tree> --tree-id <tree-id> --keys-dir <keys-dir>