Skip to main content

Moodle dl: yt-dlp: Arbitrary Command Injection when using the `--netrc-cmd` option (CVE-2026-26331)

0
High
Published: 08/13/2026 (08/13/2026, 17:14:32 UTC)
Source: GCVE Database
Product: moodle-dl

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

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Affected software

Homebrewmore threats →ghsa
moodle-dl
pkg:brew/moodle-dl
Affected versions
>=2.3.13 <2.3.13_6

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

AILast updated: 09/18/2026, 01:57:01 UTC

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.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

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 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

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

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses