New: Cycode Offensive Security. Know what’s exploitable. Prove it’s fixed.

Explore the launch

Blog

Django4Shell (CVE-2026-124827): file write in GeoDjango RasterField

5 MIN

Django4Shell (CVE-2026-124827): file write in GeoDjango RasterField

Django4Shell (CVE-2026-124827) is a flaw in GeoDjango’s RasterField that lets a user who can submit a raster value write a file to a path they choose on the server, which, depending on the GDAL driver, can lead to remote code execution. Mohammed Fathy reported it, and Django fixed it on December 2, 2026 in 6.1.4, 6.0.11 and 5.2.20 (Django security releases). The same releases fix CVE-2026-132092, a SQL injection in the range and in lookups.

Key highlights

  • What it is: a raster value with a user-controlled name and a non-default GDAL driver makes GDAL write a file to an attacker-chosen path.
  • Severity: high (Django); CVSS 3.1 8.8 and CVSS 4.0 8.7 (Django Software Foundation).
  • Affected: Django 5.2 before 5.2.20, 6.0 before 6.0.11 and 6.1 before 6.1.4. Django did not evaluate the unsupported 5.1, 5.0 and 4.2 series, which may also be affected.
  • Trigger: a model with a RasterField on PostGIS that takes user input, by default through the admin, a ModelForm or a writable serializer.
  • Fix: Django 5.2.20, 6.0.11 or 6.1.4.
  • Stopgap: none from Django. Until you update, set editable=False on each RasterField (the fix does the same) and do not assign user input to it without validation.
  • Exploitation: Django does not report exploitation. The CVE is not in the CISA KEV catalog (version 2026.11.30).
Shift to AI podcast hosted by Roland Cloutier. Listen nowShift to AI podcast hosted by Roland Cloutier. Listen nowShift to AI podcast hosted by Roland Cloutier. Listen now

Who is exposed

An application is exposed when it runs an affected Django version and has a model that declares django.contrib.gis.db.models.RasterField. RasterField exists only on PostGIS. Geometry fields are not affected. Before the fix, RasterField used the CharField form field, so the admin, ModelForms and writable model serializers accepted a raster definition as text by default. Django’s CVSS score rates the privileges required as low, which usually means a logged-in user.

The fix makes RasterField non-editable by default and rejects a dict or JSON string that names a non-default driver. Django notes that server-side request forgery is still possible when untrusted input is assigned to RasterField, so validate that input after the update.

Fix status

Source Status Builds
Django 6.1 Fixed 6.1.4
Django 6.0 Fixed 6.0.11
Django 5.2 LTS Fixed 5.2.20
Django 5.1, 5.0 and 4.2 No fix planned end of life; not evaluated by Django and may also be affected
Debian No advisory yet
Ubuntu No advisory yet
Red Hat No advisory yet
Alpine No advisory yet
See Cycode in action. Book a demoSee Cycode in action. Book a demoSee Cycode in action. Book a demo

How to check

  1. Find the Django version: python -m django --version in the application’s environment, or pip show django. For a container image: docker run --rm --entrypoint python3 <image> -m django --version (use python if the image has no python3).
  2. Search the code for the field: grep -rn "RasterField" --include=*.py .
  3. For each model with a RasterField, check whether the admin, a ModelForm or a serializer writes to it.

How Cycode helps

Two items on the Threat Intelligence dashboard query the Context Intelligence Graph:

  • Repositories: Python projects whose manifest or lock file resolves Django to an affected version. The count is the number of project and Django version pairs.
  • Container images: scanned images with an affected Django installed as a Python package. A distribution package can also appear under its upstream version; check it against the vendor advisory. The count is the number of images.

Both items list Django 5.2 to 5.2.19, 6.0 to 6.0.10 and 6.1 to 6.1.3, whether or not the code uses RasterField. They do not list 5.1 and older, which Django did not evaluate. Use the grep in step 2 above to find the projects that declare RasterField.

Your complete Post-Mythos toolkit. Learn moreYour complete Post-Mythos toolkit. Learn moreYour complete Post-Mythos toolkit. Learn more

What to do

  1. Update Django to 5.2.20, 6.0.11 or 6.1.4. Upgrade 5.1 and older to 5.2.20 or later and test the upgrade, since it can include breaking changes.
  2. Check raster code after the update: RasterField now defaults to editable=False, and a dict or JSON string with a non-default driver raises GDALException. Admin pages and ModelForms no longer show the field, so check pages that edit raster data before deploying. Add it back only to forms that trusted users use, and wrap trusted raster definitions that need another driver in GDALRaster.
  3. Rebuild container images that install Django with pip and redeploy them. For Django from a distribution package, apply the vendor’s update once it is published.
  4. In projects that use RasterField, validate raster input before assigning it, as Django advises, since request forgery is still possible after the fix.

Sources

See Cycode in actionBook a demo

FAQ

Frequently asked questions

What is Django4Shell?

A file write flaw in GeoDjango's RasterField, tracked as CVE-2026-124827, that can lead to remote code execution depending on the GDAL driver.

Which versions are affected?

Django 5.2 before 5.2.20, 6.0 before 6.0.11 and 6.1 before 6.1.4. Django did not evaluate 5.1, 5.0 and 4.2, which may also be affected.

Am I affected if I do not use GeoDjango rasters?

Not by Django4Shell. Update anyway: the same releases fix the SQL injection CVE-2026-132092.

Does it need a login?

Django's CVSS score rates the privileges required as low, which usually means a logged-in user. In practice it depends on who can use the form, admin page or API that writes to the field.

Is it exploited?

Django does not report exploitation, and the CVE is not in the CISA KEV catalog.

Is there a workaround?

Django does not publish one. Until you update, set editable=False on each RasterField (the fix does the same) and do not assign user input to it without validation.