Threat intel5 min read
Django fixes GeoDjango raster flaw that can lead to code execution
Django 6.1.4, 6.0.11 and 5.2.20 fix seven security issues. The worst, CVE-2026-124827, lets a logged-in user write files on the server through a GeoDjango RasterField.
4Tify Team

Django 6.1.4, 6.0.11 and 5.2.20, released on 2 December 2026, fix seven security issues. The most serious, CVE-2026-124827, lets a logged-in user make GeoDjango write a file of their choosing to a path of their choosing on the server. If that file lands somewhere Python loads code from, it can end in remote code execution.
What happened
The flaw sits in RasterField, the GeoDjango model field that stores raster data in PostGIS. A raster can be assigned as a data definition (a dict or a JSON string) that names a file and a GDAL driver. When the name comes from the user and the driver is not the default one, GDAL writes a file wherever that name points. Django rates the issue High. The CVE record carries a CVSS 3.1 score of 8.8 and a CVSS 4.0 score of 8.7, with low privileges required and no user interaction.
This is the third GeoDjango raster fix since the summer. CVE-2026-15307, patched in August, covered values in spatial lookups that reached GDAL and could write files or trigger outbound requests. CVE-2026-87890, patched in October, closed a request forgery path through raw bytes that the first fix missed. Both fixes covered queries. The new bug is on a different path: assigning a value to the field itself.
Django's advisory does not report any attacks, and the CVE record's CISA enrichment lists exploitation as "none" at the time of writing.
Who is affected
Projects that use django.contrib.gis with a model that has a RasterField and run:
- Django 6.1 before 6.1.4
- Django 6.0 before 6.0.11
- Django 5.2 before 5.2.20
Older series (5.1, 5.0, 4.2) are out of support and were not checked, so treat them as affected. Geometry fields are not affected, and RasterField exists only on PostGIS, so a Django site without GeoDjango rasters is not exposed to this particular bug.
The exposure is wider than it sounds because RasterField falls back to a plain text form field. Until this release, a model with a raster field registered in the Django admin, used in a ModelForm, or exposed through a writable serializer accepted raster definitions from the form with no extra code.
How the attack works
An attacker needs an account that can edit such a model, typically a staff user in the admin. That account could belong to an insider or come from stolen credentials. They submit a raster definition with a chosen file name and a driver that writes files. The server's GDAL build has to include such a driver, and the target directory must be writable by the web server user.
To turn a file write into code execution, the attacker drops a file that Python runs on its own, for example a .pth file in a directory on the import path or a startup customization module in the project directory. The code then runs the next time a worker restarts, reloads or forks, with the privileges of the web server account. From there the attacker has whatever that account can reach, including the application's secrets and database.
The other six fixes
- CVE-2026-132092 (High): SQL injection in the
rangeandinlookups when aliases or key transforms contain percent signs.rangenow requires exactly two values. - CVE-2026-115868 (Moderate): possible cross-site scripting in the
truncatechars_htmlfilter andTruncator.chars(html=True). - CVE-2026-125673 (Low): cache poisoning through
.and..segments in request paths, affectingUpdateCacheMiddlewareandcache_page(). - CVE-2026-119642 and CVE-2026-127929 (Low): staff with view permission could enumerate data through crafted admin changelist query strings.
- CVE-2026-132809 (Low): heap buffer overflow in
OGRGeometry.wkbfor geometries larger than 4 GB.
What to do now
- Upgrade to Django 6.1.4, 6.0.11 or 5.2.20 (
pip install -U "Django==6.1.4"or the matching release for your series). The fixed versions are listed in Django's security release notes. If you are on 5.1 or older, move to a supported series. - Check whether you use
RasterFieldat all: search your models for it and see which admin classes, forms and serializers include it. - After the upgrade,
RasterFieldis no longer editable by default. If a form needs it, include it explicitly and validate the input. Wrapping a definition inGDALRastermarks it as trusted, so only do that for values you control. Django notes that request forgery is still possible with untrusted raster input. - Review who has staff access to models with raster fields and remove accounts that do not need it.
- Look for files the web server user should not have written, especially new
.pthfiles in site-packages and unexpected Python files in the project root. - Clear your cache after upgrading if you use
cache_page()or the cache middleware, because the fix does not invalidate entries already stored.
The details of the main flaw are in the NVD entry for CVE-2026-124827.
Bugs like this one hide in how a model field is wired to forms and serializers, which a dependency version check alone will not show. Our AI-assisted code review traces where user input reaches fields such as RasterField and flags outdated framework pins in the same pass.
