CVE-2023-46121 (Python, published 2023-11-15T00:15Z)
Description: value: yt-dlp is a youtube-dl fork with additional features and fixes. 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. Version 2023.11.14 removed the ability to smuggle `http_headers` to the Generic extractor, as well as other extractors that use the same pattern. Users are advised to upgrade. Users unable to upgrade should disable the Ggneric extractor (or only pass trusted sites with trusted content) and ake caution when using `--no-check-certificate`.
Severity: nan (CVSS v3 base score: 3.7)
Weakness: CWE-444 \u2014 Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling')
The product acts as an intermediary HTTP agent
         (such as a proxy or firewall) in the data flow between two
         entities such as a client and server, but it does not
         interpret malformed HTTP requests or responses in ways that
         are consistent with how the messages will be processed by
         those entities that are at the ultimate destination.
Repository: https://github.com/yt-dlp/yt-dlp
Files changed:
test/test_networking.py
yt_dlp/extractor/cybrary.py
yt_dlp/extractor/duboku.py
yt_dlp/extractor/embedly.py
yt_dlp/extractor/generic.py
yt_dlp/extractor/slideslive.py
yt_dlp/extractor/storyfire.py
yt_dlp/extractor/vimeo.py
yt_dlp/utils/networking.py
Commit message: [ie] Do not smuggle `http_headers`

See: https://github.com/yt-dlp/yt-dlp/security/advisories/GHSA-3ch3-jhc6-5r8x

Authored by: coletdjnz


Vulnerable code:
            'url': smuggle_url(f'https://player.vimeo.com/video/{vimeo_id}', {'http_headers': {'Referer': 'https://api.cybrary.it'}})
                'url': smuggle_url(data_url, {'http_headers': headers}),
            {'http_headers': {'Referer': url}}))
        full_response = self._request_webpage(url, video_id, headers={
            **smuggled_data.get('http_headers', {})
        })
            headers = smuggled_data.get('http_headers', {})
                    'http_headers': {'Referer': url},
                    {'http_headers': {'Referer': url}})
                    'http_headers': {
                        'Referer': 'https://storyfire.com/',
                    }
        return smuggle_url(url, {'http_headers': {'Referer': referrer_url}})
        if 'http_headers' in data:
            headers.update(data['http_headers'])

Fixed code:
        with FakeYDL({'http_headers': {'Ytdl-socks-proxy': 'socks://localhost:1080'}}) as ydl:
            rh = self.build_handler(ydl)
            assert 'Ytdl-socks-proxy' not in rh.headers

            'url': smuggle_url(f'https://player.vimeo.com/video/{vimeo_id}', {'referer': 'https://api.cybrary.it'})
                'url': smuggle_url(data_url, {'referer': webpage_url}),
            {'referer': url}))
    filter_dict,
        full_response = self._request_webpage(url, video_id, headers=filter_dict({
            'Referer': smuggled_data.get('referer'),
        }))
            headers = filter_dict({'Referer': smuggled_data.get('referer')})
                    'referer': url,
                    {'referer': url})
                    'referer': 'https://storyfire.com/',
        return smuggle_url(url, {'referer': referrer_url})
        if 'referer' in data:
            headers['Referer'] = data['referer']
    headers.pop('Ytdl-socks-proxy', None)