CVE-2026-26331 in yt-dlp
Summary
by MITRE • 02/24/2026
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.
If you want to get the best quality for vulnerability data then you always have to consider VulDB.
Analysis
by VulDB Data Team • 02/25/2026
This vulnerability affects yt-dlp version 2023.06.21 through 2026.02.20 and represents a critical command injection flaw that arises from improper handling of netrc machine values when the --netrc-cmd option is utilized. The vulnerability stems from a failure to properly validate user-supplied input in the netrc configuration processing logic, creating an attack surface where maliciously crafted URLs can trigger arbitrary command execution on the victim's system. The technical implementation flaw aligns with CWE-78, which specifically addresses OS command injection vulnerabilities where untrusted data is directly incorporated into command strings without proper sanitization or validation.
The operational impact of this vulnerability is significant as it allows attackers to execute arbitrary commands with the privileges of the user running yt-dlp, potentially leading to complete system compromise. The attack vector becomes particularly dangerous when considering that malicious URLs can be embedded in seemingly innocuous web pages, making exploitation possible through HTTP redirects without users recognizing the malicious nature of the URL. This covert exploitation technique leverages the principle of social engineering combined with technical vulnerability exploitation, making it particularly challenging to detect and prevent. The vulnerability's designation as high impact by maintainers reflects the ease with which attackers can construct malicious URLs and the broad potential for system compromise.
The vulnerability is mitigated in yt-dlp version 2026.02.21 through enhanced input validation that specifically checks all netrc "machine" values and raises appropriate errors for unexpected input patterns. This fix addresses the root cause by implementing proper input sanitization and validation mechanisms that prevent dangerous characters or command sequences from being processed as part of the command execution flow. Security practitioners should note that this vulnerability operates outside of the typical ATT&CK framework's command and control categories, instead representing a privilege escalation and execution vulnerability that can be exploited through web-based attack vectors. The recommended mitigation strategy of avoiding --netrc-cmd usage when possible aligns with defense-in-depth principles, while the workaround of avoiding placeholder substitution in --netrc-cmd arguments provides a temporary solution for users who cannot immediately upgrade their installations. The absence of evidence for this exploit being used in the wild does not diminish its severity, as the vulnerability remains exploitable and the potential for malicious use exists within the current threat landscape.