yt-dlp: Arbitrary Command Injection when using the `--netrc-cmd` option
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- Required
- Attack complexity
- Low
- Impact type
- Code execution
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub. Impact type from CWE-78.
Summary
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 (`{}`) in their `--netrc-cmd` argument.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- No
- Technical impact
- Total
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| yt-dlp | yt-dlp | 2023.06.21 to before 2026.02.21 | 2026.02.21 | Patch available | CNA |
| — | yt-dlp (PyPI) | 2023.06.21 to before 2026.02.21 | 2026.02.21 | Patch available | GHSA-g3gw-q23r-pgqm |
- yt-dlp Vendoryt-dlp Affected 2023.06.21 to before 2026.02.21 Fixed in 2026.02.21 Patch available CNA
- yt-dlp (PyPI) Vendor— Affected 2023.06.21 to before 2026.02.21 Fixed in 2026.02.21 Patch available GHSA-g3gw-q23r-pgqm
Remediation
- Fix · CNA yt-dlp (yt-dlp) Fixed in 2026.02.21
- Fix · GHSA-g3gw-q23r-pgqm yt-dlp (PyPI) Fixed in 2026.02.21 Advisory →
Vendor assessments
Timeline
- 2026-10-02 Threatist record created from CVE-2026-26331
- 2026-10-03 Alias added: GHSA-g3gw-q23r-pgqm
References
More Yt-dlp vulnerabilities
- TI-2024-03325 Command injection vulnerability in programing languages on Microsoft Windows operating system. CVSS 3.1CRITICAL 9.8
- TI-2026-36849 yt-dlp: Dangerous file type creation via insufficient filename sanitization (Bypass of CVE-2024-38519) CVSS 3.1CRITICAL 9.6
- TI-2025-33915 yt-dlp allows `--exec` command injection when using placeholder on Windows CVSS 3.1HIGH 8.1
- TI-2024-14996 yt-dlp `--exec` command injection when using `%q` in yt-dlp on Windows CVSS 3.1CRITICAL 9.8
- TI-2026-37295 yt-dlp: Arbitrary code execution via manifest downloads with aria2c CVSS 3.1CRITICAL 9.6
- TI-2026-39974 yt-dlp: Downstream command injection via improper sanitization of yt-dlp --write-link output CVSS 3.1HIGH 8.8
Sources
- CVE-2026-26331 · CVE Program
- CVE-2026-26331 · NVD
- FIRST EPSS
- GHSA-g3gw-q23r-pgqm · GitHub Advisory Database · CC BY 4.0
- CVE-2026-26331 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences