upatch.dev

CVE-2026-93371

marcopiovanello yt-dlp-web-ui generic.go NewGenericDownload command injection

Refuses unallowlisted yt-dlp arguments and non-yt-dlp execs from yt-dlp-web-ui to mitigate CVE-2026-93371.

Medium 5.5Vetted

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

At a glance

CVE-2026-93371 is a medium (CVSS 5.5) vulnerability in yt-dlp-web-ui, published 18 September 2026. A vetted upatch, cve-2026-93371-exec-block, blocks it on running Linux machines with shirudo until yt-dlp-web-ui is upgraded.

Severity
Medium 5.5 CVSS 4.0
Chance of exploitation
1.4% in the next 30 days (EPSS, 24 Nov 2026)
Known exploited
No, not on CISA’s KEV list
Weakness
CWE-74, CWE-77
Affected software
yt-dlp-web-ui (marcopiovanello)
Upatch status
Vetted, merged into the registry
How to apply
Build, sign and roll out with shirudo

Overview

CVE-2026-93371, published on 18 September 2026, affects marcopiovanello/yt-dlp-web-ui up to v4 (v4.0.0) in NewGenericDownload and GenericDownloader.Start (server/internal/downloaders/generic.go). Prior to commit c7ad3bd79c7c520a7d17e7f2ba19d962be8e7897, argsSanitizer (server/internal/downloaders/utils.go) only stripped arguments matching ${ or && and empty strings, allowing remote callers of the REST /api/v1/exec or JSON-RPC /rpc Service.Exec endpoints to inject arbitrary yt-dlp flags via params (such as --exec, --paths, -P, or --load-info-json) into the exec.CommandContext invocation of yt-dlp.

Official description

A security vulnerability has been detected in marcopiovanello yt-dlp-web-ui up to v4. This issue affects the function NewGenericDownload of the file server/internal/downloaders/generic.go. Such manipulation of the argument params leads to command injection. It is possible to launch the attack remotely. The exploit has been disclosed publicly and may be used. The name of the patch is c7ad3bd79c7c520a7d17e7f2ba19d962be8e7897. A patch should be applied to remediate this issue.

Affected versions

The upatch targets Linux kernels with BTF and BPF LSM support (tested on Linux 7.4). For marcopiovanello/yt-dlp-web-ui, versions up to v4.0.0 are affected; commit c7ad3bd79c7c520a7d17e7f2ba19d962be8e7897 fixes the issue by enforcing allowedFlags in argsSanitizer.

Sources

More references from NVD (6)

Mitigation

A sleepable BPF LSM program on lsm.s/bprm_check_security checks whether the calling task's executable name or command name starts with yt-dlp-web (matching yt-dlp-webui_linux-amd64 and yt-dlp-web-ui). For the initial binary execution (bprm->interp == bprm->filename), it returns -EPERM unless:

  1. The target executable name starts with yt-dlp (and not yt-dlp-web).
  2. Every dash-prefixed argument in argv[1..argc-1] read from the new process user stack (mm->arg_start to mm->arg_end) is in the allowlist of flags permitted by yt-dlp-web-ui (baseParams, -o, --version, --dump-single-json, --simulate, and allowedFlags from commit c7ad3bd79c7c520a7d17e7f2ba19d962be8e7897).

Interpreter passes (bprm->interp != bprm->filename, such as /usr/bin/env or python3 when yt-dlp is a script) are permitted once the initial yt-dlp invocation and its argv have passed the check. Refusals are counted in the refused per-CPU array map at key 0.

Side effects

  • Any download request to yt-dlp-web-ui that includes a flag outside the upstream allowedFlags allowlist (including -P, --paths, --exec, or --cookies) is refused at execve with EPERM.
  • yt-dlp-web-ui cannot execute binaries whose name does not start with yt-dlp.
  • Invocations of yt-dlp with more than 32 arguments or an individual argument of 512 bytes or more are refused.

Preemption model and cost

The program uses a per-CPU array for refusal counting updated with __sync_fetch_and_add and a per-CPU scratch buffer while running on lsm.s/bprm_check_security. On all execve calls by processes other than yt-dlp-web-ui, the program checks the calling task's executable dentry name and comm and returns immediately without reading user memory.

The policy

259 lines of BPF C, attached at lsm.s/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
#define ARG_BUF_SIZE	512
#define MAX_ARGS	32

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

enum {
	REFUSED_EXEC,
	NR_COUNTERS,
};

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

struct {
	__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
	__uint(max_entries, 1);
	__type(key, __u32);
	__type(value, char[ARG_BUF_SIZE]);
} scratch 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 int earlier_verdict(int ret)
{
	return ret >= -4095 && ret < 0 ? ret : -EPERM;
}

static __always_inline bool dentry_prefix_is(const struct dentry *dentry,
					     const char *want, __u32 want_len)
{
	const unsigned char *name = BPF_CORE_READ(dentry, d_name.name);
	__u32 len = BPF_CORE_READ(dentry, d_name.len);
	char buf[16] = {};

	if (!dentry || len < want_len || want_len > sizeof(buf) - 1)
		return false;
	if (bpf_probe_read_kernel(buf, sizeof(buf), name))
		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 caller_is_yt_dlp_webui(void)
{
	struct task_struct *task = bpf_get_current_task_btf();
	const struct dentry *exe = BPF_CORE_READ(task, mm, exe_file, f_path.dentry);
	char comm[16] = {};

	if (dentry_prefix_is(exe, "yt-dlp-web", 10))
		return true;
	if (bpf_get_current_comm(comm, sizeof(comm)))
		return false;
	return comm[0] == 'y' && comm[1] == 't' && comm[2] == '-' &&
	       comm[3] == 'd' && comm[4] == 'l' && comm[5] == 'p' &&
	       comm[6] == '-' && comm[7] == 'w' && comm[8] == 'e' &&
	       comm[9] == 'b';
}

static __always_inline bool target_is_yt_dlp(const struct file *file)
{
	const struct dentry *dentry = BPF_CORE_READ(file, f_path.dentry);

	return dentry_prefix_is(dentry, "yt-dlp", 6) &&
	       !dentry_prefix_is(dentry, "yt-dlp-web", 10);
}

static __always_inline bool str_eq(const char *s, __u32 len, const char *lit, __u32 lit_len)
{
	if (len != lit_len)
		return false;
	for (__u32 i = 0; i < 40; i++) {
		if (i == lit_len)
			return true;
		if (s[i] != lit[i])
			return false;
	}
	return false;
}

static __noinline bool flag_allowed(const char *arg, __u32 len)
{
	if (len < 2 || arg[0] != '-')
		return true;
	if (len == 2) {
		char c = arg[1];
		return c == 'f' || c == 'S' || c == 'F' || c == 'I' ||
		       c == 'N' || c == 'r' || c == 'R' || c == 'v' ||
		       c == 'o';
	}
	if (arg[1] != '-')
		return false;
	return str_eq(arg, len, "--newline", 9) ||
	       str_eq(arg, len, "--no-colors", 11) ||
	       str_eq(arg, len, "--no-playlist", 13) ||
	       str_eq(arg, len, "--progress-template", 19) ||
	       str_eq(arg, len, "--js-runtimes", 13) ||
	       str_eq(arg, len, "--remote-components", 19) ||
	       str_eq(arg, len, "--no-exec", 9) ||
	       str_eq(arg, len, "--format", 8) ||
	       str_eq(arg, len, "--format-sort", 13) ||
	       str_eq(arg, len, "--format-sort-reset", 19) ||
	       str_eq(arg, len, "--format-sort-force", 19) ||
	       str_eq(arg, len, "--no-format-sort-force", 22) ||
	       str_eq(arg, len, "--video-multistreams", 20) ||
	       str_eq(arg, len, "--no-video-multistreams", 23) ||
	       str_eq(arg, len, "--audio-multistreams", 20) ||
	       str_eq(arg, len, "--no-audio-multistreams", 23) ||
	       str_eq(arg, len, "--prefer-free-formats", 21) ||
	       str_eq(arg, len, "--no-prefer-free-formats", 24) ||
	       str_eq(arg, len, "--check-formats", 15) ||
	       str_eq(arg, len, "--check-all-formats", 19) ||
	       str_eq(arg, len, "--no-check-formats", 18) ||
	       str_eq(arg, len, "--list-formats", 14) ||
	       str_eq(arg, len, "--merge-output-format", 21) ||
	       str_eq(arg, len, "--playlist-items", 16) ||
	       str_eq(arg, len, "--min-filesize", 14) ||
	       str_eq(arg, len, "--max-filesize", 14) ||
	       str_eq(arg, len, "--date", 6) ||
	       str_eq(arg, len, "--datebefore", 12) ||
	       str_eq(arg, len, "--dateafter", 11) ||
	       str_eq(arg, len, "--match-filters", 15) ||
	       str_eq(arg, len, "--no-match-filters", 18) ||
	       str_eq(arg, len, "--break-match-filters", 21) ||
	       str_eq(arg, len, "--no-break-match-filters", 24) ||
	       str_eq(arg, len, "--yes-playlist", 14) ||
	       str_eq(arg, len, "--age-limit", 11) ||
	       str_eq(arg, len, "--max-downloads", 15) ||
	       str_eq(arg, len, "--playlist-random", 17) ||
	       str_eq(arg, len, "--concurrent-fragments", 22) ||
	       str_eq(arg, len, "--limit-rate", 12) ||
	       str_eq(arg, len, "--throttled-rate", 16) ||
	       str_eq(arg, len, "--retries", 9) ||
	       str_eq(arg, len, "--fragment-retries", 18) ||
	       str_eq(arg, len, "--retry-sleep", 13) ||
	       str_eq(arg, len, "--skip-unavailable-fragments", 28) ||
	       str_eq(arg, len, "--abort-on-unavailable-fragments", 32) ||
	       str_eq(arg, len, "--buffer-size", 13) ||
	       str_eq(arg, len, "--resize-buffer", 15) ||
	       str_eq(arg, len, "--no-resize-buffer", 18) ||
	       str_eq(arg, len, "--http-chunk-size", 17) ||
	       str_eq(arg, len, "--download-sections", 19) ||
	       str_eq(arg, len, "--hls-use-mpegts", 16) ||
	       str_eq(arg, len, "--no-hls-use-mpegts", 19) ||
	       str_eq(arg, len, "--write-subs", 12) ||
	       str_eq(arg, len, "--no-write-subs", 15) ||
	       str_eq(arg, len, "--write-auto-subs", 17) ||
	       str_eq(arg, len, "--no-write-auto-subs", 20) ||
	       str_eq(arg, len, "--list-subs", 11) ||
	       str_eq(arg, len, "--sub-format", 12) ||
	       str_eq(arg, len, "--sub-langs", 11) ||
	       str_eq(arg, len, "--convert-subs", 14) ||
	       str_eq(arg, len, "--write-thumbnail", 17) ||
	       str_eq(arg, len, "--write-all-thumbnails", 22) ||
	       str_eq(arg, len, "--convert-thumbnails", 20) ||
	       str_eq(arg, len, "--embed-subs", 12) ||
	       str_eq(arg, len, "--embed-thumbnail", 17) ||
	       str_eq(arg, len, "--embed-metadata", 16) ||
	       str_eq(arg, len, "--embed-chapters", 16) ||
	       str_eq(arg, len, "--embed-info-json", 17) ||
	       str_eq(arg, len, "--write-description", 19) ||
	       str_eq(arg, len, "--audio-format", 14) ||
	       str_eq(arg, len, "--audio-quality", 15) ||
	       str_eq(arg, len, "--remux-video", 13) ||
	       str_eq(arg, len, "--recode-video", 14) ||
	       str_eq(arg, len, "--split-chapters", 16) ||
	       str_eq(arg, len, "--no-split-chapters", 19) ||
	       str_eq(arg, len, "--remove-chapters", 17) ||
	       str_eq(arg, len, "--no-remove-chapters", 20) ||
	       str_eq(arg, len, "--force-keyframes-at-cuts", 25) ||
	       str_eq(arg, len, "--no-force-keyframes-at-cuts", 28) ||
	       str_eq(arg, len, "--fixup", 7) ||
	       str_eq(arg, len, "--sponsorblock-mark", 19) ||
	       str_eq(arg, len, "--sponsorblock-remove", 21) ||
	       str_eq(arg, len, "--sponsorblock-chapter-title", 28) ||
	       str_eq(arg, len, "--no-sponsorblock", 17) ||
	       str_eq(arg, len, "--verbose", 9) ||
	       str_eq(arg, len, "--version", 9) ||
	       str_eq(arg, len, "--dump-single-json", 18) ||
	       str_eq(arg, len, "--simulate", 10);
}

static __noinline bool args_allowed(struct task_struct *task, int argc)
{
	unsigned long arg_start = BPF_CORE_READ(task, mm, arg_start);
	unsigned long arg_end = BPF_CORE_READ(task, mm, arg_end);
	unsigned long pos = arg_start;
	__u32 zero = 0;
	char *buf;

	if (!arg_start || arg_end <= arg_start || argc < 1 || argc > MAX_ARGS)
		return false;
	buf = bpf_map_lookup_elem(&scratch, &zero);
	if (!buf)
		return false;
	for (int i = 0; i < MAX_ARGS; i++) {
		long n;
		__u32 len;

		if (i >= argc || pos >= arg_end)
			break;
		n = bpf_probe_read_user_str(buf, ARG_BUF_SIZE, (const void *)pos);
		if (n <= 0)
			return false;
		len = (__u32)(n - 1);
		if (i > 0 && len > 0 && buf[0] == '-') {
			if (!flag_allowed(buf, len))
				return false;
		}
		pos += (__u32)n;
	}
	return true;
}

SEC("lsm.s/bprm_check_security")
int BPF_PROG(cve_2026_93371_exec, struct linux_binprm *bprm, int ret)
{
	struct task_struct *task;

	if (ret)
		return earlier_verdict(ret);
	if (!caller_is_yt_dlp_webui())
		return 0;
	if (bprm->interp != bprm->filename)
		return 0;
	if (!bprm->file || !target_is_yt_dlp(bprm->file)) {
		count(REFUSED_EXEC);
		return -EPERM;
	}
	task = bpf_get_current_task_btf();
	if (!args_allowed(task, bprm->argc)) {
		count(REFUSED_EXEC);
		return -EPERM;
	}
	return 0;
}

Process

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

  1. 18 Sept 2026CVECVE published
  2. 25 Nov 2026Pull requestPull request #23 openedAdd CVE-2026-93371: Refuses unallowlisted yt-dlp arguments and non-yt-dlp execs from yt-dlp-web-uiromanlab
  3. 25 Nov 2026MergeMerged #23romanlab
  4. 25 Nov 2026ReviewReviewedqodo-code-review[bot] (automated)

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

Evidence

On a vulnerable yt-dlp-web-ui v4.0.0, the loaded upatch refused executing yt-dlp with unallowlisted command-line flags injected via NewGenericDownload params, and execution succeeded again after unloading.

Tested
25 Nov 2026
Target
marcopiovanello yt-dlp-web-ui v4.0.0 listening on 127.0.0.1:3033
Kernel
7.4-shirudo-ci-20261123
Architecture
x86_64
Distribution
Ubuntu 26.04
Results
StateUnallowlisted yt-dlp flag executed via NewGenericDownload params
Before loadingreached
Upatch loadedblocked
After unloadingreached
tools-test.log Output of tools/test --setup before, while and after the upatch was loaded.
tools/test --setup, 2026-11-25T11:07:16Z
Target: shirudo test VM, Linux 7.4-shirudo-ci-20261123, x86_64, swtpm
cve-2026-93371
  setup   done         YTDLP_WEBUI_URL=http://127.0.0.1:3033 YTDLP_ARGS_LOG=/opt/upatch-payload/cve-2026-93371/args.log
  before  reached      yt-dlp executed with unallowlisted flag --ignore-config
  loaded  blocked      the upatch refused executing yt-dlp with --ignore-config
  after   reached      yt-dlp executed with unallowlisted flag --ignore-config
  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-93371
Publish and roll out
shirudo bpm push build/packages/cve-2026-93371-1.0.0.bee oci://<registry>/<namespace>/cve-2026-93371 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-93371-1.0.0.bee oci://<registry>/<namespace>/<tree> --tree-id <tree-id> --keys-dir <keys-dir>