On December 2, 2026, the Django project released versions 6.1.4, 6.0.11, and 5.2.20 to fix seven security issues. One of them is Django4Shell (CVE-2026-124827), a file-write flaw in GeoDjango that can lead to remote code execution. Mohammed Fathy of Robusta Technology Group reported it and published the details the same day.
Django rates the flaw “high” under its security policy. The Hacker News reports a CVSS score of 9.0, and the researcher’s site calls it critical. The attacker needs a staff account, so the first question is who can reach your admin. If your Django application runs behind Azion, you can narrow that exposure while the upgrade rolls out.
What is Django4Shell?
Django4Shell is a flaw in the way GeoDjango’s RasterField handles a value assigned to it. GeoDjango is Django’s geographic framework (django.contrib.gis), and RasterField stores raster data such as elevation maps or satellite imagery.
A raster can be described as JSON. That description names a driver of the Geospatial Data Abstraction Library (GDAL) and, for drivers that work with files, a name that is a path on the server. When Django turns the description into a raster, GDAL creates the file at that path. An attacker who controls the JSON controls the path, the file name, and the bytes written.
The Django advisory explains why the flaw is reachable by default. RasterField has no form field of its own and falls back to a plain text field. Any model with a RasterField that is registered in the admin, or used in a ModelForm or a writable serializer, accepts the JSON as text.
The researcher’s write-up at django4shell.com describes what happens next:
- A staff user posts a form with a raster definition that sets
"driver": "EHdr"and anamesuch as/app/sitecustomize.py. - Django validates the form. Validation reads the field, which builds the raster and makes GDAL write the file.
- Python imports
sitecustomize.pyat startup. The attacker’s code runs the next time a worker or a management command starts.
The file is written during validation, before the model is saved. A form that fails validation for another reason can still leave the file on disk.
The third fix in the same code
This is the third fix in GeoDjango’s raster handling in four months. According to The Hacker News, CVE-2026-15307 was patched in August 2026, and CVE-2026-87890 followed on October 6 to close a gap that the first patch left. Both patches covered database lookups. Django4Shell uses the assignment path, which neither patch touched.
Who is affected by Django4Shell?
Django lists the main branch and the 6.1, 6.0, and 5.2 series as affected. The researcher demonstrated the flaw on Django 6.1.2, which already included the October fix. Series that Django no longer supports receive no patch.
The researcher lists four conditions for the attack, and all four must be true:
- A model with
RasterField. The project usesdjango.contrib.gisand defines at least one raster field. Geometry fields are not affected. - A form that exposes the field. The Django admin generates one for every registered model unless the project excludes the field.
- GDAL with a file driver. The researcher used EHdr and says it ships in standard GDAL builds.
- A writable path. The process can write to its working directory or to another directory on Python’s import path.
The advisory adds that RasterField is only implemented on PostGIS, so projects on other database backends don’t use the field.
To find the field in a project, search the code for its name:
Most Django projects never use raster fields. Those that do tend to be mapping, government, agriculture, and environmental platforms, according to the researcher. If the search returns nothing in your code and your installed packages, CVE-2026-124827 doesn’t apply to you, and the other six fixes in the release still do.
Has Django4Shell been exploited?
As of December 2, none of the sources we reviewed reported exploitation. The payload format is public on the researcher’s site, so anyone with a staff account on an affected application has what they need. Phished or reused staff credentials are enough to meet the authentication requirement.
What to upgrade first
Upgrade Django to the fixed release of your series:
| Series | Fixed release |
|---|---|
| 6.1 | 6.1.4 |
| 6.0 | 6.0.11 |
| 5.2 | 5.2.20 |
The fix changes two behaviors:
RasterFieldis no longer editable by default, so aModelFormleaves it out unless the project includes it explicitly.- Assigning a dict or a JSON string that names a driver other than the default raises
GDALException. Code that needs another driver wraps the definition inGDALRasterto mark the value as trusted.
Django states that this only limits file writes. Server-side request forgery is still possible when untrusted input reaches a RasterField, so validate the input before you assign it.
The same release fixes a SQL injection in the range and in lookups (CVE-2026-132092), also rated high, and a cache poisoning flaw in Django’s cache middleware (CVE-2026-125673). After you upgrade, clear the caches that the middleware filled, as the advisory instructs. Restart every worker so that no process keeps the old code in memory.
If you can’t upgrade today
Two changes in the application remove the default exposure until the upgrade ships:
- Take the field out of forms. Exclude every
RasterFieldfrom the admin, from eachModelForm, and from writable serializers, or declare the field witheditable=False. This is the default that the fixed releases adopt. - Reduce what the process can write. Run workers as a user that can’t write to the project directory or to
site-packages. A read-only file system for the application code removes the place wheresitecustomize.pywould land.
Review who holds staff accounts as well. Remove the ones nobody uses and require multi-factor authentication for the rest.
How Azion reduces Django4Shell exposure
No control in front of the origin fixes a flaw inside Django. While you upgrade, Azion limits who can reach the forms that accept the payload and filters the payload format.
Restrict who reaches the admin
A Django admin rarely needs to be open to the whole internet. In your firewall, a Rules Engine rule combined with a list from Network Lists denies requests to the admin from any address outside your VPN and office ranges. The rule runs on the Azion Platform, so a denied request never reaches the origin.
This is the body of that rule for the Azion API. Replace the argument of the second criterion with the ID of your list:
The rule works whatever the payload looks like. Adjust the path if your project serves the admin elsewhere, and add the API paths that accept raster data. The Network criterion requires Network Shield on the firewall, which a new firewall has on by default.
A stolen staff password then can’t open the admin from outside the allowed ranges. A request from inside them still passes, which is the reason for the second control.
Filter raster definitions with a function
A raster definition that Django keeps in memory uses the MEM driver, which is the default when the definition names none. A definition that names any other driver in a request is the format the exploit needs. A function on the firewall can read the body and look for it.
This example function runs on Functions. It parses form fields and JSON bodies, finds raster definitions, and flags the ones whose driver isn’t MEM. Create it with the firewall execution environment and instantiate it in your firewall:
The function reads one argument. With { "action": "log" }, or with no argument, it records a warning and lets the request continue. With { "action": "deny" }, it answers 403.
Call the instance from a rule with the Run Function behavior, on the paths that accept forms or API writes. Place that rule after the rule that restricts the admin, because a firewall runs its rules in order.
Review detections before blocking
Start with action set to log. Each detection writes a warning with the request path, which you can review in Real-Time Events. If your application legitimately accepts raster definitions with file drivers, those requests appear here before they are blocked. Change the argument to deny once the events show only what you expect.
What the mitigation doesn’t cover
The two controls leave these cases open:
- A staff user who connects from an allowed address and sends a payload in a form the function doesn’t parse, such as a compressed body.
- A raster definition assigned by code that reads it from a source other than the request, such as a file import or a message queue.
- The server-side request forgery risk that Django says remains for untrusted raster input.
- Traffic that reaches the origin without passing through Azion.
The function also lets a request continue when it fails to read the body. That keeps a parsing error from taking the admin down, and it means an error is a gap. Watch for the inspection failed message in the events.
If the origin accepts direct connections, an attacker who finds its address bypasses every rule described here. Restrict the origin to accept traffic only from Azion.
What Azion customers should do now
- Search your code and installed packages for
RasterField. - Upgrade Django to 6.1.4, 6.0.11, or 5.2.20, restart the workers, and clear the caches filled by Django’s cache middleware.
- If the upgrade has to wait, exclude raster fields from the admin, forms, and serializers.
- In Azion Console, add a Rules Engine rule to your firewall that restricts the admin to the addresses in a network list.
- Instantiate the function in your firewall with
actionset tolog. - Review the events in Real-Time Events, and then change
actiontodeny. - Look for files you didn’t deploy, such as
sitecustomize.pyor.pthfiles, in the project directory and insite-packages.
Upgrade first, filter while you wait
The fix for Django4Shell is a patched Django. Upgrade the origin first, and use the layer in front of it to control who reaches the admin and to see what they send. Our security team is tracking the flaw and will update this post as new information is published.
Need help applying these measures? Talk to a specialist.

