Moodle dl: yt-dlp: Arbitrary Command Injection when using the `--netrc-cmd` option (CVE-2026-26331)
A command injection vulnerability exists in yt-dlp when using the `--netrc-cmd` option or `netrc_cmd` Python API parameter. This flaw allows an attacker to execute arbitrary shell commands on the user's system by supplying a maliciously crafted URL. The vulnerability affects yt-dlp versions prior to 2026.02.21. The issue arises because the netrc "machine" value, which can be influenced by certain extractors processing hostnames, is passed unsafely to a shell command executed with `shell=True`. The vulnerability is mitigated by yt-dlp version 2026.02.21, which validates netrc "machine" values to prevent injection. Users who do not use `--netrc-cmd` or `netrc_cmd` are not affected. No active exploitation has been observed in the wild.
AI Analysis
Technical Summary
yt-dlp's `--netrc-cmd` option allows running arbitrary shell commands to retrieve site login credentials, with an optional placeholder `{}` replaced by the netrc "machine" value. Certain extractors dynamically source this "machine" value from hostnames and allow wildcard subdomains, which can include special shell characters. Because the command is executed with `shell=True`, these characters can lead to arbitrary command injection. A malicious URL can exploit this by injecting shell commands via the hostname part of the URL. The generic extractor's HTTP redirect following can be abused to redirect to such malicious URLs. The vulnerability is fixed in yt-dlp version 2026.02.21 by validating netrc "machine" values and raising errors on unexpected input.
Potential Impact
An attacker can achieve arbitrary command execution on the victim's system if the victim uses the vulnerable `--netrc-cmd` option or `netrc_cmd` API parameter with yt-dlp versions before 2026.02.21. This can lead to full compromise of the user's environment running yt-dlp. Users not using these options are unaffected. No evidence of exploitation in the wild has been found.
Mitigation Recommendations
Upgrade yt-dlp to version 2026.02.21 or later, which includes validation of netrc "machine" values to prevent command injection. If upgrading is not possible, avoid using the `--netrc-cmd` option or the `netrc_cmd` Python API parameter, or do not pass a placeholder `{}` in the `--netrc-cmd` argument.
Moodle dl: yt-dlp: Arbitrary Command Injection when using the `--netrc-cmd` option (CVE-2026-26331)
Description
A command injection vulnerability exists in yt-dlp when using the `--netrc-cmd` option or `netrc_cmd` Python API parameter. This flaw allows an attacker to execute arbitrary shell commands on the user's system by supplying a maliciously crafted URL. The vulnerability affects yt-dlp versions prior to 2026.02.21. The issue arises because the netrc "machine" value, which can be influenced by certain extractors processing hostnames, is passed unsafely to a shell command executed with `shell=True`. The vulnerability is mitigated by yt-dlp version 2026.02.21, which validates netrc "machine" values to prevent injection. Users who do not use `--netrc-cmd` or `netrc_cmd` are not affected. No active exploitation has been observed in the wild.
CVSS v3.1
Score 8.8high
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
yt-dlp's `--netrc-cmd` option allows running arbitrary shell commands to retrieve site login credentials, with an optional placeholder `{}` replaced by the netrc "machine" value. Certain extractors dynamically source this "machine" value from hostnames and allow wildcard subdomains, which can include special shell characters. Because the command is executed with `shell=True`, these characters can lead to arbitrary command injection. A malicious URL can exploit this by injecting shell commands via the hostname part of the URL. The generic extractor's HTTP redirect following can be abused to redirect to such malicious URLs. The vulnerability is fixed in yt-dlp version 2026.02.21 by validating netrc "machine" values and raising errors on unexpected input.
Potential Impact
An attacker can achieve arbitrary command execution on the victim's system if the victim uses the vulnerable `--netrc-cmd` option or `netrc_cmd` API parameter with yt-dlp versions before 2026.02.21. This can lead to full compromise of the user's environment running yt-dlp. Users not using these options are unaffected. No evidence of exploitation in the wild has been found.
Mitigation Recommendations
Upgrade yt-dlp to version 2026.02.21 or later, which includes validation of netrc "machine" values to prevent command injection. If upgrading is not possible, avoid using the `--netrc-cmd` option or the `netrc_cmd` Python API parameter, or do not pass a placeholder `{}` in the `--netrc-cmd` argument.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- BREW-moodle-dl-CVE-2026-26331
- Osv Schema Version
- 1.7.3
- Ecosystems
- ["Homebrew"]
- Cvss Version
- 3.1
Threat ID: 6aac8e6755bf5e2cf5491e8a
Added to database: 09/18/2026, 01:05:43 UTC
Last enriched: 09/18/2026, 01:57:01 UTC
Last updated: 09/18/2026, 02:06:37 UTC
Views: 5
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.