CVE-2021-3281 — Vulnerability in django — CVE Details
Django Directory Traversal via archive.extract
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (7.61%). Schedule for your next planned update.
Does your project use an affected django version?
Paste your requirements.txt to check it for CVE-2021-3281 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
In Django 2.2 before 2.2.18, 3.0 before 3.0.12, and 3.1 before 3.1.6, the django.utils.archive.extract method (used by "startapp --template" and "startproject --template") allows directory traversal via an archive with absolute paths or relative paths with dot segments.
Advisory Timeline
- First published March 18, 2021 (2079 days ago).
- Last revised September 20, 2024 — 1282 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
pip install "django>=3.1.6"
pip install "django>=3.0.12"
pip install "django>=2.2.18"
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (3)
Affects 1 ecosystem: PyPI (1).
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-22Path TraversalMITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 5.3 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
References
- https://nvd.nist.gov/vuln/detail/CVE-2021-3281ADVISORY
- https://github.com/django/django/commit/02e6592835b4559909aa3aaaf67988fef435f624WEB
- https://github.com/django/django/commit/05413afa8c18cdb978fcdf470e09f7a12b234a23WEB
- https://github.com/django/django/commit/21e7622dec1f8612c85c2fc37fe8efbfd3311e37WEB
- https://github.com/django/django/commit/52e409ed17287e9aabda847b6afe58be2fa9f86aWEB
- https://docs.djangoproject.com/en/3.1/releases/3.0.12WEB
- https://docs.djangoproject.com/en/3.1/releases/securityWEB
- https://github.com/advisories/GHSA-fvgf-6h6h-3322ADVISORY
- https://github.com/django/djangoPACKAGE
- https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2021-9.yamlWEB
- https://groups.google.com/forum/#!forum/django-announceWEB
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/YF52FKEH5S2P5CM4X7IXSYG67YY2CDOOWEB
- https://security.netapp.com/advisory/ntap-20210226-0004WEB
- https://www.djangoproject.com/weblog/2021/feb/01/security-releasesWEB
Frequently Asked Questions
- What is CVE-2021-3281?
- Django Directory Traversal via archive.extract. This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 5.3/10).
- How do I check if my project is affected by CVE-2021-3281?
- CVE-2021-3281 affects django. It has a 7.6% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2021-3281 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Exploitation requires specific conditions, or the impact is limited.
This places it in the top 5% of EPSS-scored vulnerabilities — 95.3% of tracked vulnerabilities score at or below it, so it is far more likely to be exploited than nearly all other tracked vulnerabilities.
Also Known As
Related CVEs
- CVE-2025-14550HIGH
- CVE-2025-57833HIGH
Django is subject to SQL injection through its column aliases
- CVE-2026-1207HIGH
Django has an SQL Injection issue
- CVE-2026-1207MEDIUM
- CVE-2024-41990MEDIUM
Django vulnerable to a denial-of-service attack
- CVE-2020-24584
- CVE-2024-39330
- CVE-2021-35042