# yt-dlp: Arbitrary code execution via manifest downloads with aria2c

Unsanitized fragment URLs and metadata titles injected newlines into aria2c input files, letting attackers write arbitrary files and gain code execution.

- Payout: Research
- Severity: high
- Program: yt-dlp
- Found by: seproDev
- Disclosed: 2026-06-16
- CVE: CVE-2026-50574
- Write-up quality: 7/10
- Original: https://github.com/advisories/GHSA-vx4q-3cr2-7cg2
- Library page: http://bugbountylibrary.com/r/ghsa%3AGHSA-vx4q-3cr2-7cg2
- Tags: area:os domain:desktop impact:integrity impact:rce kind:research platform:ghsa sev:high tech:python technique:source-review vuln:command-injection vuln:path-traversal

**Target:** aria2c external downloader input file for HLS/DASH fragment downloads
**Root cause:** yt-dlp builds an aria2c `-i` input file from fragment URLs and output filenames without neutralizing newlines, so attacker-controlled data can inject aria2c option/URI lines.
**Steps:**
1. Configure yt-dlp with aria2c as external downloader for a fragmented manifest (HLS/DASH).
2. Vector 1: craft DASH manifest with fragment URL containing `
` (HTML newline escape); yt-dlp unescapes it to a real newline when writing the aria2c input file.
3. Vector 2: craft metadata response whose `title` (or other output-template field) contains newlines and magnet URIs; with `--no-windows-filename` newline sanitization is disabled.
4. Injected lines add aria2c options/URIs, achieving arbitrary file write.
5. On Windows write `ffmpeg.exe` to CWD (invoked in postprocessing if yt-dlp.exe is in CWD); on all platforms write `yt-dlp.conf` with malicious `--exec` for execution on next run.
**How found:** Recognized that aria2c's input-file format treats leading-whitespace lines as per-URI options, then traced that yt-dlp writes unescaped fragment URLs and output filenames into that file, and that DASH XML unescaping and disabled filename sanitization both allow newline injection.
**Exploitation:** Attacker controls a manifest or metadata served to a victim using aria2c; injected newline-delimited aria2c config lines write attacker-chosen files to the working directory, yielding immediate RCE on Windows via ffmpeg.exe or deferred RCE via yt-dlp.conf --exec.
**Escalation:** File write escalated to code execution via postprocessing binary hijack (ffmpeg.exe) or config-file --exec on next invocation.
**Insight:** When a tool generates a config/input file for a downstream CLI, check whether that format has line-oriented directives (aria2c options, leading whitespace) and whether any upstream field is unescaped (XML entities, disabled filename sanitization) before being written.

