CVE-2021-35042 — SQL Injection in django — CVE Details
SQL Injection in Django
What Should I Do?
Fix Within 2-4 Weeks
Moderate exploitation risk (44.37% probability in 30 days). Schedule remediation soon.
Does your project use an affected django version?
Paste your requirements.txt to check it for CVE-2021-35042 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
Django 3.1.x before 3.1.13 and 3.2.x before 3.2.5 allows QuerySet.order_by SQL injection if order_by is untrusted input from a client of a web application.
Advisory Timeline
- First published September 22, 2021 (1891 days ago).
- Last revised February 21, 2025 — 1247 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
pip install "django>=3.1.13"
pip install "django>=3.2.5"
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (2)
Affects 1 ecosystem: PyPI (1).
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-89SQL InjectionMITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 9.8 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
References
- https://nvd.nist.gov/vuln/detail/CVE-2021-35042ADVISORY
- https://github.com/django/django/commit/0bd57a879a0d54920bb9038a732645fb917040e9WEB
- https://github.com/django/django/commit/a34a5f724c5d5adb2109374ba3989ebb7b11f81fWEB
- https://github.com/django/django/commit/dae83a24519d6f284c74414e0b81d64d9b5a0db4WEB
- https://docs.djangoproject.com/en/3.2/releases/securityWEB
- https://github.com/advisories/GHSA-xpfp-f569-q3p2ADVISORY
- https://github.com/django/djangoPACKAGE
- https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2021-109.yamlWEB
- https://groups.google.com/forum/#!forum/django-announceWEB
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/SS6NJTBYWOX6J7G4U3LUOILARJKWPQ5YWEB
- https://security.netapp.com/advisory/ntap-20210805-0008WEB
- https://www.djangoproject.com/weblog/2021/jul/01/security-releasesWEB
- https://www.openwall.com/lists/oss-security/2021/07/02/2WEB
Frequently Asked Questions
- What is CVE-2021-35042?
- SQL Injection in Django. This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.8/10).
- How do I check if my project is affected by CVE-2021-35042?
- CVE-2021-35042 affects django. It has a 44.4% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2021-35042 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Maximum impact if exploited, often with little effort or access required.
This places it in the top 5% of EPSS-scored vulnerabilities — 99.1% 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-2024-39330HIGH
Django Path Traversal vulnerability
- CVE-2022-41323HIGH
Django denial-of-service vulnerability in internationalized URLs
- CVE-2026-53877MEDIUM
Django: GDALRaster may over-read heap memory when constructed from bytes
- CVE-2026-35193LOW
Django: UpdateCacheMiddleware may disclose private cached responses by omitting Authorization from Vary
- CVE-2025-27556
- CVE-2025-32873
- CVE-2022-34265
- CVE-2022-36359