CVE-2026-26331 · GitHub_M
yt-dlp: Arbitrary Command Injection when using the `--netrc-cmd` option
yt-dlp is a command-line audio/video downloader. Starting in version 2023.06.21 and prior to version 2026.02.21, when yt-dlp's `--netrc-cmd` command-line option (or `netrc_cmd` Python API parameter) is used, an attacker could achieve arbitrary command injection on the user's system with a maliciously crafted URL. yt-dlp maintainers assume the impact of this vulnerability to be high for anyone who uses `--netrc-cmd` in their command/configuration or `netrc_cmd` in their Python scripts. Even though the maliciously crafted URL itself will look very suspicious to many users, it would be trivial for a maliciously crafted webpage with an inconspicuous URL to covertly exploit this vulnerability via HTTP redirect. Users without `--netrc-cmd` in their arguments or `netrc_cmd` in their scripts are unaffected. No evidence has been found of this exploit being used in the wild. yt-dlp version 2026.02.21 fixes this issue by validating all netrc "machine" values and raising an error upon unexpected input. As a workaround, users who are unable to upgrade should avoid using the `--netrc-cmd` command-line option (or `netrc_cmd` Python API parameter), or they should at least not pass a placeholder...
Published 2026-02-24, last changed 2026-06-17. Weakness: CWE-78.
How to fix
Upgrade to a fixed version: yt-dlp 2026.02.21 (PyPI). For the version that clears every advisory for your installed version, ask an agent for get_remediation.
Where the flaw is in the code
Fixed in yt-dlp/yt-dlp by 1fbbe29b99, e2a9cc7d13. Functions changed by the fix: initialize, _get_netrc_login_info, GetCourseRuIE, PornHubIE, PornHubUserIE, TeachableIE, TeachableCourseIE. Regression tests: test/test_InfoExtractor.py. Confidence: verified (a record names this commit as the fix, and it changed these functions).
Timeline
| 2026-02-23 | Package advisory GHSA-g3gw-q23r-pgqm |
| 2026-02-24 | Published |
| 2026-06-17 | Record last changed |
| 2026-07-13 | Package advisory PYSEC-2026-3432 |
| 2026-11-30 | EPSS when our history starts: 2.37% |
| 2026-12-03 | Code-level analysis added |
Affected packages
| Advisory | Package | Fixed in |
|---|---|---|
| GHSA-g3gw-q23r-pgqm | yt-dlp (PyPI) | 2026.02.21 |
| PYSEC-2026-3432 | yt-dlp (PyPI) | 2026.02.21 |
Also known as: GHSA-g3gw-q23r-pgqm, PYSEC-2026-3432
Related
| CVE | Published | CVSS | Summary |
|---|---|---|---|
| CVE-2026-55404 | 2026-07-08 | 8.8 | yt-dlp: Downstream command injection via improper sanitization of yt-dlp --write-link output |
| CVE-2026-50574 | 2026-06-23 | 9.6 | yt-dlp: Arbitrary code execution via manifest downloads with aria2c |
| CVE-2026-50023 | 2026-06-23 | 9.6 | yt-dlp: Dangerous file type creation via insufficient filename sanitization (Bypass of CVE-2024-38519) |
| CVE-2026-50019 | 2026-06-23 | 7.4 | yt-dlp: File Downloader cookie leak with curl |
| CVE-2024-38519 | 2024-07-02 | 7.8 | yt-dlp and youtube-dl vulnerable to file system modification and RCE through improper file-extension sanitization |
| CVE-2024-22423 | 2024-04-09 | 9.8 | yt-dlp `--exec` command injection when using `%q` in yt-dlp on Windows |
| CVE-2023-46121 | 2023-11-15 | 3.7 | Generic Extractor MITM Vulnerability in yt-dlp |
| CVE-2023-40581 | 2023-09-25 | 7.8 | yt-dlp command injection when using `%q` in `--exec` on Windows |
Add it to your agent
One command for Claude Code; setup for Claude Desktop, Cursor and others. No signup or key.
claude mcp add --transport http keygraph-cve https://cve-mcp.keygraph.io/mcp
Then ask for triage_cve CVE-2026-26331, or call /api/v1/vulnerabilities/CVE-2026-26331. To prove whether it is exploitable in your running app, run Shannon, Keygraph's open-source AI pentester.