Directory Traversal Vulnerability in Python-Django: CVE-2021-28658

python-django Updated 02 Oct 2025

Summary

06/04/2021
N/A
No i
Medium
5.3

UBUNTU-CVE-2021-28658: In Django 2.2 before 2.2.20, 3.0 before 3.0.14, and 3.1 before 3.1.8, MultiPartParser allowed directory traversal via uploaded files with suitably crafted file names. Affects python-django versions 1.5.4-1ubuntu1 – 1.6.11-0ubuntu1.3+esm7. No fix is published. 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 Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Python-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 ORM, routing, and templating. However, certain versions of Python-Django are vulnerable to a directory traversal issue that can be exploited through crafted file names during file uploads.

Vulnerability Detail

In Django versions 2.2 before 2.2.20, 3.0 before 3.0.14, and 3.1 before 3.1.8, the MultiPartParser component allowed attackers to perform directory traversal attacks via uploaded files with specially crafted file names. This vulnerability could lead to unauthorized access to sensitive files on the server, potentially compromising the integrity and confidentiality of the application.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a temporary workaround, it is recommended to validate and sanitize file names before processing uploads to prevent directory traversal attacks. Implementing strict checks on the file paths can mitigate the risk until the package is updated.

Conclusion

The directory traversal vulnerability in Python-Django (CVE-2021-28658) poses a significant risk to applications using affected versions. It is crucial to update to the patched versions to safeguard against potential exploits. Regular monitoring and validation of file uploads can further enhance security.

See every vulnerability recorded for python-django →

Share this vulnerability

FAQ

CVE-2021-28658 is a vulnerability in certain versions of Python-Django that allows directory traversal through crafted file names during file uploads.

The affected versions include Django 2.2 before 2.2.20, 3.0 before 3.0.14, and 3.1 before 3.1.8.

Exploitation of this vulnerability could lead to unauthorized access to sensitive files on the server, compromising the application's security.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without any signup.

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

Related vulnerabilities

Recent vulnerabilities recorded for python-django.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. 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