Back Thehackernews New Django4Shell Vulnerability Enables Django RCE via GeoDjango Form Validation
The maintainers of Django have released versions 6.1.4, 6.0.11, and 5.2.20 to address seven security vulnerabilities, including a critical security flaw that could potentially enable remote code execution.
The vulnerability, tracked as CVE-2026-124827 (CVSS score: 9.0), has been codenamed Django4shell by Mohamed K. Fathy, head of cybersecurity at Robusta Technology Group. It's an incomplete fix for CVE-2026-87890 , which, in turn, is an incomplete patch for an earlier issue ( CVE-2026-15307 ) that was addressed in August 2026.
CVE-2026-15307 is a high-severity flaw in GeoDjango 's ("django.contrib.gis") spatial lookup raster parsing mechanism that enables server-side file writes, potentially resulting in remote code execution.
The subsequent vulnerability, CVE-2026-87890, also targets the same module, but enables server-side request forgery (SSRF) by making use of crafted Geospatial Data Abstraction Library ( GDAL ) Virtual Raster (VRT) payloads that reference an external raster source.
"This issue could be exploited by applications that passed attacker-controlled bytes directly to a spatial lookup," Django maintainers said in the October 2026 release notes. "It was overlooked in the fix for CVE-2026-15307."
"To mitigate this issue, raster values provided as bytes must now be wrapped in GDALRaster before being used in spatial lookups. Byte values representing valid hexadecimal geometries remain accepted. This is a backward incompatible change. As a reminder, all untrusted user input should be validated before use."
CVE-2026-124827, the latest vulnerability, stems from the fact that the protections don't extend to the RasterField assignment path, enabling an attacker to obtain arbitrary file write and remote code execution primitives.
"The attacker controls the target path, file content, and filename via a crafted JSON raster body," Fathy told The Hacker News via email. "This allows 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. On the runserver reload, gunicorn worker fork, manage.py cron job, or subprocess execution, the payload executes with the privileges of the web server OS user."
An 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() is ever called.
"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," Django maintainers said in an advisory released today.
"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."
However, 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 -
django.contrib.gis with a RasterField model (moderate prevalence) - Common in government, mapping, GIS, agricultural, and environmental platforms.
RasterField exposed via ModelForm or default admin (very high) - Django auto-generates admin forms for every registered model. Unless explicitly excluded or customized, this condition is met out of the box.
GDAL with the EHdr driver (near-universal) - EHdr ships in every standard GDAL build across all platforms (apt, yum, Homebrew, conda) without requiring special compilation flags.
Writable target path (very high) - The worker's current working directory (project root) is writable by definition and typically on sys.path, making it an ideal drop zone for sitecustomize.py.
"The primary requirement is staff-level authentication," Fathy added. "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 in 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).
