GHSA-22fp-mf44-f2mq: Youtube dl Remote Code Execution Vulnerability

HIGH
CVSS 7.8
CWE-669 CWE-434
Published
Advisory Summary

GHSA-22fp-mf44-f2mq is a HIGH (CVSS 7.8) remote code execution vulnerability (CWE-669: Incorrect Resource Transfer Between Spheres) affecting Youtube dl libraries in the PyPI ecosystem. The issue involves youtube-dl vulnerable to file system modification and rce through improper file-extension sanitization. Remediation is available in the latest vendor maintenance releases.

GHSA-22fp-mf44-f2mq at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-22fp-mf44-f2mq
Severity HIGH
CVSS v3.1 Base Score 7.8
CWE Classification CWE-669: Incorrect Resource Transfer Between Spheres
Affected Product Youtube dl
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix GHSA-22fp-mf44-f2mq

To remediate this vulnerability, upgrade all affected Youtube dl dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

youtube-dl fixed: Latest secure release
pip install youtube-dl>=Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show youtube-dl

How to Check if You Are Affected

To determine whether your Python environment is affected by GHSA-22fp-mf44-f2mq, inspect your installed packages using pip:

pip show youtube-dl

Analyze the terminal output to locate any version of Youtube dl in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: The pip show youtube-dl command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-669: Incorrect Resource Transfer Between Spheres, where the product does not properly transfer a resource/behavior to another sphere, or improperly imports a resource/behavior from another sphere, in a manner that provides unintended control over that resource. In Youtube dl, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

#### Description This advisory follows the security advisory [GHSA-79w7-vh3h-8g4j published by the _yt-dlp/yt-dlp_ project](https://github.com/yt-dlp/yt-dlp/security/advisories/GHSA-79w7-vh3h-8g4j) to aid remediation of the issue in the _ytdl-org/youtube-dl_ project. ### Vulnerability _youtube-dl_ does not limit the extensions of downloaded files, which could lead to arbitrary filenames being created in the download folder (and path traversal on Windows). ### Impact Since _youtube-dl_ also reads config from the working directory (and, on Windows, executables will be executed from the _youtube-dl_ directory by default) the vulnerability could allow the unwanted execution of local code, including downloads masquerading as, eg, subtitles. ### Patches The versions of _youtube-dl_ listed as _Patched_ remediate this vulnerability by disallowing path separators and whitelisting allowed extensions. As a result, some very uncommon extensions might not get downloaded. **Master code d42a222 or later and nightly builds tagged 2024-07-03 or later** contain the remediation. ### Workarounds Any/all of the below considerations may limit exposure in case it is necessary to use a vulnerable version * have `.%(ext)s` at the end of the output template * download from websites that you trust * do not download to a directory within the executable search `PATH` or other sensitive locations, such as your user directory or system directories * in Windows versions that support it, set [`NoDefaultCurrentDirectoryInExePath`](https://stackoverflow.com/a/50118548) to prevent the _cmd_ shell's executable search adding the default directory before `PATH` * consider that the path traversal vulnerability as a result of resolving `non_existent_dir\..\..\target` does not exist in Linux or macOS * ensure the extension of the media to download is a common video/audio/... one (use `--get-filename`) * omit any of the subtitle options (`--write-subs`/` --write-srt`, `--write-auto-subs`/`--write-automatic-subs`, `--all-subs`). ### References * [GHSA-79w7-vh3h-8g4j](https://github.com/yt-dlp/yt-dlp/security/advisories/GHSA-79w7-vh3h-8g4j) * https://github.com/ytdl-org/youtube-dl/pull/32830

GHSA-22fp-mf44-f2mq Affected Youtube dl Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
youtube-dl
PyPI
≥ 2015.01.25
≤ 2021.12.17

References

Frequently Asked Questions

