Skip to content
OpenAdvisories
Critical · 9.8 Public exploit CVE-2021-35042 BIT-django-2021-35042EUVD-2021-0061GHSA-xpfp-f569-q3p2PYSEC-2021-109

SQL Injection in Django

Published Jul 2, 2021 · Updated Aug 4, 2024 · Assigned by mitre

Description

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.

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
openSUSE Tumbleweed python-Django 3.2.7-2.3 openSUSE-SU-2026:11248-1, openSUSE-SU-2024:13887-1, openSUSE-SU-2024:11205-1
openSUSE Tumbleweed python-Django4 4.2.14-1.1 openSUSE-SU-2026:11235-1, openSUSE-SU-2024:14208-1
openSUSE Tumbleweed python-Django5 5.2.16-1.1 openSUSE-SU-2026:11270-1
openSUSE Tumbleweed python-Django6 6.0-1.1 openSUSE-SU-2026:10005-1
ReleasePackageFixed inAdvisory
Alpine v3.24 py3-django 3.1.13-r0 —
Alpine v3.23 py3-django 3.1.13-r0 —
Alpine v3.22 py3-django 3.1.13-r0 —
Alpine v3.21 py3-django 3.1.13-r0 —
Alpine v3.20 py3-django 3.1.13-r0 —
Show 7 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Alpine v3.19 py3-django 3.1.13-r0 —
Alpine v3.18 py3-django 3.1.13-r0 —
Alpine v3.17 py3-django 3.1.13-r0 —
Alpine v3.16 py3-django 3.1.13-r0 —
Alpine v3.15 py3-django 3.1.13-r0 —
Alpine v3.14 py3-django 3.1.13-r0 —
Alpine v3.13 py3-django 3.1.13-r0 —

Public exploits

Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.

Third-party code, not reviewed by us. Public PoCs are sometimes fake or contain malware. Read the code first and run it only in an isolated lab, against systems you are authorised to test.

GitHub 6 repositories

Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.

Affected packages

EcosystemPackageAffectedFixedRecord
PyPI django >= 3.2a1, < 3.2.5 3.2.5 GHSA-xpfp-f569-q3p2
PyPI django >= 3.0a1, < 3.1.13 3.1.13 GHSA-xpfp-f569-q3p2
PyPI django >= 3.1, < 3.1.13 · >= 3.2, < 3.2.5 3.1.13, 3.2.5 PYSEC-2021-109

Advisories 7

References