Django maintainers released versions 6.1.4, 6.0.11 and 5.2.20 on 2 December 2026 to fix CVE-2026-124827, an arbitrary file write flaw in GeoDjango’s RasterField.
Depending on the GDAL raster driver and filesystem permissions, the flaw can lead to remote code execution under the Django worker’s account. The researcher who found it, Mohamed K. Fathy, codenamed it Django4Shell.
The flaw sits in how django.contrib.gis.db.models.RasterField handles a raster data definition assigned to the field.
If the definition carries a user-controlled name parameter and a non-default driver, the Geospatial Data Abstraction Library (GDAL) can write a file to an attacker-chosen path. Django’s earlier hardening for spatial lookups did not cover this assignment path.
Django4Shell (CVE-2026-124827)
RasterField falls back to a CharField form field. The flaw was therefore reachable by default on models registered in the admin, models used in ModelForms, and models behind writable serializers. The write happens during form validation, before model.save() runs, so no database table or PostGIS connection is needed to trigger it.
Fathy told The Hacker News that the attacker controls the target path, file content and filename through a crafted JSON raster body.
Dropping a .pth file into site-packages, or a sitecustomize.py, gives code execution the next time the interpreter starts. That can happen on a runserver reload, a gunicorn worker fork, a cron-driven manage.py command or a subprocess launch. The payload then runs with the privileges of the web server’s OS user.
For earlier GeoDjango abuse of GDAL, see our coverage of Django and Python web framework flaws.
Affected Versions and Exposure Surface
Three supported branches are affected until patched: 6.1 before 6.1.4, 6.0 before 6.0.11, and 5.2 LTS before 5.2.20. Unsupported releases may also be affected. Only deployments that use RasterField are exposed. Geometry fields are not.
The authentication requirement depends on the application. The standard Django admin needs a staff account with add or change permission on the model, and it does not need superuser rights.
Applications that pass unvalidated raster definitions from ordinary users or anonymous visitors into a ModelForm or serializer could be reachable without staff privileges. Unauthenticated exploitation has not been independently demonstrated.
Patching speed matters because the technique is already public. Our tracker for critical remote code execution advisories shows how quickly public technique details turn into scanning.
No in-the-wild exploitation of CVE-2026-124827 has been confirmed. The technique is public, but no standalone proof-of-concept has been verified. The flaw is not in CISA’s Known Exploited Vulnerabilities catalog.
The same release fixes seven security issues. One of them is CVE-2026-15307, an earlier GeoDjango flaw in spatial lookup raster parsing. It was patched in August 2026 and allowed server-side file writes and request forgery through GDALRaster values.
Django4Shell follows a run of “2Shell”-style disclosures in platform components. Examples are Ruby2Shell (CVE-2026-132825), a heap buffer overflow in string case conversion, and Upload2Shell (CVE-2026-125396), a Ghostscript SAFER sandbox escape.
The common pattern is code in a trusted layer that processes attacker-supplied structures before application logic validates them. Our analysis of library-level sandbox escapes covers that pattern in more detail.
The fixed releases exclude RasterField from automatically generated ModelForms by default. They also restrict non-default raster drivers when processing untrusted definitions. Django warns that server-side request forgery remains possible if an application assigns unvalidated input to a raster field.
Upgrading is therefore not the end of the work. Developers should follow Django’s GDAL raster guidance and allow-list raster drivers. They should also reject any name, driver or path-like keys in client-supplied raster JSON, and they should check that the worker account cannot write to the interpreter’s site-packages directory.
Teams should upgrade to 6.1.4, 6.0.11 or 5.2.20 and rebuild container images so stale layers do not keep the old package. Then run python -m django --version inside the deployed environment to confirm the version. Where patching must wait, disable endpoints that accept raster definitions and remove RasterField from admin registrations.
For hunting, look for unexpected .pth, sitecustomize.py or usercustomize.py files in site-packages and the application tree.
Check file modification times that line up with form submissions to admin or API routes. Review child processes spawned by gunicorn, uWSGI or cron-launched Django commands. Also review outbound connections from application hosts that do not match their normal behavior.
Egress filtering, a read-only root filesystem and a least-privilege service account reduce the impact of the whole class of arbitrary file write flaws. Defenders should apply these controls on every Django host that uses GeoDjango.
FAQ
What is CVE-2026-124827? It is an arbitrary file write flaw in Django’s GeoDjango RasterField that can lead to remote code execution.
Which Django versions fix it? Versions 6.1.4, 6.0.11 and 5.2.20, or later releases, fix it.
Is it exploitable without login? It can be if an application exposes raster input to anonymous users, but the standard admin requires a staff account.
Is Django4Shell exploited in the wild? No confirmed exploitation has been reported as of 2 December 2026.
Sources
- Django Project: Django security releases issued: 6.1.4, 6.0.11, and 5.2.20
- Django4Shell research site: django4shell.com