upatch.dev

CVE-2026-90770

Spug through 3.4.0 Remote Code Execution via ping_check

Refuses shell execution by Spug to mitigate CVE-2026-90770.

High 8.7Vetted

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

At a glance

CVE-2026-90770 is a high (CVSS 8.7) vulnerability in Spug, published 13 September 2026. A vetted upatch, cve-2026-90770-spug-block, blocks it on running Linux machines with shirudo until Spug is upgraded.

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

Overview

CVE-2026-90770, "Spug through 3.4.0 Remote Code Execution via ping_check", was published on 13 September 2026. In spug_api/apps/monitor/executors.py, ping_check(addr) builds f'ping -c 1 -W 3 {addr}' and runs it with subprocess.run(command, shell=True, stdout=subprocess.PIPE). The run_test view in spug_api/apps/monitor/views.py passes form.targets[0] from a request to /monitor/test/ directly to dispatch(), which calls ping_check() when form.type == '5'. An authenticated user with the monitor.monitor.add or monitor.monitor.edit permission can supply shell metacharacters in targets[0] and execute arbitrary commands as the Spug process user.

Official description

Spug through 3.4.0 contains a remote code execution vulnerability in the ping_check function that interpolates user-supplied monitor addresses directly into shell commands without validation. Authenticated users with monitor permissions can inject shell metacharacters via the /monitor/run_test/ endpoint to execute arbitrary commands as the Spug process user.

Affected versions

Software Affected Fixed in
openspug/spug through 3.4.0 4.0.0 (commit 97aebf133e1f)

Affected kernels: any Linux kernel supported by shirudo with BPF LSM and BTF enabled.

Sources

More references from NVD (6)

Mitigation

The BPF LSM program attaches to lsm/bprm_check_security and returns -EPERM when a Spug backend process (a Python or WSGI server process whose working directory is spug_api) attempts to execute a shell (sh, dash, or bash).

In Spug through 3.4.0, ping_check() passes shell=True to subprocess.run(), which executes /bin/sh -c "ping -c 1 -W 3 ...". Refusing the shell execution makes subprocess.run() raise PermissionError before the shell or any injected command can run, and ping_check() catches the exception and returns a failure message. In Spug 4.0.0 and later, commit 97aebf133e1f validates the host address with is_valid_host() and runs ['ping', '-c', '1', '-W', '3', addr] without shell=True, executing ping directly without a shell.

The refused per-CPU array counts refused shell executions at key 0.

Side effects

  • Any ping monitor check (type == '5') in an unpatched Spug through 3.4.0 fails with PermissionError: [Errno 1] Operation not permitted: '/bin/sh' because the unpatched ping_check() uses shell=True.
  • Site checks (site_check), TCP port checks (port_check), and remote SSH checks (host_executor) continue to work, as they use Python sockets, requests, and Paramiko rather than a local shell.
  • Patched Spug releases (4.0.0 and later) execute ping directly without shell=True, so ping checks work normally even with the upatch loaded.
  • Other processes on the machine, including root shells and sshd, are unaffected because the program checks that the task's working directory is spug_api and its executable or command name is the Spug Python/WSGI server.

Preemption model and cost

The program keeps no state beyond the refused per-CPU counter, which is updated with an atomic fetch-and-add (__sync_fetch_and_add), so it is safe under every kernel preemption model, including preemptible RCU, PREEMPT_LAZY, and PREEMPT_RT. It runs only on execve via lsm/bprm_check_security, checks the target binary's dentry name length and bytes first, and returns immediately for any executable other than sh, dash, or bash.

The policy

108 lines of BPF C, attached at lsm/bprm_check_security.

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

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

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

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

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_shell(const struct dentry *dentry)
{
	return name_is(dentry, "sh", 2) ||
	       name_is(dentry, "dash", 4) ||
	       name_is(dentry, "bash", 4);
}

static __always_inline bool comm_is(const char *comm, const char *want,
				    __u32 want_len)
{
	for (__u32 i = 0; i < 16; i++) {
		if (i == want_len)
			return comm[i] == '\0';
		if (comm[i] != want[i])
			return false;
	}
	return false;
}

static __always_inline bool current_is_spug(void)
{
	struct task_struct *task = bpf_get_current_task_btf();
	const struct dentry *pwd = BPF_CORE_READ(task, fs, pwd.dentry);
	const struct dentry *exe = BPF_CORE_READ(task, mm, exe_file, f_path.dentry);
	char comm[16] = {};

	if (!name_is(pwd, "spug_api", 8))
		return false;
	if (name_is(exe, "python3", 7) || name_is(exe, "python", 6) ||
	    name_is(exe, "gunicorn", 8) || name_is(exe, "uwsgi", 5))
		return true;
	if (bpf_get_current_comm(&comm, sizeof(comm)) < 0)
		return false;
	return comm_is(comm, "manage.py", 9) ||
	       comm_is(comm, "gunicorn", 8) ||
	       comm_is(comm, "uwsgi", 5) ||
	       comm_is(comm, "daphne", 6) ||
	       comm_is(comm, "python3", 7) ||
	       comm_is(comm, "python", 6);
}

SEC("lsm/bprm_check_security")
int BPF_PROG(cve_2026_90770_spug_block, struct linux_binprm *bprm, int ret)
{
	const struct dentry *dentry = BPF_CORE_READ(bprm, file, f_path.dentry);

	if (ret)
		return earlier_verdict(ret);
	if (!is_shell(dentry))
		return 0;
	if (!current_is_spug())
		return 0;
	count_refused();
	return -EPERM;
}

Process

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

  1. 13 Sept 2026CVECVE published
  2. 25 Nov 2026Pull requestPull request #26 openedAdd CVE-2026-90770: Refuses shell execution by Spugromanlab
  3. 25 Nov 2026MergeMerged #26romanlab
  4. 25 Nov 2026ReviewReviewedqodo-code-review[bot] (automated)

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

Evidence

On a vulnerable Spug 3.4.0 instance, the loaded upatch refused the /bin/sh execution triggered by ping_check on /monitor/test/ with EPERM, while the ping check succeeded before loading and after unloading.

Tested
25 Nov 2026
Target
Spug 3.4.0 (spug_api) on Python 3.12, listening on 127.0.0.1:9001
Kernel
7.4-shirudo-ci-20261123
Architecture
x86_64
Distribution
Ubuntu 26.04
Results
StatePOST /monitor/test/ (type 5, ping_check) spawns /bin/sh
Before loadingreached (Ping检测正常)
Upatch loadedblocked (EPERM on /bin/sh)
After unloadingreached (Ping检测正常)
tools-test.log Output of tools/test --setup running the probe before, while, and after the upatch is loaded.
tools/test --setup, 2026-11-25T11:15:53Z
Target: shirudo test VM, Linux 7.4-shirudo-ci-20261123, x86_64, swtpm
cve-2026-90770
  setup   done         SPUG_URL=http://127.0.0.1:9001 SPUG_TOKEN=0123456789abcdef0123456789abcdef
  before  reached      ping_check executed shell command (Ping检测正常)
  loaded  blocked      ping_check shell execution refused (异常信息:[Errno 1] Operation not permitted: '/bin/sh')
  after   reached      ping_check executed shell command (Ping检测正常)
  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-90770
Publish and roll out
shirudo bpm push build/packages/cve-2026-90770-1.0.0.bee oci://<registry>/<namespace>/cve-2026-90770 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-90770-1.0.0.bee oci://<registry>/<namespace>/<tree> --tree-id <tree-id> --keys-dir <keys-dir>