Skip to content
Path traversal Advisory Intermediate CVE-2024-38519

GHSL-2024-090: Path traversal in yt-dlp leading to RCE - CVE-2024-38519

yt-dlp did not validate the subtitle extension name, allowing path traversal on Windows. An attacker could overwrite arbitrary files, potentially leading to remote code execution if an executable is overwritten.

jarlob Follow

Originally disclosed on GitHub Security Lab

yt-dlp doesn’t validate the subtitle extension name, which makes its Windows users vulnerable to path traversal and allows for arbitrary binary file overwrite when downloading a video with subtitles from a crafted link.

jarlob, on GitHub Security Lab

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the subtitle extension from extractors is used directly in the output filename without sanitisation, allowing path traversal on Windows.

Impact

This issue may lead to unauthorized file system modification and later may lead to remote code execution if an executable file is overwritten.

What the attacker needed

Windows operating system; yt-dlp version before 2024.07.01; User runs yt-dlp with subtitle download option; Attacker can host a malicious page or compromise a video…

How it was found

  1. Create a folder with a malicious HTML file that embeds a crafted link to a supported video site with a smuggled fragment.
  2. Create subfolders and an XML file that defines a subtitle extension containing a path traversal sequence.
  3. Create an arbitrary file named 'subtitles' in the subfolder.
  4. Host the folder with a simple HTTP server.
  5. On Windows, run yt-dlp with the --write-subs option pointing to the hosted HTML file.
  6. yt-dlp writes a file outside the current folder, overwriting an existing file if permissions allow.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

yt-dlp is a tool for downloading videos. It also downloads subtitles, and the file extension for subtitles comes from the video website. On Windows, if that extension contains path traversal characters like '../', yt-dlp could write a file outside the intended folder, overwriting any file the user has permission to write. This could let an attacker replace a program with malicious code.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

More by jarlob

View all

192 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.