# CVE-2026-90774: rustypaste before 0.18.1 Path Traversal via filename header

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

## At a glance

CVE-2026-90774 is rated High 8.7 (CVSS 4.0, CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/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 rustypaste (orhun) and was published on 13 Sept 2026. It is not in CISA's Known Exploited Vulnerabilities catalog. Its EPSS score is 1.4%: the estimated chance it is exploited in the next 30 days, as of 24 Nov 2026. The upatch `cve-2026-90774-upload-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-90774 is a path traversal vulnerability in `rustypaste` versions before 0.18.1, published on 13 September 2026. In `Paste::store_file` (`src/paste.rs`), `rustypaste` validates the initial upload filename against the upload directory with `util::safe_path_join`, and then applies the optional custom `filename` HTTP request header with `path.set_file_name(file_name)` without re-running `util::safe_path_join`. An attacker who sends a `POST /` multipart upload with `../` traversal sequences in the `filename` header escapes the upload directory and causes `File::create(&path)` (and, for `protected` pastes, `password::store_password_hash`) to create or truncate and overwrite arbitrary files that the `rustypaste` process can write.

### Official description

rustypaste before 0.18.1 validates the destination path before applying the optional custom filename HTTP header, allowing attackers to bypass directory-escape checks. Attackers can supply path traversal sequences in the filename header to write files outside the configured upload directory to arbitrary locations.

## What the upatch does

Three BPF LSM programs return `-EPERM` to processes whose executable is named `rustypaste` when the target dentry is not directly inside a directory named `upload` or one of its four paste-type subdirectories (`upload/url`, `upload/oneshot`, `upload/oneshot_url`, `upload/protected`):

| Hook                | Refused                                                                                         |
| ------------------- | ----------------------------------------------------------------------------------------------- |
| `lsm/inode_create`  | Creating a new regular file outside `upload/` and its four paste subdirectories                 |
| `lsm/file_open`     | Opening an existing file with `FMODE_WRITE` outside `upload/` and its four paste subdirectories |
| `lsm/inode_setattr` | Truncating (`ATTR_SIZE`) an existing file outside `upload/` and its four paste subdirectories   |

Together, these three hooks cover both new files (`inode_create`) and existing files opened with `O_CREAT | O_WRONLY | O_TRUNC` by `std::fs::File::create` (`file_open` and `inode_setattr`). Each program checks the cheapest condition first (`FMODE_WRITE` on `file_open`, `ATTR_SIZE` on `inode_setattr`, then the executable name `rustypaste`) and returns `0` for all other processes. Any negative return value from an earlier BPF LSM program on the same hook is preserved.

The `refused` per-CPU array counts refusals: key 0 for `inode_create`, key 1 for `file_open`, and key 2 for `inode_setattr`.

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

## Side effects

- Any upload whose `filename` header resolves outside `upload/` (or its `url`, `oneshot`, `oneshot_url`, `protected` subdirectories) fails with HTTP 403 (`Forbidden`, from `ErrorKind::PermissionDenied` when the kernel returns `-EPERM`) instead of writing the file.
- Normal file uploads (`file`, `oneshot`, `remote`, `protected`), URL shortener pastes (`url`, `oneshot_url`), custom `filename` headers that stay inside `upload/`, file serving, oneshot file renames, and file deletions continue to work when `upload_path` is named `upload` (the default `./upload`).
- Not covered or restricted: a deployment that renames `upload_path` to a directory whose final component is not `upload` will have its uploads refused while the upatch is loaded, and a binary renamed away from `rustypaste` is not matched.

## Preemption model and cost

The programs keep no shared state beyond the per-CPU `refused` counter, which is updated with `__sync_fetch_and_add`, so they are safe under every preemption model including `PREEMPT_LAZY`, `PREEMPT_DYNAMIC` and `PREEMPT_RT`. On `file_open` and `inode_setattr`, read-only opens and non-size attribute changes return after a single bit test on the hook's arguments; on `inode_create` and write paths, non-`rustypaste` processes return after comparing the current task's executable dentry length and name.

## Affected versions

`rustypaste`:

| Versions                        | Status   |
| ------------------------------- | -------- |
| `< 0.18.1` (including `0.18.0`) | Affected |
| `>= 0.18.1`                     | Fixed    |

Kernels: the `inode_create` and `inode_setattr` LSM hooks use the `const struct mnt_idmap *` first parameter present in mainline Linux kernels with idmapped mounts.

## How it was tested

On rustypaste 0.18.0, the loaded upatch refused a multipart upload whose filename header traversed out of the upload directory (HTTP 403), while normal uploads into the upload directory continued to succeed (HTTP 200).

- **Tested:** 25 Nov 2026
- **Target:** rustypaste 0.18.0 with upload_path=./upload, listening on 127.0.0.1:8000
- **Kernel:** 7.4-shirudo-ci-20261123
- **Architecture:** x86_64
- **Distribution:** Ubuntu 26.04

### Results

| State           | Path traversal via filename header writes outside upload/ | Normal upload into upload/ |
| --------------- | --------------------------------------------------------- | -------------------------- |
| Before loading  | yes (HTTP 200)                                            | 200                        |
| Upatch loaded   | no (HTTP 403)                                             | 200                        |
| After unloading | yes (HTTP 200)                                            | 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-90774
```

Publish and roll out:

```sh
shirudo bpm push build/packages/cve-2026-90774-1.0.0.bee oci://<registry>/<namespace>/cve-2026-90774 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-90774-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-90774 record (CVE API)](https://cveawg.mitre.org/api/cve/CVE-2026-90774)
- [VulnCheck advisory: rustypaste before 0.18.1 Path Traversal via filename header](https://www.vulncheck.com/advisories/rustypaste-before-0.18.1-path-traversal-via-filename-header)
- [rustypaste issue #622](https://github.com/orhun/rustypaste/issues/622)
- [Fix commit ac05d552596af4a8429d80f30d11f67117ce02c8](https://github.com/orhun/rustypaste/commit/ac05d552596af4a8429d80f30d11f67117ce02c8)
- [Vulnerable code in v0.18.0 `src/paste.rs`](https://github.com/orhun/rustypaste/blob/v0.18.0/src/paste.rs)
- [rustypaste v0.18.1 release](https://github.com/orhun/rustypaste/releases/tag/v0.18.1)

### Links

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

### More references from NVD (5)

- [github.com](https://github.com/orhun/rustypaste)
- [github.com](https://github.com/orhun/rustypaste/blob/v0.18.0/src/paste.rs)
- [github.com](https://github.com/orhun/rustypaste/commit/ac05d552596af4a8429d80f30d11f67117ce02c8)
- [github.com](https://github.com/orhun/rustypaste/issues/622)
- [vulncheck.com](https://www.vulncheck.com/advisories/rustypaste-before-0.18.1-path-traversal-via-filename-header)
