/

CVE-2026-50574

Severity:

HIGH RISK

(8.3)

Command Injection (CWE-74) in yt-dlp aria2c Handling

CVE-2026-50574

Analyzed

Vulnerability type

Category:

Command Injection / Injection Vulnerability

CWE:

CWE-74

Impact:

Arbitrary File Write and Potential Code Execution

Severity:

HIGH RISK

(8.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

yt-dlp's integration with the aria2c external downloader fails to properly sanitize parameters for fragmented manifest formats like HLS and DASH, allowing crafted input to control file paths passed to aria2c.

An attacker who can influence yt-dlp download parameters or manifest data may achieve arbitrary file writes, which can result in immediate or subsequent arbitrary code execution depending on the platform.

Affected context

The vulnerability appears when yt-dlp is configured to use aria2c as an external downloader for fragmented streaming formats such as HLS or DASH.

Risk is present when untrusted or attacker-controlled URLs, manifests, or download options are fed into yt-dlp, allowing malicious values to propagate into aria2c arguments.

The issue is particularly dangerous on Windows, where an arbitrary file write can more directly translate into immediate code execution, while on other platforms it typically manifests on the next yt-dlp invocation if critical files are overwritten.

Exploit preconditions

  • Attack surface: Command-line use of yt-dlp with aria2c as the external downloader for fragmented streams (HLS/DASH).
  • Required access: Ability to supply or influence the video/audio URL, manifest, or command-line parameters processed by yt-dlp, such that they control fields passed to aria2c.
  • Trigger point: Download initiation of a fragmented stream where yt-dlp constructs aria2c command arguments from attacker-influenced input.
  • Why exploitation is possible: yt-dlp performs insufficient sanitization and validation of user-controlled values before embedding them into aria2c command parameters, enabling injection-like control over file paths and write targets.

Why this happens

This vulnerability stems from improper neutralization of special elements in command and configuration arguments (CWE-74).

yt-dlp treats user-supplied or manifest-derived data as trusted and passes it on to aria2c with inadequate escaping or validation, allowing attackers to manipulate output file paths or related options.

Conceptually, this is an injection flaw where untrusted input crosses a trust boundary into an external tool invocation without being constrained to a safe set of values or patterns.

Potential impact

  • Arbitrary file creation or overwrite within the user's filesystem.
  • Overwriting application or configuration files that may be executed later.
  • Immediate arbitrary code execution on Windows by targeting executable or startup locations.
  • Arbitrary code execution on non-Windows platforms upon subsequent yt-dlp runs if critical scripts or binaries are replaced.
  • Persistent compromise of the local environment through trojanized files or altered configurations.

General mitigation guidance

Mitigation should focus on strictly controlling what data can be passed from yt-dlp into external downloaders like aria2c.

Defensive patterns include:

  • Validating and constraining file paths, output options, and aria2c parameters to a safe subset rather than forwarding raw user input.
  • Employing robust escaping and neutralization for special characters in command-line arguments.
  • Separating user-controlled data from control parameters by using structured APIs instead of constructing shell-like command strings.
  • Running downloads with least-privilege permissions and avoiding execution from directories where arbitrary file writes could be leveraged for code execution.
  • Treating remote manifests and URLs as untrusted data and applying schema or pattern checks before using them to build downloader options.

How teams detect issues like this

Detection typically involves reviewing how external tools are invoked and where untrusted data flows into command construction.

Useful strategies include:

  • Static analysis rules that flag concatenation of user-controlled strings into command-line arguments or downloader options.
  • Code review checklists that focus on external process execution, ensuring arguments are validated and constrained.
  • Runtime logging of external downloader invocations and parameters, making it easier to spot anomalous or unexpected file paths.
  • Policy enforcement in CI/CD pipelines that prohibit unsafe command construction patterns or require security sign-off for integrations with external tools.

Sources

SourceLink
github.comgithub.com/yt-dlp/yt-dlp/security/advisories/GHSA-vx4q-3cr2-7cg2

Frequently asked

questions

Exploitability depends on who controls the inputs to yt-dlp. If a user downloads only trusted media from known sources, risk is lower, but where URLs or manifests can be attacker-controlled, exploitation is feasible.

An attacker must be able to influence the URL, manifest, or command-line options supplied to yt-dlp in a context where aria2c is used for fragmented streams, such as scripting environments, automated download workflows, or shared systems.

The safest fix is to strictly validate and sanitize all values incorporated into external downloader arguments, ensuring only well-formed, expected options and file paths are allowed and avoiding raw injection of user-controlled data into commands.

Future tools should treat all externally sourced data as untrusted, use parameterized process invocation APIs rather than command string concatenation, enforce strong input validation on options and paths, and include security-focused review for integrations with external utilities.

Find out what's already
exploitable in your codebase.