OS Command Injection Affecting yt-dlp package, versions [2021.4.11, 2023.9.24)


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    Exploit Maturity
    Proof of concept
    EPSS
    0.79% (82nd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-PYTHON-YTDLP-5918285
  • published 26 Sep 2023
  • disclosed 25 Sep 2023
  • credit Simon Sawicki

How to fix?

Upgrade yt-dlp to version 2023.9.24 or higher.

Overview

yt-dlp is an A youtube-dl fork with additional features and patches

Affected versions of this package are vulnerable to OS Command Injection due to improper escaping of special characters in the cmd shell used by Python's subprocess, through the --exec flag.

Note: This is only exploitable if yt-dlp is used on Windows, regardless of whether it's run from cmd or PowerShell. .

Workaround

For Windows users who are not able to upgrade:

Avoid using any output template expansion in --exec other than {} (filepath). If expansion in --exec is needed, verify the fields you are using do not contain ", | or &. Instead of using --exec, write the info json and load the fields from it instead.

CVSS Scores

version 3.1
Expand this section

Snyk

Recommended
8.3 high
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    High
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    Required
  • Scope (S)
    Changed
  • Confidentiality (C)
    High
  • Integrity (I)
    High
  • Availability (A)
    High
Expand this section

NVD

7.8 high