CVE-2021-28658: Directory Traversal in Django

django Updated 02 Oct 2025

Summary

08/04/2021
Yes i
Moderate
5.3

CVE-2021-28658: Directory Traversal in Django. Affects django across 3 version ranges.

>= 2.2a1, < 2.2.20 >= 3.0a1, < 3.0.14 >= 3.1a1, < 3.1.8

Fixed in 2.2.20, 3.0.14 or 3.1.8, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2021-28658 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

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 Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

Django is a popular Python web framework known for its simplicity and scalability. It provides a robust set of tools and features for building web applications. However, versions 2.2 before 2.2.20, 3.0 before 3.0.14, and 3.1 before 3.1.8 of Django are vulnerable to a directory traversal attack. This vulnerability allows an attacker to bypass file upload restrictions and access files outside of the intended directory.

Vulnerability Detail

The directory traversal vulnerability in Django arises from a flaw in the MultiPartParser. By uploading files with specially crafted names, an attacker can manipulate the file path and traverse directories to access sensitive files on the server. This can lead to unauthorized disclosure of sensitive information or even remote code execution if the accessed files contain executable code. It is important to note that built-in upload handlers are not affected by this vulnerability.

How To Fix

Latest published version: 6.1.2 as of 22 Oct 2026

pip install --upgrade "django==6.1.2"

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • >= 2.2a1, < 2.2.20 2.2.20
    pip install --upgrade "django==2.2.20"
  • >= 3.0a1, < 3.0.14 3.0.14
    pip install --upgrade "django==3.0.14"
  • >= 3.1a1, < 3.1.8 3.1.8
    pip install --upgrade "django==3.1.8"

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

There is no known workaround for this vulnerability. It is essential to apply the official patches by upgrading Django to the fixed versions.

Conclusion

The directory traversal vulnerability in Django can have serious consequences if left unpatched. It is highly recommended to upgrade to the fixed versions of Django to mitigate the risk of unauthorized file access and potential remote code execution. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for django →

Share this vulnerability

FAQ

The vulnerability allows an attacker to access sensitive files on the server, potentially leading to unauthorized disclosure of information or remote code execution.

No, only versions 2.2 before 2.2.20, 3.0 before 3.0.14, and 3.1 before 3.1.8 are vulnerable. It is recommended to upgrade to the fixed versions.

Yes, an attacker can exploit this vulnerability remotely by uploading specially crafted files to the affected Django application.

There are no known instances of this vulnerability being exploited in the wild at the time of this report. However, it is crucial to apply the necessary patches to prevent any potential exploitation.

Yes, the CVSS score for this vulnerability is 5.3, indicating a moderate severity level.

Related vulnerabilities

Recent vulnerabilities recorded for django.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Latest published version: 6.1.2 as of 22 Oct 2026

pip install --upgrade "django==6.1.2"

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • >= 2.2a1, < 2.2.20 2.2.20
    pip install --upgrade "django==2.2.20"
  • >= 3.0a1, < 3.0.14 3.0.14
    pip install --upgrade "django==3.0.14"
  • >= 3.1a1, < 3.1.8 3.1.8
    pip install --upgrade "django==3.1.8"

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. 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