upatch.dev

CVE-2026-85608

Douyin_TikTok_Download_API 4.1.2 SSRF via url parameter

Refuses outbound connections from Douyin_TikTok_Download_API to loopback, link-local, metadata, and private IP addresses to mitigate CVE-2026-85608.

High 8.7Vetted

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

At a glance

CVE-2026-85608 is a high (CVSS 8.7) vulnerability in Douyin_TikTok_Download_API, published 4 September 2026. A vetted upatch, cve-2026-85608-ssrf-block, blocks it on running Linux machines with shirudo until Douyin_TikTok_Download_API is upgraded.

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

Overview

CVE-2026-85608, published on 4 September 2026, is an unauthenticated full-read server-side request forgery (CWE-918) in Evil0ctal/Douyin_TikTok_Download_API through version V4.1.2. The /api/download (download_file_hybrid in app/api/endpoints/download.py) and /api/hybrid/video_data (hybrid_parsing_single_video in app/api/endpoints/hybrid_parsing.py) endpoints pass the caller-supplied url query parameter to HybridCrawler.hybrid_parsing_single_video in crawlers/hybrid/hybrid_crawler.py. When the string "douyin" appears anywhere in url, the dispatcher invokes AwemeIdFetcher.get_aweme_id in crawlers/douyin/web/utils.py, which validates the URL only with extract_valid_urls (https?://\S+ in crawlers/utils/utils.py) and fetches it with httpx.AsyncClient(follow_redirects=True). An unauthenticated caller can supply an internal or cloud metadata URL containing "douyin" in the path or query string (such as http://169.254.169.254/latest/meta-data/douyin or http://127.0.0.1:<port>/douyin) to make the server request internal endpoints, and AwemeIdFetcher.get_aweme_id includes e.response.text in the APIResponseError message reflected back by /api/download.

Official description

Douyin_TikTok_Download_API through 4.1.2 contains a server-side request forgery vulnerability in the /api/download and /api/hybrid/video_data endpoints that allows unauthenticated attackers to fetch arbitrary URLs by supplying a url query parameter. Attackers can request internal services including cloud metadata endpoints and retrieve response bodies containing sensitive credentials through error messages.

Affected versions

  • Evil0ctal/Douyin_TikTok_Download_API: all versions through V4.1.2 (commit ab87be4, released 16 March 2026). Upstream closed issue #729 without a V4 patch because the V4 branch is frozen in favor of the V5 rewrite.
  • Kernels: any Linux kernel supported by shirudo with BPF LSM and BTF enabled (lsm/socket_connect).

Sources

More references from NVD (4)

Mitigation

The BPF LSM program cve_2026_85608_ssrf_block attaches to lsm/socket_connect and returns -EPERM when a Douyin_TikTok_Download_API server process (a process whose executable name starts with python and whose command name is uvicorn or start.py or whose working directory starts with Douyin_TikTok_Download_API) attempts to connect an AF_INET or AF_INET6 socket to any of these internal ranges:

  • IPv4: 0.0.0.0/8 (unspecified), 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 (RFC 1918 private networks), 100.64.0.0/10 (RFC 6598 carrier-grade NAT and Alibaba Cloud metadata), 127.0.0.0/8 (loopback), and 169.254.0.0/16 (link-local and AWS/GCP/Azure metadata 169.254.169.254).
  • IPv6: :: and ::1, IPv4-compatible, IPv4-mapped (::ffff:0:0/96), NAT64 (64:ff9b::/96), and 6to4 (2002::/16) addresses embedding any of the blocked IPv4 ranges, unique-local (fc00::/7), and link-local (fe80::/10).

The program checks the socket family and destination IP address first, and inspects the current task's executable, command name, and working directory only when the destination falls inside a blocked internal range. Because lsm/socket_connect runs on every connection attempt, both direct requests to internal addresses and HTTP redirects from public hosts to internal addresses are refused in the kernel before a packet is sent. Any refusal from an earlier BPF LSM program on the same hook is preserved. Refusals are counted at key 0 of the refused per-CPU array map.

Side effects

  • Outbound AF_INET and AF_INET6 connections from Douyin_TikTok_Download_API (uvicorn / start.py) to loopback, private, link-local, CGNAT, and cloud metadata addresses fail with EPERM, causing /api/download and /api/hybrid/video_data to return HTTP 400 (APIConnectionError) when given an internal URL.
  • Inbound connections to Douyin_TikTok_Download_API on loopback or private interfaces continue to work because accept does not call socket_connect, and outbound connections to public Douyin and TikTok hosts are unaffected.
  • Other processes on the machine, including sshd, system daemons, and standalone python3 scripts outside Douyin_TikTok_Download_API, are unaffected.
  • Not covered: a deployment started under a custom process name other than uvicorn or start.py from a working directory that does not start with Douyin_TikTok_Download_API, or an internal service running on a public IP address.

Preemption model and cost

The program holds no locks and shares only the per-CPU refused counter, updated with __sync_fetch_and_add, making it safe under all kernel preemption models including PREEMPT_LAZY, PREEMPT_DYNAMIC, and PREEMPT_RT. On every socket_connect to a public address or non-IP socket family, the program reads only sa_family and the destination address and returns immediately without inspecting task structures.

The policy

172 lines of BPF C, attached at lsm/socket_connect.

// 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>
#include <bpf/bpf_endian.h>

#define EPERM 1
#define AF_INET 2
#define AF_INET6 10

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

	if (!dentry || BPF_CORE_READ(dentry, d_name.len) < 6)
		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 dentry_starts_with_douyin_dir(const struct dentry *dentry)
{
	const unsigned char *name = BPF_CORE_READ(dentry, d_name.name);
	const char want[] = "Douyin_TikTok_Download_API";
	char buf[26] = {};

	if (!dentry || BPF_CORE_READ(dentry, d_name.len) < sizeof(want) - 1)
		return false;
	if (bpf_probe_read_kernel(buf, sizeof(buf), name))
		return false;
	for (__u32 i = 0; i < sizeof(want) - 1; i++) {
		if (buf[i] != want[i])
			return false;
	}
	return true;
}

static __always_inline bool comm_is_douyin_server(void)
{
	char comm[16] = {};

	if (bpf_get_current_comm(&comm, sizeof(comm)) < 0)
		return false;
	if (comm[0] == 'u' && comm[1] == 'v' && comm[2] == 'i' &&
	    comm[3] == 'c' && comm[4] == 'o' && comm[5] == 'r' &&
	    comm[6] == 'n' && comm[7] == '\0')
		return true;
	if (comm[0] == 's' && comm[1] == 't' && comm[2] == 'a' &&
	    comm[3] == 'r' && comm[4] == 't' && comm[5] == '.' &&
	    comm[6] == 'p' && comm[7] == 'y' && comm[8] == '\0')
		return true;
	return false;
}

static __always_inline bool current_is_douyin_api(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 (!dentry_starts_with_python(exe))
		return false;
	return comm_is_douyin_server() || dentry_starts_with_douyin_dir(pwd);
}

static __always_inline bool ipv4_is_blocked(__u32 ip)
{
	if ((ip & 0xff000000U) == 0x00000000U)
		return true;
	if ((ip & 0xff000000U) == 0x0a000000U)
		return true;
	if ((ip & 0xffc00000U) == 0x64400000U)
		return true;
	if ((ip & 0xff000000U) == 0x7f000000U)
		return true;
	if ((ip & 0xffff0000U) == 0xa9fe0000U)
		return true;
	if ((ip & 0xfff00000U) == 0xac100000U)
		return true;
	if ((ip & 0xffff0000U) == 0xc0a80000U)
		return true;
	return false;
}

static __always_inline bool ipv6_is_blocked(const struct in6_addr *addr6)
{
	__u32 w0 = bpf_ntohl(BPF_CORE_READ(addr6, in6_u.u6_addr32[0]));
	__u32 w1 = bpf_ntohl(BPF_CORE_READ(addr6, in6_u.u6_addr32[1]));
	__u32 w2 = bpf_ntohl(BPF_CORE_READ(addr6, in6_u.u6_addr32[2]));
	__u32 w3 = bpf_ntohl(BPF_CORE_READ(addr6, in6_u.u6_addr32[3]));

	if (w0 == 0 && w1 == 0 && w2 == 0)
		return ipv4_is_blocked(w3) || w3 == 1;
	if (w0 == 0 && w1 == 0 && w2 == 0x0000ffffU)
		return ipv4_is_blocked(w3);
	if (w0 == 0x0064ff9bU && w1 == 0 && w2 == 0)
		return ipv4_is_blocked(w3);
	if ((w0 & 0xffff0000U) == 0x20020000U)
		return ipv4_is_blocked((w0 << 16) | (w1 >> 16));
	if ((w0 & 0xfe000000U) == 0xfc000000U)
		return true;
	if ((w0 & 0xffc00000U) == 0xfe800000U)
		return true;
	return false;
}

SEC("lsm/socket_connect")
int BPF_PROG(cve_2026_85608_ssrf_block, struct socket *sock,
	     struct sockaddr *address, int addrlen, int ret)
{
	__u16 family;

	if (ret)
		return earlier_verdict(ret);
	if (!address || addrlen < (int)sizeof(family))
		return 0;
	family = BPF_CORE_READ(address, sa_family);
	if (family == AF_INET) {
		const struct sockaddr_in *sin;
		__u32 ip;

		if (addrlen < (int)sizeof(*sin))
			return 0;
		sin = (const struct sockaddr_in *)address;
		ip = bpf_ntohl(BPF_CORE_READ(sin, sin_addr.s_addr));
		if (!ipv4_is_blocked(ip) || !current_is_douyin_api())
			return 0;
		count_refused();
		return -EPERM;
	}
	if (family == AF_INET6) {
		const struct sockaddr_in6 *sin6;

		if (addrlen < (int)sizeof(*sin6))
			return 0;
		sin6 = (const struct sockaddr_in6 *)address;
		if (!ipv6_is_blocked(&sin6->sin6_addr) || !current_is_douyin_api())
			return 0;
		count_refused();
		return -EPERM;
	}
	return 0;
}

Process

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

  1. 4 Sept 2026CVECVE published
  2. 25 Nov 2026Pull requestPull request #86 openedAdd CVE-2026-85608: Refuses outbound connections from Douyin_TikTok_Download_API to loopback,romanlab
  3. 25 Nov 2026CIUpdate upatch.devpassed
  4. 25 Nov 2026CICIpassed
  5. 25 Nov 2026MergeMerged #86romanlab

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

Evidence

On Douyin_TikTok_Download_API V4.1.2, the loaded upatch refused outbound loopback connections from /api/download at lsm/socket_connect while normal API endpoints kept working.

Tested
25 Nov 2026
Target
Evil0ctal/Douyin_TikTok_Download_API V4.1.2 on Python 3.11 (uvicorn), loopback only (127.0.0.1:18765)
Kernel
7.4-shirudo-ci-20261123
Architecture
x86_64
Distribution
Ubuntu 26.04
Results
StateSSRF probe to internal loopback listener blockedNormal API endpoint (/api/ios/shortcut) works
Before loadingnoyes
Upatch loadedyesyes
After unloadingnoyes
tools-test.log Output of tools/test --setup showing the probe reached the internal listener before and after loading, and was blocked while the upatch was loaded.
tools/test --setup, 2026-11-25T15:20:01Z
Target: shirudo test VM, Linux 7.4-shirudo-ci-20261123, x86_64, swtpm
cve-2026-85608
  setup   done         DOUYIN_API_URL=http://127.0.0.1:18765
  before  reached      /api/download fetched internal target http://127.0.0.1:42785/douyin/probe and reflected token
  loaded  blocked      /api/download connection to internal target http://127.0.0.1:40679/douyin/probe was refused
  after   reached      /api/download fetched internal target http://127.0.0.1:39447/douyin/probe and reflected token
  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-85608
Publish and roll out
shirudo bpm push build/packages/cve-2026-85608-1.0.0.bee oci://<registry>/<namespace>/cve-2026-85608 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-85608-1.0.0.bee oci://<registry>/<namespace>/<tree> --tree-id <tree-id> --keys-dir <keys-dir>