The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2024-22423

CVE-2024-22423: Yt-dlp Command Injection RCE Vulnerability

CVE-2024-22423 is a command injection RCE vulnerability in yt-dlp that bypasses previous fixes in --exec template expansion. Attackers can exploit environment variable expansion to execute arbitrary code.

Published: March 31, 2026

CVE-2024-22423 Overview

CVE-2024-22423 is a critical remote code execution (RCE) vulnerability in yt-dlp, a popular youtube-dl fork. This vulnerability is a bypass of the incomplete fix for CVE-2023-40581, which attempted to prevent RCE when using the --exec command with the %q output template. The original patch replaced double quotes with two double quotes, but this escaping mechanism was insufficient and still allowed expansion of environment variables on Windows systems.

The vulnerability exists because the shell escape function failed to properly neutralize percent signs (%), which Windows interprets as environment variable delimiters. An attacker controlling media metadata (such as video titles or descriptions) can inject malicious payloads that execute arbitrary commands when processed through the --exec parameter.

Critical Impact

Remote attackers can achieve arbitrary code execution on Windows systems by crafting malicious media metadata that exploits environment variable expansion when users process content with yt-dlp's --exec functionality.

Affected Products

  • yt-dlp versions from 2021.04.11 to before 2024.04.09

Discovery Timeline

  • April 9, 2024 - CVE-2024-22423 published to NVD
  • January 5, 2026 - Last updated in NVD database

Technical Details for CVE-2024-22423

Vulnerability Analysis

This vulnerability represents a command injection flaw (CWE-78) that enables remote code execution through improper neutralization of special elements used in OS commands. The vulnerable behavior was introduced in yt-dlp version 2021.04.11 when support for output template expansion in the --exec parameter was added.

The core issue lies in the Windows-specific shell quoting function within yt-dlp's compatibility layer. While the previous patch for CVE-2023-40581 addressed double quote escaping by replacing \" with "", it failed to account for Windows environment variable expansion syntax. On Windows, text enclosed in percent signs (e.g., %USERNAME%) is expanded to the corresponding environment variable value before command execution.

An attacker can exploit this by embedding specially crafted strings in media metadata fields that, when processed by yt-dlp's --exec functionality, result in command injection through environment variable expansion or by using pipe (|) and ampersand (&) characters to chain additional commands.

Root Cause

The root cause is insufficient input sanitization in the compat_shlex_quote function within yt_dlp/compat/__init__.py. The function was designed to safely quote strings for shell execution on Windows, but it only handled double quote characters while leaving percent signs, backslashes, and newline characters unescaped. This allowed attackers to inject payloads that bypass the quoting mechanism through Windows environment variable expansion.

Attack Vector

The attack is network-based and requires no authentication or user interaction beyond a victim processing malicious content. An attacker can:

  1. Host or control media content with malicious metadata (video title, description, etc.)
  2. Wait for a victim to download or process this content using yt-dlp with the --exec option and %q template expansion
  3. The malicious metadata containing percent signs, pipes, or ampersands gets passed unsanitized to the shell
  4. Arbitrary commands execute in the context of the yt-dlp process

The following code shows the security patches applied to address this vulnerability:

python
# Original vulnerable code in yt_dlp/compat/__init__.py
if compat_os_name == 'nt':
    def compat_shlex_quote(s):
        import re
        return s if re.match(r'^[-_\w./]+$', s) else '"%s"' % s.replace('"', '\\"')
python
# Initial patch attempt (still vulnerable - CVE-2023-40581 fix)
if compat_os_name == 'nt':
    def compat_shlex_quote(s):
        import re
        return s if re.match(r'^[-_\w./]+$', s) else s.replace('"', '""').join('""')

Source: GitHub Commit de015e9307

The final fix in version 2024.04.09 properly escapes percent signs by replacing them with %%cd:~,%, a variable that expands to nothing, leaving only the leading percent and preventing environment variable expansion.

text
[priority] Security: [[CVE-2024-22423](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-22423)] [Prevent RCE when using `--exec` with `%q` on Windows](https://github.com/yt-dlp/yt-dlp/security/advisories/GHSA-hjq6-52gw-2g7p)
    - The shell escape function now properly escapes `%`, `\\` and `\\n`.
    - `utils.Popen` has been patched accordingly.

Source: GitHub Commit ff07792676

Detection Methods for CVE-2024-22423

Indicators of Compromise

  • Unusual command execution spawned as child processes of yt-dlp on Windows systems
  • Media files or streams with metadata containing suspicious patterns such as %, |, or & characters combined with command syntax
  • Process monitoring showing yt-dlp executing unexpected binaries or scripts
  • Anomalous network connections initiated by processes spawned from yt-dlp execution chains

Detection Strategies

  • Monitor process creation events for yt-dlp with --exec parameters, especially those using %q template expansion
  • Implement YARA rules to detect media files with metadata containing potential command injection patterns
  • Deploy endpoint detection rules that alert on suspicious child process spawning from yt-dlp processes
  • Audit scripts and automation workflows that use yt-dlp with --exec functionality

Monitoring Recommendations

  • Enable command-line logging on Windows systems to capture full yt-dlp invocations
  • Implement process tree monitoring to detect unexpected command chains originating from yt-dlp
  • Review and audit any automated systems that process untrusted media content through yt-dlp

How to Mitigate CVE-2024-22423

Immediate Actions Required

  • Upgrade yt-dlp to version 2024.04.09 or later immediately
  • Audit existing scripts and workflows for usage of --exec with %q or other template expansions
  • Temporarily disable --exec functionality if immediate upgrade is not possible
  • Restrict yt-dlp execution to trusted content sources only until patched

Patch Information

The yt-dlp maintainers released version 2024.04.09 which fixes this vulnerability by properly escaping percent signs using the %%cd:~,% technique. This ensures that percent characters in user-controlled input cannot trigger environment variable expansion on Windows.

Relevant security resources:

  • GitHub Security Advisory GHSA-hjq6-52gw-2g7p
  • GitHub Release 2024.04.09
  • CERT Vulnerability Note #123335

Workarounds

  • For Windows users unable to upgrade: avoid using any output template expansion in --exec other than {} (filepath)
  • If template expansion in --exec is required: manually verify that fields being used do not contain ", |, or & characters
  • Consider writing info JSON to file and loading fields from it instead of using --exec directly
  • Use caution when processing any media from untrusted sources, as using unvalidated input in shell commands is inherently dangerous
bash
# Safe alternative: Write info to JSON and process separately
yt-dlp --write-info-json -o "%(title)s.%(ext)s" "VIDEO_URL"
# Then parse the .info.json file in your script instead of using --exec

# If upgrade is possible, update yt-dlp:
pip install -U yt-dlp
# Or using pipx:
pipx upgrade yt-dlp

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechYt Dlp

  • SeverityCRITICAL

  • CVSS Score9.8

  • EPSS Probability4.90%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-78
  • Technical References
  • GitHub Release 2021.04.11

  • GitHub Release 2024.04.09

  • GitHub Security Advisory GHSA-42h4-v29r-42qg

  • CERT Vulnerability Note #123335
  • Vendor Resources
  • GitHub Commit de015e9307

  • GitHub Commit ff07792676

  • GitHub Security Advisory GHSA-hjq6-52gw-2g7p
  • Related CVEs
  • CVE-2026-26331: Yt-dlp Command Injection RCE Vulnerability

  • CVE-2024-38519: yt-dlp Path Traversal Vulnerability
Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English