upatch.dev

CVE-2026-78381

RansomLook Arbitrary File Read via Path Traversal in Post screen Field

Refuses file opens outside source/ by RansomLook to mitigate CVE-2026-78381.

High 8.2Vetted

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-78381 is a high (CVSS 8.2) vulnerability in RansomLook, published 24 August 2026. A vetted upatch, cve-2026-78381-screen-block, blocks it on running Linux machines with shirudo until RansomLook is upgraded.

Severity
High 8.2 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
RansomLook
Upatch status
Vetted, merged into the registry
How to apply
Build, sign and roll out with shirudo

Overview

CVE-2026-78381 was published on 24 August 2026. In RansomLook through 2.0.0, the GroupPost.get API handler (GET /api/post/<name>/<postname> in website/web/api/genericapi.py) concatenates the database-controlled post["screen"] value directly with str(get_homedir()) + "/source/" and opens the resulting path without checking that the resolved target stays inside source/. Because the screen field is free-form and can be set through the administrative post editor or imported verbatim from a remote RansomLook instance by tools/import_from_instance.py, a traversal sequence such as ../config/generic.json causes GroupPost.get to read arbitrary files outside source/ and return their contents base64-encoded in the API response.

Official description

RansomLook contains a path traversal vulnerability in the handling of the screen field associated with group posts. The GroupPost.get API handler concatenates the database-controlled screen value directly with the application's source/ directory and opens the resulting path without verifying that the resolved file remains within the intended directory. Because the screen field is free-form and can be populated either through the administrative post editor or through data imported from a remote RansomLook instance, a malicious upstream instance can provide traversal sequences such as ../config/generic.json. When the affected post is subsequently retrieved through the API, RansomLook resolves and reads the attacker-controlled path and returns the contents of the referenced file Base64-encoded in the API response. This can allow an attacker (being admin) controlling imported post data to read arbitrary files accessible to the RansomLook process, potentially exposing sensitive configuration data, API credentials, password hashes, or other application secrets. The attack does not require the malicious upstream to possess an account on the affected RansomLook instance. The vulnerability is addressed by resolving screen paths with os.path.realpath() and verifying that the resolved path remains beneath the application's source/ directory. Validation is performed both when values are written and immediately before files are read. Using canonical paths also prevents traversal through symbolic links that would bypass purely lexical path normalization checks.

Affected versions

This is an application vulnerability in RansomLook:

Software Affected Fixed in
RansomLook 0 through 2.0.0 2.1.0 (commit 274faccf65898e88ef54f35f304e0821a852a0b8)

The upatch uses the standard lsm/file_open hook and CO-RE reads against vmlinux.h, so it runs on any Linux kernel with BPF LSM and BTF support.

Sources

More references from NVD (1)

Mitigation

The lsm/file_open program matches processes whose executable name starts with python and whose working directory is named website (how bin/start_website.py starts Gunicorn for the web:app Flask application). When such a process opens a regular file whose dentry has the parent of website (the RansomLook home directory) as an ancestor within 8 directory levels without passing through source, website or ransomlook, the program returns -EPERM. A refusal from an earlier BPF LSM program on the same hook is passed on unchanged.

Side effects

  • While the upatch is loaded, a GroupPost.get request for a post whose screen field traverses out of source/ into the RansomLook home directory (such as ../config/generic.json) fails with PermissionError (EPERM), which Flask returns as HTTP 500 instead of disclosing the file.
  • Reading configuration files under config/ or secret_key after startup from the running website worker processes is refused with EPERM; start_website loads configuration and secret_key at worker import time before requests are served.
  • Posts whose screen field names a file inside source/ (such as screenshots/<group>/<file>.png) and normal API endpoints continue to work.
  • Other processes on the machine are unaffected.

Preemption model and cost

The program keeps no state: no maps, no shared or per-CPU data. It is correct under every preemption model, including preemptible RCU and PREEMPT_RT. On every file_open call by a non-Python process, or by a Python process whose working directory is not website, the program exits after checking the executable name and current working directory dentry name. Only regular file opens by the RansomLook website workers walk up to 8 parent dentries.

The policy

