Protect.Computer
NEWS

Django Patches 'Django4Shell' File-Write RCE in GeoDjango

· 2 min read · Got hacked
Django Patches 'Django4Shell' File-Write RCE in GeoDjango

The Django project issued security releases on December 2: Django 6.1.4, 6.0.11 and 5.2.20, which fix seven vulnerabilities. The most serious for code execution is CVE-2026-124827, nicknamed “Django4shell” by researcher Fathy, who reported it. According to the Django advisory, assigning a raster definition to a GeoDjango RasterField with a user-controlled name and a non-default driver could make GDAL write a file to an attacker-chosen location, which “depending on the raster driver” could enable remote code execution. Django rates it “high” under its own policy; The Hacker News gives it a CVSS score of 9.0.

Django says the flaw was reachable by default on models with a RasterField registered in the admin or used through a ModelForm or writable model serializer, because the field falls back to a plain text form field. The Hacker News reports that it is an incomplete fix for CVE-2026-87890 (a server-side request forgery bug fixed in October), which was itself an incomplete fix for CVE-2026-15307 from August. Fathy told The Hacker News the attacker controls the target path, file content and filename through a crafted JSON raster body, and that dropping a sitecustomize.py file where Python imports it would run the payload the next time a worker restarts or a subprocess starts. Fathy also said the main requirement is staff-level authentication, and that an application using RasterField with admin access and a default GDAL build “should consider themselves exposed until patched”. Django’s advisory does not state the staff-login requirement; it says the field is only implemented on PostGIS and that geometry fields were not affected.

The same releases fix a potential SQL injection in the range and in lookups (CVE-2026-132092, “high” per Django, requiring column aliases or key transforms containing percent signs), a potential cross-site scripting bug in the truncatechars_html filter (CVE-2026-115868), cache poisoning through dot segments in request paths (CVE-2026-125673), two low-severity admin changelist information leaks (CVE-2026-119642 and CVE-2026-127929) and a heap buffer overflow in OGRGeometry.wkb (CVE-2026-132809).

How to check if you’re affected

Affected versions are the supported Django branches the advisory lists (6.1, 6.0 and 5.2, plus the main branch), meaning releases before 6.1.4, 6.0.11 and 5.2.20. The advisory does not say how older, unsupported releases are affected.

  • Check your installed Django version; the fixed releases are 6.1.4, 6.0.11 and 5.2.20. (Checking the version, for example with pip show django, is our suggestion rather than something the advisory says.)
  • For CVE-2026-124827, the exposure depends on using GeoDjango’s RasterField. After the patch, RasterField is no longer editable by default, so it drops out of a ModelForm unless you include it explicitly, and assigning a dict or JSON string that names a non-default driver now raises GDALException. To use another driver, Django says to wrap the definition in GDALRaster to mark it as trusted.
  • Django warns that server-side request forgery is still possible if untrusted input reaches a RasterField, and points to its raster security considerations for validation.
  • If you use cache_page() or UpdateCacheMiddleware, Django says existing cached responses are not invalidated by the fix, so clear any potentially affected caches after upgrading.
  • The SQL injection fix makes the range lookup require exactly two right-hand values; Django notes that percent signs in column aliases and key transforms were deprecated in Django 6.0.

Sources

Related reading