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

python-django Updated 02 Oct 2025

Summary

04/01/2022
N/A
No i
Medium
5.3

UBUNTU-CVE-2021-45452: Storage.save in Django 2.2 before 2.2.26, 3.2 before 3.2.11, and 4.0 before 4.0.1 allows directory traversal if crafted filenames are directly passed to it. 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 Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

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, URL routing, and templating. However, certain versions of Python-Django are vulnerable to a directory traversal issue, which can be exploited if crafted filenames are passed directly to the Storage.save method.

Vulnerability Detail

The vulnerability identified as CVE-2021-45452 affects Django versions prior to 2.2.26, 3.2 prior to 3.2.11, and 4.0 prior to 4.0.1. It allows attackers to perform directory traversal attacks by manipulating filenames, potentially leading to unauthorized access to sensitive files on the server. This issue arises from improper handling of file paths, which can be exploited to access files outside the intended directory structure.

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, avoid passing user-controlled filenames directly to the Storage.save method. Instead, validate and sanitize the filenames before processing them to prevent potential exploitation.

Conclusion

CVE-2021-45452 is a significant vulnerability in Python-Django that can lead to directory traversal attacks if not addressed. Users are strongly encouraged to update their Django installations to the latest patched versions to ensure the security of their applications.

See every vulnerability recorded for python-django →

Share this vulnerability

FAQ

CVE-2021-45452 is a vulnerability in Python-Django that allows directory traversal through improper handling of filenames in the Storage.save method.

The vulnerability affects Django versions prior to 2.2.26, 3.2 prior to 3.2.11, and 4.0 prior to 4.0.1.

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

The CVSS score of CVE-2021-45452 is 5.3, indicating a medium severity level.

If an immediate update is not possible, implement input validation and sanitization for filenames to mitigate the risk of exploitation.

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