# CVE-2026-87976: Apache NiFi Registry: Improper Limitation of Pathname in Persisted Extension Bundles

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

## At a glance

CVE-2026-87976 is rated High 7.2 (CVSS 4.0, CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:P/AU:Y/R:U/V:C/RE:X/U:X). It affects Apache NiFi Registry (Apache Software Foundation) and was published on 16 Sept 2026. It is not in CISA's Known Exploited Vulnerabilities catalog. Its EPSS score is 0.8%: the estimated chance it is exploited in the next 30 days, as of 24 Nov 2026. The upatch `cve-2026-87976-nar-traversal-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-87976, "Apache NiFi Registry: Improper Limitation of Pathname in Persisted Extension Bundles", was published on 16 September 2026 (NIFI-16329). In Apache NiFi Registry 0.4.0 through 2.11.0, `FileSystemBundlePersistenceProvider` constructs the storage directory and bundle filename from the `Nar-Group`, `Nar-Id`, and `Nar-Version` coordinates in an uploaded NAR manifest without rejecting parent-directory segments (`..`). In `FileSystemBundlePersistenceProvider.getArtifactPath`, `Paths.get(bucketId, sanitize(groupId), sanitize(artifactId)).normalize()` collapses the bucket path component and resolves to `..` when both `groupId` and `artifactId` are `..`, while `getChildLocation` compares unnormalized `parentPath.resolve(childLocation.normalize())` via `Path.startsWith`, which passes because `storage/..` still starts with `storage` before normalization. That lets an authenticated user authorized to write and delete bundles in a bucket write a bundle file named `..-<version>.nar` outside the configured `Extension Bundle Storage Directory`, and subsequently delete files in that parent directory via `deleteAllBundleVersions`.

### Official description

Apache NiFi Registry 0.4.0 through 2.11.0 are subject to path manipulation when storing extension bundle content using group, artifact, and version coordinates from uploaded NAR manifests. The default file persistence provider used coordinates as filesystem path components without rejected parent-directory names, and the path-containment check compared an unnormalized resolved path. An authenticated user authorized to write and delete bundles in a bucket can upload a NAR with a crafted manifest resulting in file system operations outside of the file persistence directory. Upgrading to Apache NiFi Registry 2.12.0 is the recommended mitigation, which rejects parent-directory coordinates and requires a normalized path to remain a strict child of the storage root location.

## What the upatch does

One BPF LSM program attached to `lsm/inode_create` returns `-EPERM` to processes whose executable is named `java` when creating a file whose name starts with `..-` and ends with `.nar` or `.cpp`:

| Hook               | Refused                                                                      |
| ------------------ | ---------------------------------------------------------------------------- |
| `lsm/inode_create` | Creating a `..-<version>.nar` or `..-<version>.cpp` file by a `java` process |

In `FileSystemBundlePersistenceProvider.getBundleFile`, the persisted bundle filename is constructed as `sanitize(artifactId) + "-" + sanitize(version) + bundleFileExtension` (`.nar` or `.cpp`). Escaping the bucket subdirectory in `getArtifactPath` requires `artifactId` to be `..`, which always produces a filename starting with `..-` and ending in `.nar` or `.cpp`. When `inode_create` returns `-EPERM`, `FileOutputStream` throws `FileNotFoundException` inside `saveOrUpdateBundleVersion`, rolling back the upload transaction so no bundle record or file outside the storage directory is created.

The `refused` per-CPU array counts refused file creations at key 0.

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

## Side effects

- Uploading a NAR or MiNiFi C++ extension bundle whose `Nar-Id` (artifact ID) is `..` fails with HTTP 500 when NiFi Registry attempts to create the `..-<version>.nar` or `..-<version>.cpp` file. Normal extension bundles with valid artifact IDs keep working.
- Fixed Apache NiFi Registry releases (2.12.0 and later) reject `.` and `..` coordinates in `BundleUtils.validateCoordinateField` and `FileSystemBundlePersistenceProvider.sanitize` before touching the filesystem.

## Preemption model and cost

The program keeps no shared state beyond the per-CPU `refused` counter, updated with `__sync_fetch_and_add`, so it is safe under every preemption model including `PREEMPT_LAZY`, preemptible RCU, and `PREEMPT_RT`. On normal `inode_create` calls, the program checks the dentry name length and first three bytes (`..-`) and returns immediately when they do not match.

## Affected versions

Apache NiFi Registry:

| Product                                                                   | Affected        | Fixed in |
| ------------------------------------------------------------------------- | --------------- | -------- |
| Apache NiFi Registry (`org.apache.nifi.registry:nifi-registry-framework`) | 0.4.0 to 2.11.0 | 2.12.0   |

Affected kernels: Linux kernels with BPF LSM and the four-argument `inode_create` LSM hook taking `const struct mnt_idmap *idmap` first.

## How it was tested

On a vulnerable Apache NiFi Registry 2.11.0, the loaded upatch refused the NAR bundle creation outside extension_bundles when uploading a bundle with parent-directory coordinates, while uploads before loading and after unloading wrote the traversal file.

- **Tested:** 25 Nov 2026
- **Target:** Apache NiFi Registry 2.11.0 on OpenJDK 21, FileSystemBundlePersistenceProvider, loopback only
- **Kernel:** 7.4-shirudo-ci-20261123
- **Architecture:** x86_64
- **Distribution:** Ubuntu 26.04

### Results

| State           | Traversal NAR bundle write outside extension_bundles |
| --------------- | ---------------------------------------------------- |
| Before loading  | reached (HTTP 200)                                   |
| Upatch loaded   | blocked (HTTP 500)                                   |
| After unloading | reached (HTTP 200)                                   |

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

Publish and roll out:

```sh
shirudo bpm push build/packages/cve-2026-87976-1.0.0.bee oci://<registry>/<namespace>/cve-2026-87976 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-87976-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-87976 advisory on Apache lists](https://lists.apache.org/thread/kw89toml5zq20ry3279mx7y184vrlb8x)
- [oss-security announcement](http://www.openwall.com/lists/oss-security/2026/09/16/11)
- [NIFI-16329 pull request #11662](https://github.com/apache/nifi/pull/11662) and commit [`441d218ad667`](https://github.com/apache/nifi/commit/441d218ad667cdc0504e5472ca66a4e8cc26bcb7)
- [Apache NiFi 2.11.0 release archive](https://archive.apache.org/dist/nifi/2.11.0/nifi-registry-2.11.0-bin.zip)

### Links

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

### More references from NVD (2)

- [lists.apache.org](https://lists.apache.org/thread/kw89toml5zq20ry3279mx7y184vrlb8x) (Mailing List, Vendor Advisory)
- [openwall.com](http://www.openwall.com/lists/oss-security/2026/09/16/11) (Mailing List, Third Party Advisory)
