youtube-dl vulnerable to file system modification and RCE through improper file-extension sanitization
Description
This advisory follows the security advisory GHSA-79w7-vh3h-8g4j published by the yt-dlp/yt-dlp project 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)sat the end of the output template - download from websites that you trust
- do not download to a directory within the executable search
PATHor other sensitive locations, such as your user directory or system directories - in Windows versions that support it, set
NoDefaultCurrentDirectoryInExePathto prevent the cmd shell's executable search adding the default directory beforePATH - consider that the path traversal vulnerability as a result of resolving
non_existent_dir\..\..\targetdoes 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
Software afectado
Haz clic en una tecnología para ver todas sus vulnerabilidades.
| Plataforma | Paquete | Versiones vulnerables | Corregida en |
|---|---|---|---|
| Python (PyPI) | youtube-dl | >= 2015.01.25, <= 2021.12.17 | sin corrección |
Referencias
- https://github.com/dirkf/youtube-dl/security/advisories/GHSA-22fp-mf44-f2mq
- https://github.com/yt-dlp/yt-dlp/security/advisories/GHSA-79w7-vh3h-8g4j
- https://nvd.nist.gov/vuln/detail/CVE-2024-38519
- https://github.com/ytdl-org/youtube-dl/pull/32830
- https://github.com/ytdl-org/youtube-dl/commit/d42a222ed541b96649396ef00e19552aef0f09ec
- https://github.com/dirkf/youtube-dl
- https://securitylab.github.com/advisories/GHSL-2024-089_youtube-dl
- Vector CVSS
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H- Debilidad (CWE)
CWE-434, CWE-669- Plataforma
- Python (PyPI)
- Paquete
youtube-dl- Publicada
- 18.04.2025
- Actualizado
- 11.10.2026 12:19
Fuentes y licencias
OSV / GitHub Advisory Database - GHSA-22fp-mf44-f2mq - CC BY 4.0
Historial de vulnerabilidades: youtube-dl
Todas las vulnerabilidades publicadas de este paquete (Python (PyPI)), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.
Esta es la única vulnerabilidad conocida de este paquete.
Identifica las vulnerabilidades de tu aplicación
Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.