112 lines of BPF C, attached at 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

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

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

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_python_exe(const struct dentry *exe)
{
	const unsigned char *name = BPF_CORE_READ(exe, d_name.name);
	__u32 len = BPF_CORE_READ(exe, d_name.len);
	char buf[8] = {};

	if (!exe || len < 6 || !name)
		return false;
	if (bpf_probe_read_kernel(buf, 6, name))
		return false;
	return buf[0] == 'p' && buf[1] == 'y' && buf[2] == 't' &&
	       buf[3] == 'h' && buf[4] == 'o' && buf[5] == 'n';
}

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

	if (!is_python_exe(exe))
		return false;
	return name_is(pwd, "website", 7);
}

static __always_inline bool is_regular_file(const struct dentry *dentry)
{
	__u16 mode = BPF_CORE_READ(dentry, d_inode, i_mode);

	return (mode & 0170000) == 0100000;
}

static __always_inline bool under_homedir_outside_source(const struct dentry *dentry,
							 const struct dentry *homedir)
{
	const struct dentry *cur = dentry;
	bool saw_source = false;

	if (!cur || !homedir)
		return false;
	for (int i = 0; i < 8; i++) {
		const struct dentry *parent = BPF_CORE_READ(cur, d_parent);

		if (!parent || parent == cur)
			return false;
		if (name_is(parent, "source", 6) ||
		    name_is(parent, "website", 7) ||
		    name_is(parent, "ransomlook", 10))
			saw_source = true;
		if (parent == homedir)
			return !saw_source;
		cur = parent;
	}
	return false;
}

SEC("lsm/file_open")
int BPF_PROG(cve_2026_78381_open, struct file *file, int ret)
{
	const struct dentry *dentry = file->f_path.dentry;
	struct task_struct *task;
	const struct dentry *homedir;

	if (ret)
		return earlier_verdict(ret);
	if (!is_ransomlook_web())
		return 0;
	if (!is_regular_file(dentry))
		return 0;
	task = bpf_get_current_task_btf();
	homedir = BPF_CORE_READ(task, fs, pwd.dentry, d_parent);
	if (under_homedir_outside_source(dentry, homedir))
		return -EPERM;
	return 0;
}

Process

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

  1. 24 Aug 2026CVECVE published
  2. 25 Nov 2026Pull requestPull request #70 openedAdd CVE-2026-78381: Refuses file opens outside source/ by RansomLookromanlab
  3. 25 Nov 2026CIUpdate upatch.devpassed
  4. 25 Nov 2026CICIpassed
  5. 25 Nov 2026ReviewReviewedqodo-code-review[bot] (automated)
  6. 25 Nov 2026MergeMerged #70romanlab

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

Evidence

On RansomLook 2.0.0, the loaded upatch refused opening ../config/generic.json through GroupPost.get while normal post screenshot retrieval inside source/ continued to work.

Tested
25 Nov 2026
Target
RansomLook 2.0.0 website API (GroupPost.get on /api/post/<name>/<postname>), loopback only
Kernel
7.4-shirudo-ci-20261123
Architecture
x86_64
Machine
shirudo test VM
Results
StateTraversal screen (../config/generic.json) blockedNormal screen inside source/ works
Before loadingno (HTTP 200)yes (HTTP 200)
Upatch loadedyes (HTTP 500)yes (HTTP 200)
After unloadingno (HTTP 200)yes (HTTP 200)
tools-test.log Output of tools/test --setup before, while and after loading the upatch.
tools/test --setup, 2026-11-25T14:00:35Z
Target: shirudo test VM, Linux 7.4-shirudo-ci-20261123, x86_64, swtpm
cve-2026-78381
  setup   done         RANSOMLOOK_URL=http://127.0.0.1:8000 RANSOMLOOK_GROUP=probegroup RANSOMLOOK_POST=probepost RANSOMLOOK_NORMAL_POST=normalpost
  before  reached      GroupPost.get read ../config/generic.json outside source/ (HTTP 200)
  loaded  blocked      GroupPost.get failed with HTTP 500 when opening ../config/generic.json
  after   reached      GroupPost.get read ../config/generic.json outside source/ (HTTP 200)
  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-78381
Publish and roll out
shirudo bpm push build/packages/cve-2026-78381-1.0.0.bee oci://<registry>/<namespace>/cve-2026-78381 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-78381-1.0.0.bee oci://<registry>/<namespace>/<tree> --tree-id <tree-id> --keys-dir <keys-dir>