Django fixes seven flaws, including a SQL injection and a third GeoDjango file-write patch
Django shipped 6.1.4, 6.0.11 and 5.2.20 on 2 December 2026, fixing seven flaws led by a 9.8 SQL injection and an 8.8 GeoDjango file write. Upgrade now.

Affects
- Django
Tracked as
CVE-2026-132092Django · CVSS 9.8CVE-2026-124827Django, GeoDjango RasterField · CVSS 8.8CVE-2026-115868Django · CVSS 6.1CVE-2026-132809Django, GeoDjango OGRGeometry · CVSS 5.3CVE-2026-125673Django · CVSS 3.7CVE-2026-119642Django admin · CVSS 2.7CVE-2026-127929Django admin · CVSS 2.7
Django has shipped three security releases at once — 6.1.4, 6.0.11 and 5.2.20 — closing seven flaws the project disclosed on 2 December 2026. Two are rated high, and one of them is the third patch in four months for the same GeoDjango code path. Anyone running Django should upgrade in the next deployment; projects that use GeoDjango raster fields should treat it as urgent.
- 7Flaws fixed
- 9.8Highest NVD score
- 2Rated high by Django
- 3Supported series patched
The SQL injection: CVE-2026-132092, scored 9.8
The most severe flaw sits in the ORM itself. Django’s range and in lookups could be turned into SQL injection when a query involved aliases or key transforms containing percent signs. The range case needed more than two values on the right-hand side; the in case needed a two-sided transform. Both conditions are narrow, but the result of hitting them is database code running with the application’s own privileges.
The fix tightens the range lookup so it accepts exactly two right-hand-side values. Django notes that percent signs in column aliases and key transforms were already deprecated in Django 6.0 and are scheduled for removal in Django 2028 — a sign that this corner of the query builder is being closed for good.
Django4Shell: CVE-2026-124827, scored 8.8
The second high-severity flaw is the one researchers have dubbed Django4Shell. It lives in GeoDjango, the mapping extension that ships with Django, in the RasterField model field used to store raster images in PostGIS.
Assigning a raster definition to a RasterField with a user-controlled name and a non-default GDAL driver could make GDAL write a file to a location chosen by the attacker. Depending on the driver, that write can become code execution on the server. The researcher’s write-up describes the chain ending with a startup file dropped where Python reads it at launch.
What makes this flaw dangerous in practice is how easily it is reached. RasterField falls back to an ordinary text form field, so the Django admin, model forms and writable serializers all accept a raster definition as text by default. The file is created while Django validates the form, before anything is saved. Geometry fields such as PointField are not affected, and RasterField only exists on PostGIS — so most Django projects are untouched, but GeoDjango projects with raster fields are exposed.
The fix changes RasterField in two ways: it now defaults to not editable, so it no longer appears in model forms unless explicitly included, and assigning a dictionary or JSON string that names a non-default driver now raises an error. Trusted raster values should be wrapped in GDALRaster to show they are intentional. Django also warns that request forgery is still possible if untrusted input is assigned to the field, so raster input needs validation before it reaches the model.
The third fix for the same GDAL path
4 Aug 2026
CVE-2026-15307 fixed in spatial lookups
Django stopped spatial lookups passing raster definitions to GDAL, but left model field assignment open.
Oct 2026
CVE-2026-87890 patched the same area
A second fix for the raster code path, which also proved incomplete.
2 Dec 2026
CVE-2026-124827 closes the assignment path
The December release finally covers the route the August fix deliberately left open.
The other five flaws
The remaining five are lower severity, but two deserve attention from anyone running the affected features:
- CVE-2026-115868 (6.1): a cross-site scripting flaw in the
truncatechars_htmltemplate filter and theTruncator.chars()method with HTML enabled. It triggers when input text happens to be exactly the truncation length and the result is rendered inside an HTML attribute. - CVE-2026-125673 (3.7): a cache poisoning flaw. The cache middleware and the
cache_pagedecorator relied on a URL builder that stripped.and..segments from request paths, so cached responses could be served for the wrong addresses. After upgrading, clear any caches that may hold poisoned entries — the fix does not invalidate them. - CVE-2026-132809 (5.3): a heap buffer overflow in
OGRGeometry.wkbfor geometries larger than 4GB on 64-bit systems, which could crash the process. Thehexandgeosproperties and pickling were affected too. - CVE-2026-119642 (2.7): the admin changelist let staff users with view permission enumerate data from models whose custom
OneToOneFieldis the primary key, by putting thepkalias in the query string. Models using multi-table inheritance were affected by default. - CVE-2026-127929 (2.7): a similar admin changelist leak through reverse relations, a variant of a flaw first fixed in 2010 that came back in Django 5.0.3.
The seven flaws by NVD score
The numbers
| CVSS | NVD score |
|---|---|
| CVE-2026-132092 | 9.8 |
| CVE-2026-124827 | 8.8 |
| CVE-2026-115868 | 6.1 |
| CVE-2026-132809 | 5.3 |
| CVE-2026-125673 | 3.7 |
| CVE-2026-119642 | 2.7 |
| CVE-2026-127929 | 2.7 |
How to update
Update Django
Check your version
Run
python -m django --versionto see which supported series you are on: 6.1, 6.0 or 5.2.Install the patched release
Upgrade to 6.1.4, 6.0.11 or 5.2.20 to match your series, for example
pip install -U "Django==6.1.4", then deploy as usual.Clear affected caches
If you use Django’s cache middleware or cache_page, clear caches that may hold poisoned entries from CVE-2026-125673.
Review GeoDjango forms
If you use RasterField, check which forms and serializers accept raster definitions, and wrap trusted values in GDALRaster.
The patches are also applied to Django’s main branch. Older unsupported series such as 5.1, 5.0 and 4.2 were not evaluated and may still be affected; the only supported route is to move to a patched release.
Sources
- Django security releases issued: 6.1.4, 6.0.11, and 5.2.20Django
- Django4Shell (CVE-2026-124827): GeoDjango RCE FlawOrca Security


