Django releases emergency patches for critical GeoDjango remote code execution flaw
The Django Software Foundation released versions 6.1.4, 6.0.11 and 5.2.20 on October 2026 to address seven security vulnerabilities, including a critical flaw tracked as CVE-2026-124827 with a CVSS score of 9.0. The vulnerability, codenamed Django4shell by Mohamed K. Fathy, head of cybersecurity at Robusta Technology Group, stems from incomplete protections in GeoDjango's RasterField assignment path. The maintainers described it as an incomplete fix for CVE-2026-87890, which itself was an incomplete patch for CVE-2026-15307 addressed in August 2026.
CVE-2026-15307 is a high-severity flaw in GeoDjango's spatial lookup raster parsing mechanism that enables server-side file writes, potentially resulting in remote code execution. The subsequent vulnerability CVE-2026-87890 targets the same module, enabling server-side request forgery by making use of crafted Geospatial Data Abstraction Library Virtual Raster payloads that reference an external raster source. Django maintainers noted in the October 2026 release notes that the issue could be exploited by applications that passed attacker-controlled bytes directly to a spatial lookup and was overlooked in the fix for CVE-2026-15307.
CVE-2026-124827, the latest vulnerability, stems from the fact that the protections do not extend to the RasterField assignment path, enabling an attacker to obtain arbitrary file write and remote code execution primitives. Mohamed K. Fathy told The Hacker News via email that the attacker controls the target path, file content and filename via a crafted JSON raster body, allowing overwriting application source code, dropping web shells into static directories or corrupting configuration files. By writing sitecustomize.py into the worker's current working directory, typically on sys.path, the attacker plants a file that Python automatically imports at interpreter startup before any application code runs.
The attacker can exploit this vulnerability to drop .pth files into site-packages, read secrets and environment variables, exfiltrate or modify data, and pivot into the host or network without any database interaction or model.save() being called. Django maintainers stated in an advisory that assigning a raster data definition to django.contrib.gis.db.models.RasterField with a user-controlled name parameter and a non-default driver could cause GDAL to write a file to an attacker-controlled location. Depending on the raster driver, this could enable remote code execution. Because RasterField falls back to the CharField form field, the flaw was reachable by default on models with RasterField registered in the admin or using ModelForms or writable model serializers.
Successful exploitation of the flaw hinges on four pre-conditions, three of which are satisfied by default in a standard Django GeoDjango deployment, according to Fathy. The primary requirement is staff-level authentication; if an application uses RasterField, the remaining conditions are almost certainly met by default. Organizations running GeoDjango with raster data, standard admin access and a default GDAL build should consider themselves exposed until patched. Outside of CVE-2026-124827, the latest versions also address an SQL injection in range and lookups (CVE-2026-132092), a potential cross-site scripting vulnerability (CVE-2026-115868) in the truncatechars_html template filter and a cache poisoning flaw via dot segments in request paths (CVE-2026-125673).
Source credits
The Hacker News. Edited by SetuGeo.