upatch.dev

CVE-2026-77621

Vector: Arbitrary file write in the file sink via templated path (path traversal).

Refuses Vector file creation, directory creation and write-mode opens outside /var/log/vector and /var/lib/vector to mitigate CVE-2026-77621.

Critical 9.3Vetted

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

At a glance

CVE-2026-77621 is a critical (CVSS 9.3) vulnerability in Vector, published 22 September 2026. A vetted upatch, cve-2026-77621-vector-block, blocks it on running Linux machines with shirudo until Vector is upgraded.

Severity
Critical 9.3 CVSS 4.0
Chance of exploitation
1.1% in the next 30 days (EPSS, 24 Nov 2026)
Known exploited
No, not on CISA’s KEV list
Weakness
CWE-22, CWE-73
Affected software
Vector (vectordotdev)
Upatch status
Vetted, merged into the registry
How to apply
Build, sign and roll out with shirudo

Overview

CVE-2026-77621 (GHSA-6342-xwvw-c637), published on 22 September 2026, is a path traversal vulnerability in the file sink of Vector from version 0.10.0 before 0.57.0. When a file sink path template references an event field (for example /var/log/vector/{{ service }}.log), FileSink renders the template from incoming event data and passes the resulting path to open_file, which creates missing parent directories with fs::create_dir_all and opens the file for writing without checking that the resolved path stays inside the intended directory. An untrusted event source supplying ../ segments or an absolute path in the templated field causes Vector to create directories and create or overwrite arbitrary files on the filesystem with the privileges of the vector process.

Official description

Vector is a high-performance observability data pipeline. From 0.10.0 until 0.57.0, the file sink renders its templated path from event fields and opens the result without confining it to an intended directory. When an untrusted source supplies an event field used by the path template, the value can contain an absolute path or parent-directory traversal, causing Vector to create parent directories and create or overwrite files outside the intended location with the Vector process privileges. The resulting file write can modify sensitive files and can lead to code execution when a scheduled task, authorization file, or subsequently executed script is targeted. This issue is fixed in version 0.57.0.

Affected versions

Vector versions 0.10.0 to 0.56.0 are affected; 0.57.0 fixes the issue by introducing PathConfinement and base_dir enforcement.

Kernels: the inode_create and inode_mkdir programs use the LSM hook prototypes that take const struct mnt_idmap *idmap as their first argument, matching Linux 6.3 and later (including Linux 7.4).

Sources

More references from NVD (6)

Mitigation

Three BPF LSM programs return -EPERM when a process whose executable is named vector attempts to create directories, create files or open regular files for writing outside /var/log/vector and /var/lib/vector:

Hook Refused
lsm/inode_create Creating a new file whose parent dentry is not under /var/log/vector or /var/lib/vector
lsm/inode_mkdir Creating a directory that is neither /var/log/vector nor /var/lib/vector nor inside either directory
lsm/file_open Opening a regular file with FMODE_WRITE whose parent dentry is not under /var/log/vector or /var/lib/vector

Because the kernel resolves .. components and symlinks during VFS path lookup before calling security_inode_create, security_inode_mkdir and security_file_open, the dentry hierarchy passed to these hooks reflects the resolved target location. Any path that traverses out of /var/log/vector or /var/lib/vector has a parent dentry outside those subtrees and is refused.

The refused per-CPU array counts refusals: key 0 for file creates, key 1 for directory creates and key 2 for write-mode opens.

Side effects

  • Vector can create directories and write or create regular files only inside /var/log/vector and /var/lib/vector (to a directory nesting depth of 16 levels below either base directory). A file sink or data_dir configured to write outside those two directories will fail with Permission denied (EPERM).
  • Reading files, opening sockets, pipes and character devices (such as /dev/null or stdout/stderr) and writing inside /var/log/vector and /var/lib/vector continue to work.
  • Not covered: traversal from one subdirectory of /var/log/vector into another subdirectory of /var/log/vector (or /var/lib/vector), or a Vector binary renamed to something other than vector.

Preemption model and cost

The programs keep no shared state beyond the per-CPU refused counter, updated with an atomic fetch-and-add, so they are safe under every preemption model including PREEMPT_LAZY, PREEMPT_DYNAMIC and PREEMPT_RT. On file_open, read-only opens and non-regular files return after checking file->f_mode and i_mode. On inode_create, inode_mkdir and write-mode regular file opens, non-Vector processes return immediately after checking the current task's executable dentry name (vector).

The policy

155 lines of BPF C, attached at lsm/inode_create and lsm/inode_mkdir and lsm/file_open.

// 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
#define FMODE_WRITE	0x2

char _license[] SEC("license") = "Dual BSD/GPL";

enum {
	REFUSED_CREATE,
	REFUSED_MKDIR,
	REFUSED_OPEN,
	NR_COUNTERS,
};

struct {
	__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
	__uint(max_entries, NR_COUNTERS);
	__type(key, __u32);
	__type(value, __u64);
} refused SEC(".maps");

static __always_inline void count(__u32 key)
{
	__u64 *value = bpf_map_lookup_elem(&refused, &key);

	if (value)
		__sync_fetch_and_add(value, 1);
}

static __always_inline bool name_is(const struct dentry *dentry,
				    const char *want, __u32 want_len)
{
	const unsigned char *name = BPF_CORE_READ(dentry, d_name.name);
	char buf[8] = {};

	if (!dentry || BPF_CORE_READ(dentry, d_name.len) != want_len ||
	    want_len > sizeof(buf) - 1)
		return false;
	if (bpf_probe_read_kernel_str(buf, sizeof(buf), name) < 0)
		return false;
	for (__u32 i = 0; i < sizeof(buf) - 1; i++) {
		if (i == want_len)
			return true;
		if (buf[i] != want[i])
			return false;
	}
	return false;
}

static __always_inline bool current_is_vector(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(exe, "vector", 6);
}

static __always_inline bool is_vector_base_dir(const struct dentry *dir)
{
	const struct dentry *parent;
	const struct dentry *var_dir;
	const struct dentry *root;

	if (!name_is(dir, "vector", 6))
		return false;
	parent = BPF_CORE_READ(dir, d_parent);
	if (!name_is(parent, "log", 3) && !name_is(parent, "lib", 3))
		return false;
	var_dir = BPF_CORE_READ(parent, d_parent);
	if (!name_is(var_dir, "var", 3))
		return false;
	root = BPF_CORE_READ(var_dir, d_parent);
	return root && root == BPF_CORE_READ(root, d_parent);
}

static __always_inline bool inside_vector_base_dir(const struct dentry *dir)
{
	const struct dentry *cur = dir;

	for (int i = 0; i < 16; i++) {
		const struct dentry *parent;

		if (!cur)
			return false;
		if (is_vector_base_dir(cur))
			return true;
		parent = BPF_CORE_READ(cur, d_parent);
		if (parent == cur)
			return false;
		cur = parent;
	}
	return false;
}

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

SEC("lsm/inode_create")
int BPF_PROG(cve_2026_77621_create, const struct mnt_idmap *idmap,
	     struct inode *dir, struct dentry *dentry, umode_t mode, int ret)
{
	if (ret)
		return earlier_verdict(ret);
	if (!current_is_vector())
		return 0;
	if (inside_vector_base_dir(BPF_CORE_READ(dentry, d_parent)))
		return 0;
	count(REFUSED_CREATE);
	return -EPERM;
}

SEC("lsm/inode_mkdir")
int BPF_PROG(cve_2026_77621_mkdir, const struct mnt_idmap *idmap,
	     struct inode *dir, struct dentry *dentry, umode_t mode, int ret)
{
	if (ret)
		return earlier_verdict(ret);
	if (!current_is_vector())
		return 0;
	if (is_vector_base_dir(dentry) ||
	    inside_vector_base_dir(BPF_CORE_READ(dentry, d_parent)))
		return 0;
	count(REFUSED_MKDIR);
	return -EPERM;
}

SEC("lsm/file_open")
int BPF_PROG(cve_2026_77621_open, struct file *file, int ret)
{
	const struct dentry *dentry;
	umode_t mode;

	if (ret)
		return earlier_verdict(ret);
	if (!(file->f_mode & FMODE_WRITE))
		return 0;
	mode = BPF_CORE_READ(file, f_inode, i_mode);
	if ((mode & 0170000) != 0100000)
		return 0;
	if (!current_is_vector())
		return 0;
	dentry = file->f_path.dentry;
	if (inside_vector_base_dir(BPF_CORE_READ(dentry, d_parent)))
		return 0;
	count(REFUSED_OPEN);
	return -EPERM;
}

Process

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

  1. 22 Sept 2026CVECVE published
  2. 25 Nov 2026Pull requestPull request #22 openedAdd CVE-2026-77621: Refuses Vector file creation, directory creation and write-mode opens outsideromanlab
  3. 25 Nov 2026MergeMerged #22romanlab
  4. 25 Nov 2026ReviewReviewedqodo-code-review[bot] (automated)

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

Evidence

On Vector 0.56.0 with a templated file sink path, the loaded upatch refused a path traversal write outside /var/log/vector (HTTP 500) while allowing normal writes inside /var/log/vector.

Tested
25 Nov 2026
Target
Vector 0.56.0 with an http_server source on 127.0.0.1:8686 and a file sink using templated path /var/log/vector/{{ service }}.log
Kernel
7.4-shirudo-ci-20261123
Architecture
x86_64
Distribution
Ubuntu 26.04
Results
StateTraversal write outside /var/log/vector blockedConfined write inside /var/log/vector works
Before loadingno (HTTP 200)yes
Upatch loadedyes (HTTP 500)yes
After unloadingno (HTTP 200)yes
tools-test.log Output of tools/test --setup showing the traversal write succeeding before and after the upatch is loaded and failing with HTTP 500 while it is loaded.
tools/test --setup, 2026-11-25T10:59:51Z
Target: shirudo test VM, Linux 7.4-shirudo-ci-20261123, x86_64, swtpm
cve-2026-77621
  setup   done         VECTOR_URL=http://127.0.0.1:8686/ VECTOR_LOG_DIR=/var/log/vector VECTOR_ESCAPE_DIR=/var/log/vector-escape
  before  reached      path traversal wrote /var/log/vector-escape/upatch-probe-02b56c95afab.log outside /var/log/vector (HTTP 200); removed it
  loaded  blocked      path traversal write outside /var/log/vector was refused (HTTP 500)
  after   reached      path traversal wrote /var/log/vector-escape/upatch-probe-8b1c1df2c5bb.log outside /var/log/vector (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-77621
Publish and roll out
shirudo bpm push build/packages/cve-2026-77621-1.0.0.bee oci://<registry>/<namespace>/cve-2026-77621 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-77621-1.0.0.bee oci://<registry>/<namespace>/<tree> --tree-id <tree-id> --keys-dir <keys-dir>