/

CVE-2026-55404

Severity:

HIGH RISK

(7.5)

Injection in shortcut generation (CWE-74) in yt-dlp

CVE-2026-55404

Analyzed

Vulnerability type

Category:

Injection

CWE:

CWE-74

Impact:

Local Code Execution via Malicious Shortcut Files

Severity:

HIGH RISK

(7.5)

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 and youtube-dl previously generated .url and .desktop shortcut files using unvalidated, attacker-controlled metadata, enabling command execution when a user opened the shortcut.

On Windows this allowed file:// URI injection, while on Linux newline-based desktop entry key injection could embed harmful commands, making the vulnerability risky when users save and later open such shortcuts.

Affected context

The vulnerability appears when yt-dlp or youtube-dl are used with options that generate shortcut files (--write-link, --write-url-link, --write-desktop-link) and the underlying metadata (such as webpage_url or filename) originates from untrusted sources.

It affects environments where users later open or interact with the created .url or .desktop files, particularly on Windows and Linux desktops.

Risk increases when users routinely download media from arbitrary sites and place generated shortcuts in locations they or others might click without inspecting contents.

Exploit preconditions

  • Attack surface: Shortcut generation via yt-dlp or youtube-dl command-line options (--write-link, --write-url-link, --write-desktop-link).
  • Required access: Ability to influence webpage_url or filename metadata consumed by the tools (for example, by hosting crafted media pages or manipulating titles/URLs).
  • Trigger point: User invokes yt-dlp/youtube-dl with shortcut-writing flags and later opens the generated .url or .desktop file through the desktop or file manager.
  • Why exploitation is possible: The shortcut content is derived directly from attacker-controlled strings without adequate validation, escaping, or normalization, allowing injection of file:// URIs on Windows or additional keys/commands in desktop entry files on Linux.

Why this happens

This issue stems from improper neutralization of special elements in output used to generate shortcut files, mapping to CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection').

The tools treat metadata such as URLs and filenames as trusted text and embed them directly into .url and .desktop templates without robust escaping of control characters, protocol schemes, or delimiter characters.

As a result, the downstream components (Windows shell handling .url files and Linux desktop environments parsing .desktop entries) interpret injected segments as configuration or commands rather than plain data, creating an injection channel that can lead to local command execution when the shortcut is opened.

Potential impact

  • Malicious file:// URIs may execute local programs or scripts when .url shortcuts are opened on Windows.
  • Crafted .desktop files can inject extra keys or command lines that run arbitrary commands under the user's context on Linux.
  • Users may be tricked into opening seemingly benign shortcuts, leading to compromise of their desktop session.
  • Attackers can leverage trusted-looking media downloads to plant weaponized shortcut files in shared or commonly accessed directories.

General mitigation guidance

Effective mitigation focuses on treating all metadata used in shortcut generation as untrusted and constraining what can be emitted into .url and .desktop files.

Common defensive patterns include:

  • Strictly validating URLs and filenames against allowlists of safe schemes, characters, and formats before writing them into shortcut templates.
  • Applying robust escaping and quoting rules around any dynamic content embedded in shortcut files, particularly delimiters, newlines, and shell-relevant characters.
  • Limiting shortcut generation features to pure, non-executable destinations (for example, normalizing URLs so they cannot reference file:// or other unsafe schemes).
  • Reducing the privileges and trust placed in user-opened shortcut files by avoiding auto-execution behaviors and prompting users when unusual commands are present.

These patterns help ensure that downstream components interpret shortcut contents as data, not executable instructions.

How teams detect issues like this

Detection typically relies on analyzing both source code and generated artifacts for injection-prone patterns.

Helpful approaches include:

  • Static analysis rules that flag direct insertion of untrusted metadata into configuration or shortcut templates without escaping or validation.
  • Code review checklists that require scrutiny of any feature that writes .url, .desktop, or other launcher/shortcut formats, ensuring that all dynamic data passes through sanitization routines.
  • Policy-based checks in CI that search for shortcut-generation code and enforce mandatory use of safe helper functions for encoding URLs, filenames, and desktop entry values.
  • Periodic scanning of generated shortcut files for suspicious schemes, additional keys, or command lines that deviate from expected patterns, optionally aided by automated security tooling.

Sources

SourceLink
github.comgithub.com/yt-dlp/yt-dlp/commit/b6590aaa1e3808155d69c9a79a797ae484163789
github.comgithub.com/yt-dlp/yt-dlp/releases/tag/2026.07.04
github.comgithub.com/yt-dlp/yt-dlp/security/advisories/GHSA-6v4j-43gg-vj32

Frequently asked

questions

Exploitation typically begins remotely, where an attacker controls webpage metadata or URLs used by yt-dlp/youtube-dl, but the actual command execution occurs locally when the user opens the generated shortcut file on their desktop.

An attacker needs to influence the webpage_url or filename metadata consumed by the download tools; they do not require direct access to the victim's machine, but the victim must run the tools with shortcut-writing options and later open the created shortcuts.

The safest pattern is to strictly validate and escape all dynamic values before embedding them into .url or .desktop files, enforcing allowed schemes and characters and ensuring downstream components cannot interpret injected content as executable configuration or commands.

Design shortcut and launcher generation features with the assumption that all metadata is untrusted, implement centralized sanitization and encoding utilities, and include explicit checks in code review and CI to verify that configuration-like outputs do not directly include raw user-controlled strings.

Find out what's already
exploitable in your codebase.