Directory Traversal Vulnerability in Django Package

python-django Updated 02 Oct 2025

Summary

08/06/2021
N/A
Yes i
Medium
4.9

CVE-2021-33203: Django before 2.2.24, 3.x before 3.1.12, and 3.2.x before 3.2.4 has a potential directory traversal via django.contrib.admindocs. Affects python-django across 2 version ranges.

< 2:2.2.24-1 < 2da029d8540ab0b2e9edcba25c4d46c52853197f

Fixed in 2:2.2.24-1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. It provides a robust set of features for building web applications, including an admin interface, ORM, and templating engine. However, certain versions of Django are vulnerable to a directory traversal issue that could expose sensitive files to unauthorized users.

Vulnerability Detail

Django versions prior to 2.2.24, 3.x before 3.1.12, and 3.2.x before 3.2.4 are susceptible to a directory traversal vulnerability via django.contrib.admindocs. This flaw allows staff members to use the TemplateDetailView view to check for the existence of arbitrary files. If the default admindocs templates have been customized to display file contents, this could lead to unauthorized exposure of sensitive information. The vulnerability arises from improper handling of file paths, enabling attackers to traverse outside the intended directories.

How To Fix

Minimum fixed version

2:2.2.24-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade python-django

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, you can restrict access to the admindocs feature by modifying your Django settings. Disable the admindocs app in your INSTALLED_APPS list:

INSTALLED_APPS = [ ... # 'django.contrib.admindocs', # Comment this line out ...

]

Conclusion

The directory traversal vulnerability in Django poses a significant risk to applications using affected versions. It is crucial to update to the latest secure version to mitigate this risk. Additionally, implementing workarounds can provide temporary relief until a proper fix is applied.

See every vulnerability recorded for python-django →

Share this vulnerability

FAQ

A directory traversal vulnerability allows an attacker to access files and directories that are stored outside the intended directory. This can lead to unauthorized access to sensitive information.

Django versions before 2.2.24, 3.x before 3.1.12, and 3.2.x before 3.2.4 are affected by this vulnerability.

You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Visit Vulert Scanner to check if your application is affected by this vulnerability without requiring any signup.

If exploited, this vulnerability could allow unauthorized users to view sensitive files, leading to data breaches and potential compromise of the application.

The CVSS score for this vulnerability is 4.9, indicating a moderate level of severity.

Related vulnerabilities

Recent vulnerabilities recorded for python-django.

How To Fix

Minimum fixed version

2:2.2.24-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade python-django

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback