Every CVE Search/ Get API key

CVE-2021-35042

SQL Injection in Django

9.8 CriticalPublic exploitFix available

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.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
Low
Privileges needed
None
User interaction
None

What an attacker can affect

Confidentiality
High
Integrity
High
Availability
High

Exploit likelihood

44.4%Up 43.3 points since Jul 3, 2021
90%50%10%1%

What each source reports

NVD Score used 9.8

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.

Record
CVE-2021-35042
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS 2.0
7.5 HighAV:N/AC:L/Au:N/C:P/I:P/A:P
Weakness
CWE-89
Updated
2026-11-02
CVE List No score

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.

Record
CVE-2021-35042
Updated
2026-11-02
EUVDEUVD-2021-0061 No score

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.

Record
EUVD-2021-0061
Updated
2026-11-03
GitHub AdvisoriesGHSA-xpfp-f569-q3p2 9.3

SQL Injection in Django

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.

Record
GHSA-xpfp-f569-q3p2
CVSS 4.0
9.3 CriticalCVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Weakness
CWE-89
Updated
2026-11-02
OSVALPINE-CVE-2021-35042 9.8

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.

Record
ALPINE-CVE-2021-35042
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-03
OSV 9.8

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.

Record
CVE-2021-35042
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
Show 11 moreShow less
OSVGHSA-xpfp-f569-q3p2 9.3

SQL Injection in Django

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.

Record
GHSA-xpfp-f569-q3p2
CVSS 4.0
9.3 CriticalCVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Weakness
CWE-89
Updated
2026-11-02
OSVBIT-django-2021-35042 No score

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.

Record
BIT-django-2021-35042
Updated
2026-11-02
OSVMGASA-2021-0356 No score

Updated python-django package fixes security vulnerabilities

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. Built-in upload handlers were not affected by this vulnerability (CVE-2021-28658).

In Django 2.2 before 2.2.21, 3.1 before 3.1.9, and 3.2 before 3.2.1, MultiPartParser, UploadedFile, and FieldFile allowed directory traversal via uploaded files with suitably crafted file names (CVE-2021-31542).

In Django 2.2 before 2.2.22, 3.1 before 3.1.10, and 3.2 before 3.2.2 (with Python 3.9.5+), URLValidator does not prohibit newlines and tabs (unless the URLField form field is used). If an application uses values with newlines in an HTTP response, header injection can occur. Django itself is unaffected because HttpResponse prohibits newlines in HTTP headers (CVE-2021-32052).

Django before 2.2.24, 3.x before 3.1.12, and 3.2.x before 3.2.4 has a potential directory traversal via django.contrib.admindocs. Staff members could use the TemplateDetailView view to check the existence of arbitrary files. Additionally, if (and only if) the default admindocs templates have been customized by application developers to also show file contents, then not only the existence but also the file contents would have been exposed. In other words, there is directory traversal outside of the template root directories (CVE-2021-33203).

In Django 2.2 before 2.2.24, 3.x before 3.1.12, and 3.2 before 3.2.4, URLValidator, validate_ipv4_address, and validate_ipv46_address do not prohibit leading zero characters in octal literals. This may allow a bypass of access control that is based on IP addresses. (validate_ipv4_address and validate_ipv46_address are unaffected with Python 3.9.5+..) (CVE-2021-33571).

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 (CVE-2021-35042).

python-django package is updated to 3.1.13 version to fix these security issues among other upstream bugfixes, see upstream release notes.

Record
MGASA-2021-0356
Updated
2026-11-02
OSVopenSUSE-SU-2024:11205-1 No score

python36-Django-3.2.7-2.3 on GA media

These are all security issues fixed in the python36-Django-3.2.7-2.3 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2024:11205-1
Updated
2026-11-02
OSVopenSUSE-SU-2024:13887-1 No score

python310-Django-4.2.11-2.1 on GA media

These are all security issues fixed in the python310-Django-4.2.11-2.1 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2024:13887-1
Updated
2026-11-02
OSVopenSUSE-SU-2024:14208-1 No score

python310-Django4-4.2.14-1.1 on GA media

These are all security issues fixed in the python310-Django4-4.2.14-1.1 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2024:14208-1
Updated
2026-11-02
OSVopenSUSE-SU-2026:10005-1 No score

python312-Django6-6.0-1.1 on GA media

These are all security issues fixed in the python312-Django6-6.0-1.1 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2026:10005-1
Updated
2026-11-02
OSVopenSUSE-SU-2026:11235-1 No score

python313-Django4-4.2.30-4.1 on GA media

These are all security issues fixed in the python313-Django4-4.2.30-4.1 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2026:11235-1
Updated
2026-11-02
OSVopenSUSE-SU-2026:11248-1 No score

python313-Django-5.2.16-1.1 on GA media

These are all security issues fixed in the python313-Django-5.2.16-1.1 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2026:11248-1
Updated
2026-11-02
OSVopenSUSE-SU-2026:11270-1 No score

