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

GHSL-2024-089: Path traversal in youtube-dl leading to RCE - CVE-2024-38519

youtube-dl does not validate the subtitle extension name, allowing path traversal on Windows when downloading subtitles from a crafted link. 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

youtube-dl 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 extracted from the video page is used directly to build the output filename without sanitising path traversal sequences, and Windows accepts such paths.

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 OS; youtube-dl with --write-sub option; victim runs youtube-dl on attacker link; attacker controls a web server

How it was found

  1. Create a folder with a poc.html file that embeds a crafted link to a supported video site with a smuggled fragment specifying an attacker-controlled base_url.
  2. Create subfolders content/content_gfVXISmEB_6804984382 and place a videosettings.xml file there that defines a subtitle extension containing a path traversal sequence.
  3. Create an arbitrary file named subtitles in the content_gfVXISmEB_6804984382 folder.
  4. Host the folder with python3 -m http.server.
  5. On Windows run youtube-dl --write-sub http://[redacted]:8000/poc.html.
  6. youtube-dl creates a file poc.bin one level up from the current folder.

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.

youtube-dl 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 '../', youtube-dl can be tricked into writing a file outside the intended folder. This could let an attacker replace important files, including programs, which might then run 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.