Skip to content
Path traversal Advisory Intermediate CVE-2021-33203

GHSL-2021-075: Path injection in Django - CVE-2021-33203

An unsafe path join in Django's admindocs template detail view allowed an authenticated admin to supply a path outside the templates directory, causing the application to check for and read arbitrary files. This let the attacker disclose the presence of files on the filesystem, though the contents could not be displayed.

ghsecuritylab Follow

Originally disclosed on GitHub Security Lab

A Path Injection issue was found in django that allows a malicious admin user to disclose the presence of files on the file-system if the module django.contrib.admindocs is enabled.

ghsecuritylab, 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

Impact

An authenticated malicious admin could disclose the presence of arbitrary files, but the contents could not be displayed.

What the attacker needed

Admin account; django.contrib.admindocs enabled

The fix

The issue was fixed in a security release.

How it was found

  1. Log in as an admin user.
  2. Request the template detail page with a path pointing outside the templates directory, such as an absolute system file path.
  3. Observe whether the page indicates the file exists.

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.

Django is a web framework, and its admin documentation feature lets staff view template files. The code joined a user-supplied path with a directory without checking for '..' or absolute paths, so an admin could ask for files outside the intended folder. The attacker could then learn whether a file exists, but not see its contents.

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 ghsecuritylab

View all

132 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.