What is GHSA-22fp-mf44-f2mq?
GHSA-22fp-mf44-f2mq is a security vulnerability in Youtube dl involving youtube-dl vulnerable to file system modification and RCE through improper file-extension sanitization under CWE-669: Incorrect Resource Transfer Between Spheres.
Which Youtube dl versions are affected?
Affected versions include releases prior to current release patches across affected packages: youtube-dl.
What version fixes GHSA-22fp-mf44-f2mq?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is youtube-dl affected?
Yes, youtube-dl is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of GHSA-22fp-mf44-f2mq?
GHSA-22fp-mf44-f2mq has a CVSS v3.1 base score of 7.8 (HIGH) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with GHSA-22fp-mf44-f2mq?
GHSA-22fp-mf44-f2mq is classified under CWE-669: Incorrect Resource Transfer Between Spheres (The product does not properly transfer a resource/behavior to another sphere, or improperly imports a resource/behavior from another sphere, in a manner that provides unintended control over that resource.).
How can I check PyPI dependencies for GHSA-22fp-mf44-f2mq?
Run the dependency tree command: 'pip show youtube-dl'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-22fp-mf44-f2mq",
  "modified" : "2025-05-27T19:56:40Z",
  "published" : "2025-04-18T20:24:07Z",
  "aliases" : [ ],
  "summary" : "youtube-dl vulnerable to file system modification and RCE through improper file-extension sanitization",
  "details" : "#### Description\nThis advisory follows the security advisory [GHSA-79w7-vh3h-8g4j published by the _yt-dlp/yt-dlp_ project](https://github.com/yt-dlp/yt-dlp/security/advisories/GHSA-79w7-vh3h-8g4j) to aid remediation of the issue in the _ytdl-org/youtube-dl_ project.\n\n### Vulnerability\n_youtube-dl_ does not limit the extensions of downloaded files, which could lead to arbitrary filenames being created in the download folder (and path traversal on Windows). \n\n### Impact\nSince _youtube-dl_ also reads config from the working directory (and, on Windows, executables will be executed from the _youtube-dl_ directory by default) the vulnerability could allow the unwanted execution of local code, including downloads masquerading as, eg, subtitles.\n\n### Patches\nThe versions of _youtube-dl_ listed as _Patched_ remediate this vulnerability by disallowing path separators and whitelisting allowed extensions. As a result, some very uncommon extensions might not get downloaded.\n\n**Master code d42a222 or later and nightly builds tagged 2024-07-03 or later** contain the remediation.\n\n### Workarounds\nAny/all of the below considerations may limit exposure in case it is necessary to use a vulnerable version\n* have `.%(ext)s` at the end of the output template\n* download from websites that you trust\n* do not download to a directory within the executable search `PATH` or other sensitive locations, such as your user directory or system directories\n* in Windows versions that support it, set [`NoDefaultCurrentDirectoryInExePath`](https://stackoverflow.com/a/50118548) to prevent the _cmd_ shell's executable search adding the default directory before `PATH`\n* consider that the path traversal vulnerability as a result of resolving `non_existent_dir\\..\\..\\target` does not exist in Linux or macOS\n* ensure the extension of the media to download is a common video/audio/... one (use `--get-filename`)\n* omit any of the subtitle options (`--write-subs`/` --write-srt`, `--write-auto-subs`/`--write-automatic-subs`, `--all-subs`).\n\n### References\n* [GHSA-79w7-vh3h-8g4j](https://github.com/yt-dlp/yt-dlp/security/advisories/GHSA-79w7-vh3h-8g4j)\n* https://github.com/ytdl-org/youtube-dl/pull/32830",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "youtube-dl"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2015.01.25"
      }, {
        "last_affected" : "2021.12.17"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/dirkf/youtube-dl/security/advisories/GHSA-22fp-mf44-f2mq"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/yt-dlp/yt-dlp/security/advisories/GHSA-79w7-vh3h-8g4j"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-38519"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ytdl-org/youtube-dl/pull/32830"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ytdl-org/youtube-dl/commit/d42a222ed541b96649396ef00e19552aef0f09ec"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/dirkf/youtube-dl"
  }, {
    "type" : "ADVISORY",
    "url" : "https://securitylab.github.com/advisories/GHSL-2024-089_youtube-dl"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-434", "CWE-669" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-04-18T20:24:07Z",
    "nvd_published_at" : null
  }
}