GHSA-22fp-mf44-f2mq json
youtube-dl vulnerable to file system modification and RCE through improper file-extension sanitization
published last yr. modified 9mo ago
- cvss
- 7.8
- version 3.1, GitHub
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- —
- no score, EPSS covers CVEs only
- public exploits
- 0
- none known
Summary
#### 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
Patch / fix
- github.com/ytdl-org/youtube-dl@d42a222 commit
- github.com/ytdl-org/youtube-dl#32830 pull request
Is GHSA-22fp-mf44-f2mq in your dependencies? Fencer shows which of your repositories are affected as soon as an advisory lands, and opens the fix as a pull request.
Check with FencerCVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| GitHub | 3.1 | 7.8 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| pypi | youtube-dl | >=2015.01.25, <=2021.12.17 |
no fix listed |
Classification
References
-
github.com
/ytdl-org/youtube-dl/pull/32830
web
-
github.com
/ytdl-org/youtube-dl/commit/d42a222ed541b96649396ef00e19552aef0f09ec
web
-
github.com
/dirkf/youtube-dl/security/advisories/GHSA-22fp-mf44-f2mq
web
-
github.com
/yt-dlp/yt-dlp/security/advisories/GHSA-79w7-vh3h-8g4j
web
-
nvd.nist.gov
/vuln/detail/CVE-2024-38519
advisory
-
github.com
/dirkf/youtube-dl
package
-
securitylab.github.com
/advisories/GHSL-2024-089_youtube-dl
advisory
Sources
- GitHub Advisory GHSA-22fp-mf44-f2mq
Fencer Intel keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.