
A seemingly ordinary geospatial data-processing operation could become an entry point for remote code execution. Django developers are dealing with another security issue involving GeoDjango, where a crafted raster definition could force the underlying GDAL library to write files to attacker-controlled locations.
The vulnerability, tracked as CVE-2026-124827, has been dubbed Django4Shell by its discoverer, Mohammed Fathy of Robusta Technology Group.
On December 2, 2026, the Django security team released security updates addressing seven vulnerabilities across its supported release branches. Django4Shell is among the high-severity issues addressed in these releases.
What is Django4Shell?
The vulnerability affects django.contrib.gis.db.models.RasterField, a component of GeoDjango used to handle raster data in Django applications backed by PostGIS.
The underlying problem involves assigning a raster data definition containing a user-controlled name parameter and a non-default GDAL driver.
Under these conditions, GDAL may write a file to an attacker-controlled filesystem location.
Depending on the selected raster driver and the server’s filesystem configuration, this file-write capability could potentially be escalated into remote code execution.
The important distinction is that this is not simply a conventional command-injection vulnerability. It involves the interaction between Django’s form processing, GeoDjango’s raster handling and GDAL’s file-writing functionality.
How does the attack work?
The vulnerability becomes particularly concerning when applications expose RasterField through Django Admin, ModelForms or writable model serializers.
The potential attack sequence begins when an attacker obtains the ability to submit crafted raster data through an exposed application input.
The application processes the supplied raster definition. Because the vulnerable implementation accepts the relevant driver and filename parameters, GDAL can be instructed to write a file to a location controlled by the attacker.
This operation can occur during field processing rather than requiring the attacker to execute a conventional operating-system command.
One demonstrated escalation technique involves writing a malicious sitecustomize.py file into a location included in Python’s module search path.
Python automatically imports sitecustomize during interpreter initialization when the module is available. Consequently, a malicious file placed in the appropriate location could execute code when another Python process starts.
This creates a potential path from a server-side file-write vulnerability to remote code execution under the privileges of the affected application process.
Who is exposed?
This is not a vulnerability affecting every Django installation.
The exposure is primarily associated with applications that use GeoDjango, have models containing RasterField, and expose the affected field through an applicable input mechanism.
Django’s advisory specifically identifies Admin-registered models, ModelForms and writable model serializers.
An attacker needs a suitable route to submit the crafted data. This may involve a staff account or access to an exposed writable API, depending on the application’s configuration.
Applications using ordinary geometry fields are not affected by this particular vulnerability. The RasterField implementation is specific to PostGIS.
Affected and fixed versions
The Django security team has addressed the vulnerability in the following releases.
- Django 6.1: Versions before 6.1.4 are affected. Upgrade to 6.1.4.
- Django 6.0: Versions before 6.0.11 are affected. Upgrade to 6.0.11.
- Django 5.2: Versions before 5.2.20 are affected. Upgrade to 5.2.20.
Earlier unsupported branches, including Django 5.1, 5.0 and 4.2, were not evaluated by the Django team. Organizations running these versions should not assume they are unaffected.
What has Django changed?
The security fix introduces two important changes to RasterField.
First, RasterField now defaults to editable=False. This prevents the field from being automatically included in ModelForms unless explicitly configured.
Second, Django now raises GDALException when a dictionary or JSON raster definition specifies a non-default driver.
Applications that legitimately require other drivers must explicitly use GDALRaster to indicate that the supplied definition is trusted.
However, the Django team also highlights an important limitation: these changes do not eliminate the possibility of server-side request forgery when untrusted input is assigned to RasterField.
Input validation therefore remains essential.
What should security teams do?
Organizations should begin by identifying applications running Django with GeoDjango and PostGIS dependencies.
The review should establish whether any models contain RasterField and whether those fields are exposed through Django Admin, ModelForms or writable serializers.
Patching should be prioritized for exposed applications. Upgrade to the appropriate fixed Django release and redeploy the application.
For environments where immediate patching is not possible, restrict untrusted access to raster-field assignments and remove unnecessary exposure through forms and APIs.
Security teams should also inspect application directories, Python module search paths and site-packages for unexpected Python files, particularly sitecustomize.py and .pth files.
Review application logs and filesystem activity for suspicious file creation and unexpected Python process execution.
Patching alone should not replace an investigation if the application was previously exposed.
Exploitation status
As of December 3, 2026, the sources reviewed do not establish confirmed exploitation in the wild.
However, the public disclosure of the vulnerability and its technical exploitation pathway make it important to address the issue promptly. The availability of security patches also gives attackers an opportunity to study the changes and investigate vulnerable implementations.
The bigger picture
Django4Shell is another reminder that application security cannot be limited to the framework’s core functionality.
A geospatial data-processing component, an underlying third-party library and an exposed application input can combine to create an entirely different attack surface.
For security teams, this is a good reason to revisit how application dependencies are assessed, particularly libraries responsible for processing files, images, documents and geospatial data.
The more important lesson is that a seemingly harmless file-processing operation can have consequences far beyond the application layer.
A file write is not always just a file write. Under the right conditions, it can become the first step towards complete application compromise.


