# CVE-2026-81889: elFinder: SSRF protection bypass via DNS rebinding in the `fsock_get_contents()` fallback

The Markdown version of <https://upatch.dev/cve/CVE-2026-81889>. Last updated 25 Nov 2026.

## At a glance

CVE-2026-81889 is rated High 8.6 (CVSS 3.1, CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N). It affects elFinder (Studio-42) and was published on 31 Aug 2026. It is not in CISA's Known Exploited Vulnerabilities catalog. Its EPSS score is 0.5%: the estimated chance it is exploited in the next 30 days, as of 24 Nov 2026. The upatch `cve-2026-81889-ssrf-block` mitigates it, and is vetted (merged into the registry).

A upatch is a signed BPF program that shirudo loads into a running Linux kernel to block the code path this CVE's exploit takes. It holds the line until the fix ships; it does not replace patching.

## The vulnerability

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.

## What the upatch does

The BPF LSM program `cve_2026_81889_connect` attaches to `lsm/socket_connect` and returns `-EPERM` when all of the following hold:

1. The socket type is `SOCK_STREAM`.

2. 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), or `169.254.0.0/16` (link-local and cloud metadata), matching the ranges `validate_address()` forbids.
   - IPv6 `::`, `::1`, IPv4-mapped `::ffff:0:0/96` in any of the IPv4 ranges above, unique-local `fc00::/7`, or link-local `fe80::/10`.

3. The calling task's `comm` or executable name (`mm->exe_file`) is `php`, `php-*` (such as `php-fpm` or `php-cgi`), or `php<digit>*` (such as `php8.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.

The policy: [`cve-2026-81889-ssrf-block.bpf.c`](https://github.com/copper-helm/upatch-registry/tree/main/upatches/cve-2026-81889), 124 lines of BPF C attached at `lsm/socket_connect`, licensed GPL-2.0 OR BSD-2-Clause.

## 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 with `EPERM`.
- 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 to `127.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_php` where the worker process is named `apache2` or `httpd` rather than `php*`.

## 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.

## 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`.

## How it was tested

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

### Results

| 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)                                                 |

## How to apply

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:

```sh
git clone https://github.com/copper-helm/upatch-registry
cd upatch-registry
tools/build <shirudo-checkout> <keys-dir> 1.0.0 upatches/cve-2026-81889
```

Publish and roll out:

```sh
shirudo 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>
```

## Review

- Contributors: romanlab.
- Reviewers: none recorded yet.

## Sources and links

- [CVE-2026-81889 record (CVE API)](https://cveawg.mitre.org/api/cve/CVE-2026-81889)
- [GitHub Security Advisory GHSA-8x3q-jpjh-qh5c](https://github.com/Studio-42/elFinder/security/advisories/GHSA-8x3q-jpjh-qh5c)
- [elFinder 2.1.70 release notes](https://github.com/Studio-42/elFinder/releases/tag/2.1.70)
- [Fix commit 6d997386cd0f](https://github.com/Studio-42/elFinder/commit/6d997386cd0f1abab4706c220b46b0aea0ecff51) and [build commit 191372c1bbeb](https://github.com/Studio-42/elFinder/commit/191372c1bbebbd36fb55af79a84b9984861390ff)

### Links

- [CVE-2026-81889 on upatch.dev](https://upatch.dev/cve/CVE-2026-81889) (this page, as HTML)
- [NVD](https://nvd.nist.gov/vuln/detail/CVE-2026-81889)
- [CVE.org](https://www.cve.org/CVERecord?id=CVE-2026-81889)
- [CWE-918](https://cwe.mitre.org/data/definitions/918.html)
- Upatch source: [upatches/cve-2026-81889](https://github.com/copper-helm/upatch-registry/tree/main/upatches/cve-2026-81889)

### More references from NVD (4)

- [github.com](https://github.com/Studio-42/elFinder/commit/191372c1bbebbd36fb55af79a84b9984861390ff)
- [github.com](https://github.com/Studio-42/elFinder/commit/6d997386cd0f1abab4706c220b46b0aea0ecff51)
- [github.com](https://github.com/Studio-42/elFinder/releases/tag/2.1.70)
- [github.com](https://github.com/Studio-42/elFinder/security/advisories/GHSA-8x3q-jpjh-qh5c)
