Skip to content

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Aug 6, 2024

Note

Mend has cancelled the proposed renaming of the Renovate GitHub app being renamed to mend[bot].

This notice will be removed on 2025-10-07.


This PR contains the following updates:

Package Change Age Confidence
yt-dlp 2024.5.27 -> 2024.7.7 age confidence

GitHub Vulnerability Alerts

CVE-2024-38519

Summary

yt-dlp 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). Since yt-dlp also reads config from the working directory (and on Windows executables will be executed from the yt-dlp directory) this could lead to arbitrary code being executed.

Patches

yt-dlp version 2024.07.01 fixes this issue by whitelisting the allowed extensions.
This means some very uncommon extensions might not get downloaded; however, it will also limit the possible exploitation surface.

Workarounds

It is recommended to upgrade yt-dlp to version 2024.07.01 as soon as possible, always have .%(ext)s at the end of the output template, and make sure you trust the websites that you are downloading from. Also, make sure to never download to a directory within PATH or other sensitive locations like your user directory, system32, or other binaries locations.

For users not able to upgrade:

  • Make sure the extension of the media to download is a common video/audio/sub/... one
  • Try to avoid the generic extractor (--ies default,-generic)
  • Keep the default output template (-o "%(title)s [%(id)s].%(ext)s)
  • Omit any of the subtitle options (--write-subs, --write-auto-subs, --all-subs, --write-srt)
  • Use --ignore-config --config-location ... to not load config from common locations

Details

One potential exploitation might look like this:

From a mimetype we do not know, we default to trimming the leading bit and using the remainder. Given a webpage that contains

<script type="application/ld+json">
{
    "@&#8203;context": "https://schema.org",
    "@&#8203;type": "VideoObject",
    "name": "ffmpeg",
    "encodingFormat": "video/exe",
    "contentUrl": "https://example.com/video.mp4"
}
</script>

this will try and download a file called ffmpeg.exe (-o "%(title)s.%(ext)s).
ffmpeg.exe will be searched for in the current directory, and so upon the next run arbitrary code can be executed.

Alternatively, when engineering a file called yt-dlp.conf to be created, the config file could contain --exec ... and so would also execute arbitrary code.

Acknowledgement

A big thanks to @​JarLob for independently finding a new application of the same underlying issue.
More can be read about on the dedicated GitHub Security Lab disclosure here: Path traversal saving subtitles (GHSL-2024-090)

References

GHSA-3v33-3wmw-3785

Impact

yt-dlp's DouyuTV and DouyuShow extractors used a cdn.bootcdn.net URL as a fallback for fetching a component of the crypto-js JavaScript library. When the Douyu extractor is used, yt-dlp extracts this JavaScript code and attempts to execute it externally using PhantomJS. bootcdn.net is owned by the bad actor responsible for the Polyfill JS supply chain attack that has been ongoing since at least June 2023. While there is no evidence that PhantomJS has been targeted by or is vulnerable to any attacks carried out by the Polyfill JS actor, there is the possibility that malicious JavaScript code may have been downloaded/cached by yt-dlp or executed by PhantomJS.

In order for this potential vulnerability to be exploited by any hypothetical attack, all 3 of the following conditions must be met:

  1. The user has PhantomJS installed on their system.
  2. The user passes a douyu.com or douyutv.com URL to yt-dlp as input, or passes a URL that redirects to one of these domains.
  3. cdnjs.cloudflare.com is unavailable or blocked at the time of extraction, necessitating the usage of the cdn.bootcdn.net fallback; or it had been unavailable during a previous run of the Douyu extractor and JavaScript code from cdn.bootcdn.net had been cached to disk.

Patches

yt-dlp version 2024.07.07 fixes this issue by removing the URL pointing to the malicious CDN and by invalidating any Douyu extractor cache data created by unpatched versions of yt-dlp.

Workarounds

It is recommended to upgrade yt-dlp to version 2024.07.07 as soon as possible.

For users not able to upgrade:

  • Avoid using the Douyu extractors (--ies default,-douyutv,-douyushow)
  • Uninstall (or do not install) PhantomJS

Acknowledgement

Thanks to @​LeSuisse for reporting this promptly after bootcdn.net was discovered to be under control of the same bad actor behind the polyfill.io supply chain attack.

References


Release Notes

yt-dlp/yt-dlp (yt-dlp)

v2024.7.7

Compare Source

v2024.7.2

Compare Source

v2024.7.1

Compare Source


Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

Copy link

codecov bot commented Aug 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.39%. Comparing base (c5e2d9a) to head (83a4b48).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #91      +/-   ##
==========================================
+ Coverage   85.71%   88.39%   +2.67%     
==========================================
  Files           5        5              
  Lines         112      112              
==========================================
+ Hits           96       99       +3     
+ Misses         16       13       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@renovate renovate bot force-pushed the renovate/pypi-yt-dlp-vulnerability branch from 1e7df99 to 83a4b48 Compare October 28, 2024 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants