CVE-2021-35042
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.
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
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 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - CVSS 2.0
- 7.5 High
AV: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 Critical
CVSS: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 Critical
CVSS: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 Critical
CVSS: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 Critical
CVSS: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 Critical
CVSS: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 Critical
CVSS: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
| Package | Affected | Fixed |
|---|---|---|
djangoPyPI |
3.2a1 up to 3.2.5 | 3.2.5 |
djangoPyPI |
3.0a1 up to 3.1.13 | 3.1.13 |
py3-djangoAlpine:v3.13 |
before 3.1.13-r0 | 3.1.13-r0 |
py3-djangoAlpine:v3.14 |
before 3.1.13-r0 | 3.1.13-r0 |
py3-djangoAlpine:v3.15 |
before 3.1.13-r0 | 3.1.13-r0 |
py3-djangoAlpine:v3.16 |
before 3.1.13-r0 | 3.1.13-r0 |
py3-djangoAlpine:v3.17 |
before 3.1.13-r0 | 3.1.13-r0 |
py3-djangoAlpine:v3.18 |
before 3.1.13-r0 | 3.1.13-r0 |
py3-djangoAlpine:v3.19 |
before 3.1.13-r0 | 3.1.13-r0 |
py3-djangoAlpine:v3.20 |
before 3.1.13-r0 | 3.1.13-r0 |
Show 16 moreShow less
| Package | Affected | Fixed |
|---|---|---|
py3-djangoAlpine:v3.21 |
before 3.1.13-r0 | 3.1.13-r0 |
py3-djangoAlpine:v3.22 |
before 3.1.13-r0 | 3.1.13-r0 |
py3-djangoAlpine:v3.23 |
before 3.1.13-r0 | 3.1.13-r0 |
py3-djangoAlpine:v3.24 |
before 3.1.13-r0 | 3.1.13-r0 |
djangoBitnami |
3.1.0 up to 3.1.13, 3.2.0 up to 3.2.5 | 3.1.133.2.5 |
djangoPyPI |
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 |
djangoPyPI |
3.0a1 up to 3.1.13, plus listed versions 3.03.0.13.0.103.0.113.0.12 Show 28 moreShow less3.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-djangoMageia:8 From an advisory covering 6 CVEs |
before 3.1.13-1.mga8 | 3.1.13-1.mga8 |
djangoPyPI |
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 less3.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-DjangoopenSUSE:Tumbleweed From an advisory covering 30 CVEs |
before 3.2.7-2.3 | 3.2.7-2.3 |
python-DjangoopenSUSE:Tumbleweed From an advisory covering 30 CVEs |
before 4.2.11-2.1 | 4.2.11-2.1 |
python-Django4openSUSE:Tumbleweed From an advisory covering 51 CVEs |
before 4.2.14-1.1 | 4.2.14-1.1 |
python-Django6openSUSE:Tumbleweed From an advisory covering 70 CVEs |
before 6.0-1.1 | 6.0-1.1 |
python-Django4openSUSE:Tumbleweed From an advisory covering 59 CVEs |
before 4.2.30-4.1 | 4.2.30-4.1 |
python-DjangoopenSUSE:Tumbleweed From an advisory covering 49 CVEs |
before 5.2.16-1.1 | 5.2.16-1.1 |
python-Django5openSUSE: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.
| Source | Link | Date |
|---|---|---|
| PoC in GitHub | YouGina/CVE-2021-35042 | 2021-07-10 |
| PoC in GitHub | mrlihd/CVE-2021-35042 | 2021-09-01 |
| PoC in GitHub | r4vi/CVE-2021-35042 | 2021-09-24 |
| PoC in GitHub | zer0qs/CVE-2021-35042 | 2022-04-25 |
| PoC in GitHub | LUUANHDUC/CVE-2021-35042 | 2023-05-18 |
| PoC in GitHub | vutiendat323/INT14107_CVE-2021-35042 | 2026-04-17 |
History
| Recorded | Changed | Sources |
|---|---|---|
| affected, facts | ||
| affected, aliases, exploits, references | OSV | |
| aliases | EUVD | |
| first indexed | CVE 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
groups.google.com/forum
docs.djangoproject.com/en/3.2/releases/security
openwall.com/lists/oss-security/2021/07/02/2
djangoproject.com/weblog/2021/jul/01/security-releases
security.netapp.com/advisory/ntap-20210805-0008
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/SS6NJTBYWOX6J7G4U3LUOILARJKWPQ5Y
Show 118 moreShow less
nvd.nist.gov/vuln/detail/CVE-2021-35042
github.com/django/django/commit/0bd57a879a0d54920bb9038a732645fb917040e9
github.com/django/django/commit/a34a5f724c5d5adb2109374ba3989ebb7b11f81f
github.com/django/django/commit/dae83a24519d6f284c74414e0b81d64d9b5a0db4
lists.fedoraproject.org/archives/list/[email protected]/message/SS6NJTBYWOX6J7G4U3LUOILARJKWPQ5Y
github.com/advisories/GHSA-xpfp-f569-q3p2
github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2021-109.yaml
security.alpinelinux.org/vuln/CVE-2021-35042
github.com/django/django
advisories.mageia.org/MGASA-2021-0356.html
bugs.mageia.org/show_bug.cgi?id=28802
djangoproject.com/weblog/2021/apr/06/security-releases
djangoproject.com/weblog/2021/may/04/security-releases
djangoproject.com/weblog/2021/may/06/security-releases
djangoproject.com/weblog/2021/jun/02/security-releases
docs.djangoproject.com/en/dev/releases/3.1.8
docs.djangoproject.com/en/dev/releases/3.1.9
docs.djangoproject.com/en/dev/releases/3.1.10
docs.djangoproject.com/en/dev/releases/3.1.11
docs.djangoproject.com/en/dev/releases/3.1.12
docs.djangoproject.com/en/dev/releases/3.1.13
debian.org/lts/security/2021/dla-2622
ubuntu.com/security/notices/USN-4902-1
ubuntu.com/security/notices/USN-4932-1
ubuntu.com/security/notices/USN-4975-1
suse.com/security/cve/CVE-2015-3982
suse.com/security/cve/CVE-2015-5145
suse.com/security/cve/CVE-2015-5963
suse.com/security/cve/CVE-2016-7401
suse.com/security/cve/CVE-2017-12794
suse.com/security/cve/CVE-2017-7233
suse.com/security/cve/CVE-2017-7234
suse.com/security/cve/CVE-2018-16984
suse.com/security/cve/CVE-2018-6188
suse.com/security/cve/CVE-2018-7536
suse.com/security/cve/CVE-2018-7537
suse.com/security/cve/CVE-2019-11358
suse.com/security/cve/CVE-2019-12308
suse.com/security/cve/CVE-2019-12781
suse.com/security/cve/CVE-2019-14232
suse.com/security/cve/CVE-2019-19118
suse.com/security/cve/CVE-2019-19844
suse.com/security/cve/CVE-2019-3498
suse.com/security/cve/CVE-2019-6975
suse.com/security/cve/CVE-2020-13254
suse.com/security/cve/CVE-2020-13596
suse.com/security/cve/CVE-2020-24583
suse.com/security/cve/CVE-2020-24584
suse.com/security/cve/CVE-2020-7471
suse.com/security/cve/CVE-2020-9402
suse.com/security/cve/CVE-2021-31542
suse.com/security/cve/CVE-2021-32052
suse.com/security/cve/CVE-2021-33203
suse.com/security/cve/CVE-2021-33571
suse.com/security/cve/CVE-2021-35042
suse.com/security/cve/CVE-2021-45115
suse.com/security/cve/CVE-2021-45452
suse.com/security/cve/CVE-2022-22818
suse.com/security/cve/CVE-2022-23833
suse.com/security/cve/CVE-2022-28346
suse.com/security/cve/CVE-2022-28347
suse.com/security/cve/CVE-2022-34265
suse.com/security/cve/CVE-2022-36359
suse.com/security/cve/CVE-2022-41323
suse.com/security/cve/CVE-2023-23969
suse.com/security/cve/CVE-2023-24580
suse.com/security/cve/CVE-2023-31047
suse.com/security/cve/CVE-2023-36053
suse.com/security/cve/CVE-2023-41164
suse.com/security/cve/CVE-2023-43665
suse.com/security/cve/CVE-2024-24680
suse.com/security/cve/CVE-2024-27351
suse.com/security/cve/CVE-2024-38875
suse.com/security/cve/CVE-2024-39329
suse.com/security/cve/CVE-2024-39330
suse.com/security/cve/CVE-2024-39614
suse.com/security/cve/CVE-2024-41989
suse.com/security/cve/CVE-2024-41990
suse.com/security/cve/CVE-2024-41991
suse.com/security/cve/CVE-2024-42005
suse.com/security/cve/CVE-2024-45230
suse.com/security/cve/CVE-2024-45231
suse.com/security/cve/CVE-2024-53907
suse.com/security/cve/CVE-2024-53908
suse.com/security/cve/CVE-2024-56374
suse.com/security/cve/CVE-2025-13372
suse.com/security/cve/CVE-2025-26699
suse.com/security/cve/CVE-2025-27556
suse.com/security/cve/CVE-2025-32873
suse.com/security/cve/CVE-2025-48432
suse.com/security/cve/CVE-2025-57833
suse.com/security/cve/CVE-2025-59681
suse.com/security/cve/CVE-2025-59682
suse.com/security/cve/CVE-2025-64459
suse.com/security/cve/CVE-2025-64460
suse.com/security/cve/CVE-2026-48588
suse.com/security/cve/CVE-2026-53877
suse.com/security/cve/CVE-2026-53878
suse.com/security/cve/CVE-2025-13473
suse.com/security/cve/CVE-2025-14550
suse.com/security/cve/CVE-2026-1207
suse.com/security/cve/CVE-2026-1285
suse.com/security/cve/CVE-2026-1287
suse.com/security/cve/CVE-2026-1312
suse.com/security/cve/CVE-2026-25674
suse.com/security/cve/CVE-2026-33033
suse.com/security/cve/CVE-2026-33034
suse.com/security/cve/CVE-2026-35192
suse.com/security/cve/CVE-2026-35193
suse.com/security/cve/CVE-2026-3902
suse.com/security/cve/CVE-2026-4277
suse.com/security/cve/CVE-2026-4292
suse.com/security/cve/CVE-2026-48587
suse.com/security/cve/CVE-2026-5766
suse.com/security/cve/CVE-2026-6873
suse.com/security/cve/CVE-2026-6907
suse.com/security/cve/CVE-2026-7666
suse.com/security/cve/CVE-2026-8404