cve.bz

CVE-2021-35042 SQL Injection

9.8 criticalEPSS 44%Fix available

Critical (9.8). EPSS 44% estimated probability of exploitation activity in the next 30 days. Fixed in django 3.1.13, 3.2.5.

On this page
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.

Severity

CVSS 3.1

9.8 critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
EPSS
44% (unchanged from 44% a week ago; 44% 30 days ago) estimated probability of exploitation activity in the next 30 days; 99th percentile. Scored 2026-11-22. A forecast for this CVE across the internet, not for your own systems.
CWE
CWE-89 Improper Neutralization of Special Elements used in an SQL Command (SQL Injection)
OWASP Top 10
A05:2025 Injection
Published
Modified
NVD analysis
Analyzed, since modified
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2021-35042 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2021-35042?via=ask-ai-copy and https://cve.bz/cve/CVE-2021-35042?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2021-35042 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the NVD's CPE matches.

ProductAffected
djangoproject:djangofrom 3.1 before 3.1.13
djangoproject:djangofrom 3.2 before 3.2.5
fedoraproject:fedora34

Packages (OSV)

AdvisoryEcosystemPackageAffectedFixed in
GHSA-xpfp-f569-q3p2PyPIdjango>=3.2a1 <3.2.53.2.5
GHSA-xpfp-f569-q3p2PyPIdjango>=3.0a1 <3.1.133.1.13
PYSEC-2021-109PyPIdjango>=3.1 <3.1.13
>=3.2 <3.2.5
3.1.13, 3.2.5

Linux distributions

DistributionReleasePackageFixed inAdvisory
openSUSETumbleweedpython-Django3.2.7-2.3openSUSE-SU-2024:11205-1
openSUSETumbleweedpython-Django4.2.11-2.1openSUSE-SU-2024:13887-1
openSUSETumbleweedpython-Django5.2.16-1.1openSUSE-SU-2026:11248-1
openSUSETumbleweedpython-Django44.2.14-1.1openSUSE-SU-2024:14208-1
openSUSETumbleweedpython-Django44.2.30-4.1openSUSE-SU-2026:11235-1
openSUSETumbleweedpython-Django55.2.16-1.1openSUSE-SU-2026:11270-1
openSUSETumbleweedpython-Django66.0-1.1openSUSE-SU-2026:10005-1
Alpinev3.13, v3.14, v3.15 and 9 morepy3-django3.1.13-r0ALPINE-CVE-2021-35042

From the distributions' data via OSV.dev: SUSE security data, CC BY 4.0; the Alpine secdb, CC BY-SA 4.0. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: openSUSE · Alpine.

Red Hat

Red Hat rates this Important.

Red Hat's mitigation

Mitigation for this issue is either not available or the currently available options do not meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base or stability.

ProductPackageStateAdvisory
Red Hat Ansible Automation Platform 1.2djangoNot affected
Red Hat Ansible Automation Platform 1.2python-djangoNot affected
Red Hat Ansible Tower 3djangoNot affected
Red Hat Ceph Storage 2calamari-serverNot affected
Red Hat Ceph Storage 2python-djangoNot affected
Red Hat Ceph Storage 3python-djangoNot affected
Red Hat OpenStack Platform 10 (Newton)python-djangoNot affected
Red Hat OpenStack Platform 13 (Queens)python-djangoNot affected
Red Hat OpenStack Platform 16.1python-django20Not affected
Red Hat OpenStack Platform 16.2python-django20Not affected
Red Hat Satellite 6python3-djangoNot affected
Red Hat Satellite 6python-djangoNot affected
Red Hat Storage 3python-djangoNot affected
Red Hat Update Infrastructure 3 for Cloud Providerspython-djangoNot affected

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2021-35042.

GitHub PoC

Repositories on GitHub named after this CVE or listed for it by the PoC-in-GitHub index. For those marked Harbor Check: matches CVE, Flawharbor read the code and found it implements this CVE's exploitation technique: read, not run, and its dependencies only checked for warning signs, so a pointer and no guarantee. The rest are unverified: some hold a working proof of concept, some nothing useful, and some malware made to look like one. Read the code before you run any of it. How Harbor Check reads them, and what it found.

Attack patterns (CAPEC)

  • CAPEC-7 Blind SQL Injection Likelihood: High · Severity: High
  • CAPEC-66 SQL Injection Likelihood: High · Severity: High
  • CAPEC-108 Command Line Execution through SQL Injection Likelihood: Low · Severity: Very High
  • CAPEC-109 Object Relational Mapping Injection Likelihood: Low · Severity: High
  • CAPEC-110 SQL Injection through SOAP Parameter Tampering Likelihood: High · Severity: Very High
  • CAPEC-470 Expanding Control over the Operating System from the Database Severity: Very High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits.

References

Check your stackJSON