SQL injection in Django
Published 11 Feb 2020 · Updated 21 Feb 2025
Is your project on an affected django?
Look after several Python apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected packages
- Affected
- <1.11.28
- Fixed in
- 1.11.28
pip install 'django>=1.11.28'- Affected
- >=2.0 <2.2.10
- Fixed in
- 2.2.10
pip install 'django>=2.2.10'- Affected
- >=3.0 <3.0.3
- Fixed in
- 3.0.3
pip install 'django>=3.0.3'Details
Django 1.11 before 1.11.28, 2.2 before 2.2.10, and 3.0 before 3.0.3 allows SQL Injection if untrusted data is used as a StringAgg delimiter (e.g., in Django applications that offer downloads of data as a series of rows with a user-specified column delimiter). By passing a suitably crafted delimiter to a contrib.postgres.aggregates.StringAgg instance, it was possible to break escaping and inject malicious SQL.
Is GHSA-hmr4-m2h5-33qx in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected django, and gives you the command that fixes it.
More advisories for django
- HighCVE-2026-15307Django GeoDjango spatial lookups allow file writes and outbound requests through GDAL raster parsing · 4 Aug 2026
- MediumCVE-2026-15830Django GeoDjango vulnerable to denial of service through deeply nested geometry collections · 4 Aug 2026
- MediumCVE-2026-53878Django: DomainNameValidator permits newline characters that may enable HTTP header injection · 7 Jul 2026
- MediumCVE-2026-53877 Django: GDALRaster may over-read heap memory when constructed from bytes · 7 Jul 2026
- LowCVE-2026-48588Django: cache middleware may expose private responses when unrelated request cookies are present · 7 Jul 2026
- LowCVE-2026-8404Django: UpdateCacheMiddleware may disclose cached responses due to case-sensitive Cache-Control handling · 3 Jun 2026
References
- Advisorynvd.nist.gov/vuln/detail/CVE-2020-7471
- Linkgithub.com/django/django/commit/001b0634cd309e372edb6d7d95d083d02b8e37bd
- Linkgithub.com/django/django/commit/505826b469b16ab36693360da9e11fd13213421b
- Linkgithub.com/django/django/commit/c67a368c16e4680b324b4f385398d638db4d8147
- Linkgithub.com/django/django/commit/eb31d845323618d688ad429479c6dda973056136
- Linkwww.openwall.com/lists/oss-security/2020/02/03/1
- Linkwww.djangoproject.com/weblog/2020/feb/03/security-releases
- Linkwww.debian.org/security/2020/dsa-4629
- Linkusn.ubuntu.com/4264-1
- Linksecurity.netapp.com/advisory/ntap-20200221-0006
- Linksecurity.gentoo.org/glsa/202004-17
- Linkseclists.org/bugtraq/2020/Feb/30
- Linklists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/4A2AP4T7RKPBCLTI2NNQG3T6MINDUUMZ
- Linkgroups.google.com/forum/#!topic/django-announce/X45S86X5bZI
- Linkgithub.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2020-35.yaml
- Packagegithub.com/django/django
- Advisorygithub.com/advisories/GHSA-hmr4-m2h5-33qx
- Linkdocs.djangoproject.com/en/3.0/releases/security
- Linkwww.openwall.com/lists/oss-security/2020/02/03/1
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.