# CVE-2026-86099: Chainlit through 2.12.0 Path Traversal via socket.io sessionId

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

## At a glance

CVE-2026-86099 is rated High 8.8 (CVSS 4.0, CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/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:X/AU:X/R:X/V:X/RE:X/U:X). It affects Chainlit and was published on 9 Sept 2026. It is not in CISA's Known Exploited Vulnerabilities catalog. Its EPSS score is 0.6%: the estimated chance it is exploited in the next 30 days, as of 24 Nov 2026. The upatch `cve-2026-86099-rmtree-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-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.

## What the upatch does

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

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

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

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

## How it was tested

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

| State           | Traversal sessionId deletes probe directory outside .files | Normal .files session cleanup |
| --------------- | ---------------------------------------------------------- | ----------------------------- |
| Before loading  | yes                                                        | yes                           |
| Upatch loaded   | no                                                         | yes                           |
| After unloading | yes                                                        | yes                           |

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

Publish and roll out:

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

## Review

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

## Sources and links

- [CVE-2026-86099 record (CVE API)](https://cveawg.mitre.org/api/cve/CVE-2026-86099)
- [VulnCheck advisory: Chainlit through 2.12.0 Path Traversal via socket.io sessionId](https://www.vulncheck.com/advisories/chainlit-through-2.12.0-path-traversal-via-socket-io-sessionid)
- [Chainlit 2.12.0 `backend/chainlit/session.py`](https://github.com/Chainlit/chainlit/blob/2.12.0/backend/chainlit/session.py)
- [Chainlit 2.12.0 `backend/chainlit/socket.py`](https://github.com/Chainlit/chainlit/blob/2.12.0/backend/chainlit/socket.py)
- [Chainlit 2.12.0 on PyPI](https://pypi.org/project/chainlit/2.12.0/)

### Links

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

### More references from NVD (5)

- [github.com](https://github.com/Chainlit/chainlit)
- [github.com](https://github.com/Chainlit/chainlit/blob/2.12.0/backend/chainlit/session.py)
- [github.com](https://github.com/Chainlit/chainlit/blob/2.12.0/backend/chainlit/socket.py)
- [pypi.org](https://pypi.org/project/chainlit/)
- [vulncheck.com](https://www.vulncheck.com/advisories/chainlit-through-2.12.0-path-traversal-via-socket-io-sessionid)
