Refreshing now

Django4Shell: update to 6.1.4, 6.0.11 or 5.2.20 to fix seven flaws

The Django project patched a file write bug that can lead to remote code execution, plus a SQL injection. No attacks have been reported, but the flaw is a repeat of two earlier incomplete fixes.

Django Software Foundation logo
Photo: Django Software Foundation

The Django project released versions 6.1.4, 6.0.11 and 5.2.20 on December 2 to close seven security flaws, and the one drawing attention is nicknamed Django4Shell. It lets an attacker make the server write a file wherever they choose, and depending on the raster driver in use that can end in remote code execution. Neither Django nor The Hacker News reports attacks in the wild, so this is a patch now, not an emergency in progress.

Who is affected

Only sites that use GeoDjango with a RasterField, which exists only on PostGIS databases. Django's advisory explains that the field falls back to a plain text form field, so it can be reached by default when the model is registered in the admin, used in a ModelForm or exposed through a writable serializer. The attacker has to control the name value of a raster definition and pick a non-default GDAL driver. Geometry fields are not affected.

The Hacker News gives the flaw a severity of 9.0 and credits the nickname to the researcher who reported it, Mohammed Fathy. It is the third attempt at the same hole: the new CVE-2026-124827 follows an incomplete fix for CVE-2026-87890, which itself followed an incomplete patch for CVE-2026-15307.

The seven fixes

CVE Problem Django's severity
CVE-2026-124827 File write through RasterField High
CVE-2026-132092 SQL injection in the range and in lookups High
CVE-2026-115868 Cross-site scripting in truncatechars_html Moderate
CVE-2026-125673 Cache poisoning through dot segments in URLs Low
CVE-2026-119642 Admin leak through the pk alias Low
CVE-2026-127929 Admin leak through reverse relations Low
CVE-2026-132809 Buffer overflow in OGRGeometry.wkb for geometries over 4 GB Low

The SQL injection matters to far more sites than the raster bug. It applies when queries use aliases or key transforms that contain percent signs. The range variant needs more than two values on the right side. The in variant needs a bilateral transform. The fix now requires exactly two values for range.

What the patch changes

RasterField is now excluded from model forms by default, and passing a non-default driver in a dictionary or JSON string raises an error. If you really need another driver with trusted data, wrap the definition in GDALRaster. Django warns that the fix stops file writes but not server side request forgery, so untrusted input still needs validation before it touches the field.

What to do

  1. Upgrade to 6.1.4, 6.0.11 or 5.2.20, depending on your series. The fixes are published for Django 6.1, 6.0 and 5.2, so older series should move to one of them.
  2. After upgrading, clear any cache that may hold responses saved under the wrong URL. The patch does not purge them.
  3. If you use RasterField, check every path where a user can influence it, including the admin and your APIs.
  4. Search your code for percent signs in column aliases or key transforms. They have been deprecated since Django 6.0.
  5. Report new problems privately to [email protected], not on the public tracker.

Teams that use Django through a hosting provider or a managed platform should ask when their image will carry the patched version. Anyone who runs Django in Mexico for a bank, a store or a government service should treat the SQL injection fix as part of the same update window.

Sources: Django project: Security releases (December 2, 2026), The Hacker News: New Django4Shell vulnerability enables Django RCE via GeoDjango form validation (December 2026)

More from Cybersecurity