python313-Django5-5.2.16-1.1 on GA media

These are all security issues fixed in the python313-Django5-5.2.16-1.1 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2026:11270-1
Updated
2026-11-02
OSVPYSEC-2021-109 No score

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.

Record
PYSEC-2021-109
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
django
PyPI
3.2a1 up to 3.2.5
3.2.5
django
PyPI
3.0a1 up to 3.1.13
3.1.13
py3-django
Alpine:v3.13
before 3.1.13-r0
3.1.13-r0
py3-django
Alpine:v3.14
before 3.1.13-r0
3.1.13-r0
py3-django
Alpine:v3.15
before 3.1.13-r0
3.1.13-r0
py3-django
Alpine:v3.16
before 3.1.13-r0
3.1.13-r0
py3-django
Alpine:v3.17
before 3.1.13-r0
3.1.13-r0
py3-django
Alpine:v3.18
before 3.1.13-r0
3.1.13-r0
py3-django
Alpine:v3.19
before 3.1.13-r0
3.1.13-r0
py3-django
Alpine:v3.20
before 3.1.13-r0
3.1.13-r0
Show 16 moreShow less
Affected packages
PackageAffectedFixed
py3-django
Alpine:v3.21
before 3.1.13-r0
3.1.13-r0
py3-django
Alpine:v3.22
before 3.1.13-r0
3.1.13-r0
py3-django
Alpine:v3.23
before 3.1.13-r0
3.1.13-r0
py3-django
Alpine:v3.24
before 3.1.13-r0
3.1.13-r0
django
Bitnami
3.1.0 up to 3.1.13, 3.2.0 up to 3.2.5
3.1.133.2.5
django
PyPI
3.2a1 up to 3.2.5, plus listed versions
3.23.2.13.2.23.2.33.2.43.2b13.2rc1
3.2.5
django
PyPI
3.0a1 up to 3.1.13, plus listed versions
3.03.0.13.0.103.0.113.0.12
Show 28 moreShow less
3.0.133.0.143.0.23.0.33.0.43.0.53.0.63.0.73.0.83.0.93.0b13.0rc13.13.1.13.1.103.1.113.1.123.1.23.1.33.1.43.1.53.1.63.1.73.1.83.1.93.1a13.1b13.1rc1
3.1.13
python-django
Mageia:8
From an advisory covering 6 CVEs
before 3.1.13-1.mga8
3.1.13-1.mga8
django
PyPI
3.1 up to 3.1.13, 3.2 up to 3.2.5, plus listed versions
3.1.13.1.103.1.113.1.123.1.2
Show 11 moreShow less
3.1.33.1.43.1.53.1.63.1.73.1.83.1.93.2.13.2.23.2.33.2.4
3.1.133.2.5
python-Django
openSUSE:Tumbleweed
From an advisory covering 30 CVEs
before 3.2.7-2.3
3.2.7-2.3
python-Django
openSUSE:Tumbleweed
From an advisory covering 30 CVEs
before 4.2.11-2.1
4.2.11-2.1
python-Django4
openSUSE:Tumbleweed
From an advisory covering 51 CVEs
before 4.2.14-1.1
4.2.14-1.1
python-Django6
openSUSE:Tumbleweed
From an advisory covering 70 CVEs
before 6.0-1.1
6.0-1.1
python-Django4
openSUSE:Tumbleweed
From an advisory covering 59 CVEs
before 4.2.30-4.1
4.2.30-4.1
python-Django
openSUSE:Tumbleweed
From an advisory covering 49 CVEs
before 5.2.16-1.1
5.2.16-1.1
python-Django5
openSUSE:Tumbleweed
From an advisory covering 93 CVEs
before 5.2.16-1.1
5.2.16-1.1

Public exploits

Links only. Every CVE stores no exploit code.

Public exploits
SourceLinkDate
PoC in GitHubYouGina/CVE-2021-350422021-07-10
PoC in GitHubmrlihd/CVE-2021-350422021-09-01
PoC in GitHubr4vi/CVE-2021-350422021-09-24
PoC in GitHubzer0qs/CVE-2021-350422022-04-25
PoC in GitHubLUUANHDUC/CVE-2021-350422023-05-18
PoC in GitHubvutiendat323/INT14107_CVE-2021-350422026-04-17

History

History
RecordedChangedSources
affected, facts
affected, aliases, exploits, referencesOSV
aliasesEUVD
first indexedCVE List, GitHub Advisories, NVD, OSV, PoC in GitHub

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2021-35042 is a critical vulnerability (CVSS 9.8) in Djangoproject Django, published July 2, 2021. Public exploit code exists. EPSS puts the chance of exploitation in the next 30 days at 44.4%, the 98th percentile. Fixed in django 3.2.5.

References

Show 118 moreShow less
MoveEnter Open