GHSA-42h4-v29r-42qg · Severity: high · Ecosystem: pip — yt-dlp on Windows vulnerable to `--exec` command injection when using `%q`
yt-dlp is a youtube-dl fork with additional features and fixes. yt-dlp allows the user to provide shell command lines to be executed at various stages in its download steps through the `--exec` flag. This flag allows output template expansion in its argument, so that metadata values may be used in the shell commands. The metadata fields can be combined with the `%q` conversion, which is intended to quote/escape these values so they can be safely passed to the shell. However, the escaping used for `cmd` (the shell used by Python's `subprocess` on Windows) does not properly escape special characters, which can allow for remote code execution if `--exec` is used directly with maliciously crafted remote data. This vulnerability only impacts `yt-dlp` on Windows, and the vulnerability is present regardless of whether `yt-dlp` is run from `cmd` or from `PowerShell`. Support for output template expansion in `--exec`, along with this vulnerable behavior, was added to `yt-dlp` in version 2021.04.11. yt-dlp version 2023.09.24 fixes this issue by properly escaping each special character. `\n` will be replaced by `\r` as no way of escaping it has been found. It is recommended to upgrade yt-dlp to version 2023.09.24 as soon as possible. Also, always be careful when using --exec, because while this specific vulnerability has been patched, using unvalidated input in shell commands is inherently dangerous. For Windows users who are not able to upgrade: 1. Avoid using any output template expansion in --exec other than {} (filepath). 2. If expansion in --exec is needed, verify the fields you are using do not contain ", | or &. 3. Instead of using --exec, write the info json and load the fields from it instead.
Conclusion & alert: CVE-2023-40581 is rated High Exploit Risk (80.8/100): CVSS High severity, with high exploitation likelihood (EPSS 12.98%, 94th percentile). Core evidence: 1 public exploit reference(s) are indexed (Exploit-DB). Mandatory action: Public exploits are available—assess exposure, apply mitigations, and prioritize patching.
Risk is dynamic; we continuously reassess and refresh what is shown on this page as upstream context changes.
| EDB-ID | Source | Kind | Published | Link |
|---|---|---|---|---|
| — | nvd_ref | exploit_tag | Exploit-DB ↗ |
EPSS lead: Daily EPSS estimates relative likelihood of exploitation; percentile ranks this CVE among scored vulnerabilities (higher = more severe relative rank).
| # | Date | Old EPSS score | New EPSS score | Delta (New - Old) |
|---|---|---|---|---|
| 1 | 2026-05-07 | 13.29% | 12.98% | -0.30% |
| 2 | 2026-04-24 | 12.98% | 13.29% | +0.30% |
| 3 | 2026-04-21 | — | 12.98% | — |
Full EPSS history (22 records total)
CVSS metrics for this CVE.
| Base score | Version | Severity | Vector | Exploitability | Impact | Score source |
|---|---|---|---|---|---|---|
| 8.3 | 3.1 | HIGH |
|
1.6 | 6.0 | [email protected] |
| 7.8 | 3.1 | HIGH |
|
1.8 | 5.9 | [email protected] |
GHSA-42h4-v29r-42qg · Severity: high · Ecosystem: pip — yt-dlp on Windows vulnerable to `--exec` command injection when using `%q`
| vendor | priority | summary | link |
|---|---|---|---|
alpine
|
high | CVE-2023-40581: 1 source package rows (yt-dlp); 6 state rows across 5 repos (3.19-community, 3.20-community, 3.21-community, 3.22-community, edge-community); fixed 6, open 0. | https://security.alpinelinux.org/vuln/CVE-2023-40581 |
debian
|
unimportant | CVE-2023-40581 unimportant priority: Debian including 1 source packages (yt-dlp), 4 status rows across 4 suites (bookworm, forky, sid, trixie): resolved 4. | https://security-tracker.debian.org/tracker/CVE-2023-40581 |
ubuntu
|
medium | CVE-2023-40581 medium priority: Ubuntu including 1 source packages (yt-dlp), 8 status rows across 8 suites (bionic, focal, jammy, lunar, mantic, trusty, upstream, xenial): not-affected 4, ignored 3, DNE 1. | https://ubuntu.com/security/CVE-2023-40581 |
| Vendor | Product | Version | Raw CPE |
|---|---|---|---|
| yt-dlp_project | yt-dlp | >= 2021.04.11, < 2023.09.24 | cpe:2.3:a:yt-dlp_project:yt-dlp:*:*:*:*:*:*:*:* |
| URL | Tags |
|---|---|
| https://github.com/yt-dlp/yt-dlp-nightly-builds/releases/tag/2023.09.24.003044 | Product Release Notes |
| https://github.com/yt-dlp/yt-dlp/commit/de015e930747165dbb8fcd360f8775fd973b7d6e | Patch |
| https://github.com/yt-dlp/yt-dlp/releases/tag/2021.04.11 | Product Release Notes |
| https://github.com/yt-dlp/yt-dlp/releases/tag/2023.09.24 | Product Release Notes |
| https://github.com/yt-dlp/yt-dlp/security/advisories/GHSA-42h4-v29r-42qg | Exploit Mitigation Patch Third Party Advisory |