upatch.dev

CVE-2026-86099

Chainlit through 2.12.0 Path Traversal via socket.io sessionId

Refuses file and directory deletion outside the Chainlit .files directory to mitigate CVE-2026-86099.

High 8.8Vetted

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

At a glance

CVE-2026-86099 is a high (CVSS 8.8) vulnerability in Chainlit, published 9 September 2026. A vetted upatch, cve-2026-86099-rmtree-block, blocks it on running Linux machines with shirudo until Chainlit is upgraded.

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

Overview

CVE-2026-86099, published on 9 September 2026, is an unauthenticated path traversal vulnerability (CWE-22) in Chainlit through 2.12.0. In backend/chainlit/socket.py, the connect handler reads the client-supplied sessionId from the Socket.IO auth dictionary and passes it without validation to WebsocketSession. In backend/chainlit/session.py, BaseSession.files_dir constructs the session's upload path as FILES_DIRECTORY / self.id (where FILES_DIRECTORY is <APP_ROOT>/.files). When the session ends and WebsocketSession.delete runs, Chainlit checks self.files_dir.is_dir() and calls shutil.rmtree(self.files_dir). By connecting over Socket.IO with a sessionId containing ../ sequences or an absolute path, an unauthenticated client can point self.files_dir at any directory on the filesystem and cause the Chainlit server process to recursively delete it when the session is cleared.

Official description

Chainlit through 2.12.0 fails to validate the client-supplied socket.io sessionId parameter, allowing unauthenticated attackers to traverse filesystem paths by injecting absolute or relative path sequences. Attackers can craft malicious sessionId values that escape the upload directory and recursively delete arbitrary directories accessible to the service process.

Affected versions

The vulnerable software is the Python package chainlit through 2.12.0 (released 25 August 2026 on PyPI). The upatch attaches to the inode_rmdir and inode_unlink LSM hooks, which take (struct inode *dir, struct dentry *dentry) across mainline Linux kernels with BPF LSM support, including Linux 7.4.

Sources

More references from NVD (5)

Mitigation

Two BPF LSM programs return -EPERM when a task with command name chainlit attempts to remove a directory or unlink a file whose dentry does not have .files as itself or an ancestor within 8 directory levels:

Hook Refused
lsm/inode_rmdir Removing a directory outside .files by a chainlit process
lsm/inode_unlink Unlinking a file outside .files by a chainlit process

Each program checks the current task's comm first (chainlit), so calls from every other process return right away. When the task is chainlit, the program walks dentry->d_parent up to 8 steps and permits the removal only if .files is reached, which covers both per-session cleanup under .files/<session_id> and shutdown cleanup of .files itself. A refusal from an earlier BPF LSM program on the same hook is preserved.

The refused per-CPU array counts refusals: key 0 for inode_rmdir, key 1 for inode_unlink.

Side effects

  • A chainlit process cannot unlink files or remove directories outside a .files directory tree (up to 7 subdirectories deep inside .files). Normal Chainlit session file cleanup and shutdown cleanup of .files continue to work.
  • If a Chainlit application's custom user callback intentionally deletes files or directories outside .files from the chainlit process, those deletions fail with EPERM.
  • Not covered: Chainlit started in a way that sets the process command name to something other than chainlit (for example, invoking python -m uvicorn directly instead of the chainlit CLI entry point).

Preemption model and cost

The programs hold no shared state beyond the per-CPU refusal counters, updated with an atomic fetch-and-add, so they are safe under every kernel preemption model including PREEMPT_LAZY, PREEMPT_DYNAMIC and PREEMPT_RT. On every rmdir and unlink by any process other than chainlit, the cost is a single bpf_get_current_comm check before returning 0.

The policy

111 lines of BPF C, attached at lsm/inode_rmdir and lsm/inode_unlink.

// 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";

enum {
	REFUSED_RMDIR,
	REFUSED_UNLINK,
	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[16] = {};

	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 is_chainlit(void)
{
	char comm[16] = {};

	if (bpf_get_current_comm(&comm, sizeof(comm)))
		return false;
	return comm[0] == 'c' && comm[1] == 'h' && comm[2] == 'a' &&
	       comm[3] == 'i' && comm[4] == 'n' && comm[5] == 'l' &&
	       comm[6] == 'i' && comm[7] == 't' && comm[8] == '\0';
}

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

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

		if (!cur)
			return false;
		if (name_is(cur, ".files", 6))
			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_rmdir")
int BPF_PROG(cve_2026_86099_rmdir, struct inode *dir,
	     struct dentry *dentry, int ret)
{
	if (ret)
		return earlier_verdict(ret);
	if (!is_chainlit() || under_files_dir(dentry))
		return 0;
	count(REFUSED_RMDIR);
	return -EPERM;
}

SEC("lsm/inode_unlink")
int BPF_PROG(cve_2026_86099_unlink, struct inode *dir,
	     struct dentry *dentry, int ret)
{
	if (ret)
		return earlier_verdict(ret);
	if (!is_chainlit() || under_files_dir(dentry))
		return 0;
	count(REFUSED_UNLINK);
	return -EPERM;
}

Process

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

  1. 9 Sept 2026CVECVE published
  2. 25 Nov 2026Pull requestPull request #56 openedAdd CVE-2026-86099: Refuses file and directory deletion outside the Chainlit .files directoryromanlab
  3. 25 Nov 2026CIUpdate upatch.devpassed
  4. 25 Nov 2026CICIpassed
  5. 25 Nov 2026MergeMerged #56romanlab

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

Evidence

On Chainlit 2.12.0, the loaded upatch refused the rmtree directory deletion outside .files triggered by a path-traversal socket.io sessionId while allowing normal .files session cleanup.

Tested
25 Nov 2026
Target
Chainlit 2.12.0 on Python 3.12, loopback only (127.0.0.1:8000)
Kernel
7.4-shirudo-ci-20261123
Architecture
x86_64
Distribution
Ubuntu 26.04
Results
StateTraversal sessionId deletes probe directory outside .filesNormal .files session cleanup
Before loadingyesyes
Upatch loadednoyes
After unloadingyesyes
tools-test.log Output of tools/test --setup showing the payload reached before, blocked while loaded, and reached after.
tools/test --setup, 2026-11-25T13:23:33Z
Target: shirudo test VM, Linux 7.4-shirudo-ci-20261123, x86_64, swtpm
cve-2026-86099
  setup   done         PATH=/opt/upatch-payload/cve-2026-86099/venv/bin:/opt/upatch-payload/cve-2026-86099/uv:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin CHAINLIT_URL=http://127.0.0.1:8000 CHAINLIT_APP_ROOT=/opt/upatch-payload/cve-2026-86099/app
  before  reached      traversal sessionId removed upatch-probe-f8af02960970 outside .files
  loaded  blocked      traversal deletion of upatch-probe-55ff52b3bf11 was refused while normal .files cleanup succeeded
  after   reached      traversal sessionId removed upatch-probe-f8468ad62d0e outside .files
  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-86099
Publish and roll out
shirudo bpm push build/packages/cve-2026-86099-1.0.0.bee oci://<registry>/<namespace>/cve-2026-86099 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-86099-1.0.0.bee oci://<registry>/<namespace>/<tree> --tree-id <tree-id> --keys-dir <keys-dir>