upatch.dev

CVE-2026-87976

Apache NiFi Registry: Improper Limitation of Pathname in Persisted Extension Bundles

Refuses the Apache NiFi Registry extension bundle path traversal write to mitigate CVE-2026-87976.

High 7.2Vetted

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

At a glance

CVE-2026-87976 is a high (CVSS 7.2) vulnerability in Apache NiFi Registry, published 16 September 2026. A vetted upatch, cve-2026-87976-nar-traversal-block, blocks it on running Linux machines with shirudo until Apache NiFi Registry is upgraded.

Severity
High 7.2 CVSS 4.0
Chance of exploitation
0.8% in the next 30 days (EPSS, 24 Nov 2026)
Known exploited
No, not on CISA’s KEV list
Weakness
CWE-22
Affected software
Apache NiFi Registry (Apache Software Foundation)
Upatch status
Vetted, merged into the registry
How to apply
Build, sign and roll out with shirudo

Overview

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.

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.

Sources

More references from NVD (2)

Mitigation

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.

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.

The policy

90 lines of BPF C, attached at lsm/inode_create.

// 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 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 bool is_dotdot_nar_or_cpp(const struct dentry *dentry)
{
	const unsigned char *name = BPF_CORE_READ(dentry, d_name.name);
	__u32 len = BPF_CORE_READ(dentry, d_name.len);
	char head[3] = {};
	char tail[4] = {};

	if (!name || len < 8 || len > 255)
		return false;
	if (bpf_probe_read_kernel(head, sizeof(head), name))
		return false;
	if (head[0] != '.' || head[1] != '.' || head[2] != '-')
		return false;
	if (bpf_probe_read_kernel(tail, sizeof(tail), name + len - 4))
		return false;
	if (tail[0] != '.')
		return false;
	if (tail[1] == 'n' && tail[2] == 'a' && tail[3] == 'r')
		return true;
	if (tail[1] == 'c' && tail[2] == 'p' && tail[3] == 'p')
		return true;
	return false;
}

static __always_inline bool name_is_java(const struct dentry *dentry)
{
	const unsigned char *name = BPF_CORE_READ(dentry, d_name.name);
	char buf[5] = {};

	if (!dentry || BPF_CORE_READ(dentry, d_name.len) != 4 || !name)
		return false;
	if (bpf_probe_read_kernel(buf, 4, name))
		return false;
	return buf[0] == 'j' && buf[1] == 'a' && buf[2] == 'v' && buf[3] == 'a';
}

static __always_inline bool current_is_java(void)
{
	struct task_struct *task = bpf_get_current_task_btf();
	const struct dentry *exe = BPF_CORE_READ(task, mm, exe_file, f_path.dentry);

	return name_is_java(exe);
}

static __always_inline int earlier_verdict(int ret)
{
	return ret >= -4095 && ret < 0 ? ret : -EPERM;
}

SEC("lsm/inode_create")
int BPF_PROG(cve_2026_87976_create, const struct mnt_idmap *idmap,
	     struct inode *dir, struct dentry *dentry, umode_t mode, int ret)
{
	if (ret)
		return earlier_verdict(ret);
	if (!is_dotdot_nar_or_cpp(dentry))
		return 0;
	if (!current_is_java())
		return 0;
	count_refused();
	return -EPERM;
}

Process

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

  1. 16 Sept 2026CVECVE published
  2. 25 Nov 2026Pull requestPull request #48 openedAdd CVE-2026-87976: Refuses the Apache NiFi Registry extension bundle path traversal writeromanlab
  3. 25 Nov 2026MergeMerged #48romanlab
  4. 25 Nov 2026ReviewReviewedqodo-code-review[bot] (automated)

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

Evidence

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
StateTraversal NAR bundle write outside extension_bundles
Before loadingreached (HTTP 200)
Upatch loadedblocked (HTTP 500)
After unloadingreached (HTTP 200)
tools-test.log Output of tools/test --setup for cve-2026-87976 before, while and after the upatch was loaded.
tools/test --setup, 2026-11-25T12:33:48Z
Target: shirudo test VM, Linux 7.4-shirudo-ci-20261123, x86_64, swtpm
cve-2026-87976
  setup   done         NIFI_REGISTRY_URL=http://127.0.0.1:18080 NIFI_REGISTRY_HOME=/opt/upatch-payload/cve-2026-87976/nifi-registry-2.11.0
  before  reached      NAR upload wrote ..-probe-29115f6e-snapshot.nar outside extension_bundles (HTTP 200); removed it
  loaded  blocked      NAR upload failed with HTTP 500 and wrote no file outside extension_bundles
  after   reached      NAR upload wrote ..-probe-02bcef69-snapshot.nar outside extension_bundles (HTTP 200); 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.

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-87976
Publish and roll out
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>