Django shipped a security release on December 2, 2026 that fixes a flaw nicknamed Django4Shell. If your team runs Django with geospatial features, this one deserves attention today. Here is what the bug does, who is exposed, and how to close the gap before attackers find it.
What Is the Django4Shell Vulnerability?
Django4Shell is tracked as CVE-2026-124827. It affects GeoDjango’s RasterField, while Django’s geometry fields are not affected. GeoDjango passes untrusted raster definitions to GDAL, and under certain conditions GDAL can write a file to an unintended location on the server.
Reports differ on severity. The Hacker News lists a CVSS score of 9.0 (critical), while Cybersecurity News calls it “high-severity” without giving a score. Either way, treat it as urgent.
The bug is also a repeat offender. It is an incomplete fix for CVE-2026-87890 from October 2026, which was itself an incomplete patch for CVE-2026-15307 from August 2026. The earlier protections did not cover the RasterField assignment path.
How the Attack Works
Through a crafted JSON raster body, an attacker can control the target path, file content, and filename. That turns an ordinary data field into a file-write primitive.
The researcher who analyzed the flaw describes where this can lead: overwriting application source, dropping web shells, or writing sitecustomize.py or .pth files so code runs at interpreter startup with the web server user’s privileges. From that foothold, an attacker could read secrets and environment variables, modify data, and pivot into the host or network.
There is a caveat. Code execution depends on the available raster drivers and the Django process’s filesystem permissions, and one report does not confirm that it is possible. Plan for the worst case anyway, since the file write alone is dangerous.
Who Is at Risk?
Exploitation needs four conditions, and the researcher says three are met by default. Check each one:
- django.contrib.gis is enabled with a model that uses RasterField
- RasterField is exposed through a ModelForm or the default admin
- GDAL is present with the EHdr driver, which is near-universal
- The target path is writable, such as the project root on sys.path
Authentication matters, but it is a low bar. In the standard admin, an attacker needs a staff account with add or change permission on the affected model, not superuser access. A public form or API that accepts unvalidated raster definitions could expose the flaw without any login. The field is supported only on PostGIS.
As for real-world attacks, no confirmed exploitation had been reported as of December 2. That window can close fast once technical details circulate.
How to Fix It
Patching is the main fix, and a few follow-up steps make it stick:
- Upgrade to Django 6.1.4, 6.0.11, or 5.2.20.
- If you cannot patch right away, temporarily disable raster submissions from untrusted users.
- Validate raster input before it reaches the field.
- Rebuild container images, redeploy, and verify the fix is live.
- If an affected form or API was exposed, review logs for unexpected file changes, new processes, and unusual outbound connections.
Know what the patch changes. Upgraded Django no longer includes RasterField in auto-generated model forms unless you add it explicitly, and it rejects dictionary or JSON raster definitions that name a non-default driver. If your app relied on the old behavior, test your forms after upgrading. Also note that server-side request forgery remains possible, since the fix does not eliminate it.
Other Fixes in the Same Release
Even if you never touch GeoDjango, this update is worth applying. It also fixes:
- A SQL injection in range and in lookups (CVE-2026-132092)
- Potential XSS in the truncatechars_html template filter (CVE-2026-115868)
- Cache poisoning via dot segments in request paths (CVE-2026-125673)
The cache fix does not remove responses that are already cached, so clear any potentially affected caches after upgrading.
A Quick Checklist for Your Team
If you want a short plan to hand to your developers or DevOps team, work through these steps in order:
- Search your codebase for django.contrib.gis and RasterField to find out whether you are exposed.
- Check which forms, admin pages, and API endpoints accept raster data, and who can reach them.
- Upgrade to the patched release on your branch and redeploy.
- Test every form that handles raster data, since the patch changes default behavior.
- Clear caches that may hold poisoned responses.
- Review logs from the exposed period for anything unusual.
Why Repeated Incomplete Fixes Matter
This is the third patch in a chain that started in August 2026. Each earlier fix closed one route into the same weakness without covering the RasterField assignment path. That is a useful reminder to retest after every security update, and to limit what the Django process can write to on disk. Tight filesystem permissions will not fix the bug, but they can reduce the damage if a similar flaw appears again.
FAQs
Is Django4Shell being exploited in the wild?
Not as of the December 2 reports. Neither The Hacker News nor Cybersecurity News reported confirmed exploitation. Patch before that changes.
Which Django versions contain the fix?
Django 6.1.4, 6.0.11, and 5.2.20. The articles do not list the affected versions, so move to a patched release on your branch.
Am I affected if I don’t use GeoDjango?
This specific flaw requires django.contrib.gis with a RasterField model. Apps without it are not exposed to Django4Shell, but you should still upgrade to get the other security fixes.
