Django maintainers have rolled out patch updates—versions 6.1.4, 6.0.11 and 5.2.20—to address multiple security flaws, including a highly critical vulnerability that allows remote code execution. Identified as CVE-2026-124827 and dubbed “Django4Shell,” this weakness stems from inadequate protection around GeoDjango’s RasterField assignment path. The issue builds on prior vulnerabilities (CVE-2026-87890 and CVE-2026-15307) affecting spatial lookup raster parsing and SSRF vectors.
What the Django4Shell Flaw Means
The CVE-2026-124827 flaw allows an attacker to write arbitrary files and potentially execute remote code without involving database operations or invoking model.save(). By supplying crafted JSON body for raster content and targeting the RasterField, the attacker can control the destination path, file name, and content. Possible attacks include overwriting application source code, placing webshells in static directories, corrupting configs, or inserting .pth files into site-packages—triggering Python to auto-import those files (for example sitecustomize.py) on interpreter startup.
Attack Surface Conditions: How Likely Is It?
This vulnerability requires four conditions to be met. Three of these are enabled by default in typical Django/GeoDjango installations:
- Use of GeoDjango with a model including
RasterField—common in mapping, agriculture, environment, government systems. - RasterField exposed through ModelForms or the default Django admin interface—models are auto-registered unless specifically excluded.
- Standard GDAL builds with the EHdr driver—the driver is included out-of-the-box across major platforms.
- Writable target path, particularly the project root, which is usually on Python’s
sys.pathand writable by the worker process.
A non-default configuration must be employed for all these conditions (except authentication) to prevent the exploit. In many deployments, only “staff-level” credentials are required for an attacker to misuse this weakness.
Other Fixes in Latest Releases
Alongside Django4Shell, the new Django releases correct a SQL injection vulnerability in range lookups (CVE-2026-132092), a cross-site scripting issue in the truncatechars_html filter (CVE-2026-115868), and a cache-poisoning flaw involving dot segments in request paths (CVE-2026-125673).
All users of GeoDjango with RasterField models, default admin settings or ModelForms, and a standard GDAL setup should update immediately to eliminate exposure. If any of these components are in use, assume the vulnerability is exploitable until patched.
Why this matters: Django is a foundation of many mapping, environment, and data-heavy platforms. GeoDjango enables geospatial data functionality in Django, while GDAL underpins raster processing. The RasterField allows models to store raster data—images or grids representing spatial information. When default validation or admin forms automatically accept user-provided raster bytes, the door opens to attackers writing files to disk with high privileges. Previous fixes addressed similar issues—raster parsing flaws and SSRF vectors—but did not close off the RasterField path. Django4Shell is the missing link that restores coverage, but only after updating.
What to watch: Audit models that use RasterField. Review whether ModelForms or admin forms expose them. Ensure that GDAL is built with EHdr and the file system permissions are locked down. Verify staff access controls. Even if the database is secure, the ability to write files can lead to full system compromise.
This vulnerability underscores how default behaviors—auto-generated admin, permissive drivers, writable root paths—can combine into high-risk attack vectors. As geospatial features gain popularity in web applications, these gaps become more dangerous. Developers must treat input validation, filesystem permissions, and dependency configuration as inseparable from application security.