ShieldPack SHIELD PACK
From 1401 onwards.

Where would you like to start?

Services, updates, and ways to contact us, all in one place

Pricing and orders →

Use the bot or chat with us—whichever you prefer

ShieldPack posts

New Django4Shell Vulnerability Enables Django RCE via GeoDjango Form Validation

About 4 min read

Django’s core team has issued emergency updates to close a chain of critical flaws that could let attackers execute code on servers that use GeoDjango. The patches are included in Django 6.1.4, 6.0.11 and 5.2.20, and they address seven separate security issues, the most severe of which is a new remote‑code‑execution (RCE) bug codenamed “Django4Shell” and tracked as CVE‑2026‑124827 with a CVSS score of 9.0.
The Django4Shell flaw builds on two earlier vulnerabilities in the GeoDjango spatial lookup subsystem. The first, CVE‑2026‑15307, was disclosed in August 2026 and allowed server‑side file writes through the raster parsing logic in django.contrib.gis. A subsequent patch, CVE‑2026‑87890, attempted to stop server‑side request forgery (SSRF) that could be triggered with malicious GDAL Virtual Raster (VRT) payloads. According to the October 2026 release notes, the fix for CVE‑2026‑87890 unintentionally left a gap that the new CVE‑2026‑124827 now exploits.
CVE‑2026‑124827 targets the RasterField assignment path in GeoDjango. When a raster is supplied as raw bytes, the previous safeguards only wrapped the data in a GDALRaster object for spatial lookups. The new bug shows that this wrapping does not apply when the raster is assigned to a RasterField model field. An attacker who can supply a crafted JSON raster body can dictate the file name, target path and file contents. This enables arbitrary file writes anywhere the web‑server process can write, including overwriting source files, dropping web shells into static directories, or corrupting configuration files.
One particularly dangerous scenario described by Mohamed K. Fathy, head of cybersecurity at Robusta Technology Group, involves writing a sitecustomize.py file into the worker’s current working directory. Because Python automatically imports sitecustomize.py on interpreter startup, the malicious code runs before any Django code loads. The payload would therefore execute with the privileges of the web‑server OS user on the next runserver reload, gunicorn worker fork, manage.py cron job, or any subprocess launch.
The impact extends beyond sitecustomize.py. An attacker could also plant .pth files in site‑packages, read environment variables and secrets, exfiltrate or modify data, and use the compromised host as a foothold to pivot deeper into the network. Notably, the exploit does not require any database interaction or a call to model.save(), making it harder to detect through typical ORM‑level logging.
The advisory outlines four pre‑conditions for successful exploitation. Three of these are already satisfied in a default Django/GeoDjango deployment: the presence of a RasterField in a model, registration of that field in the admin interface or exposure via ModelForms or writable serializers, and a standard GDAL build that includes drivers capable of writing files. The remaining condition is staff‑level authentication. In practice, any application that grants staff users access to the admin or API endpoints that accept raster uploads is potentially vulnerable until the patches are applied.
New Django4Shell Vulnerability Enables Django RCE via GeoDjango Form Validation
In addition to the RCE chain, the new Django releases also fix an SQL injection vulnerability in range lookups (CVE‑2026‑132092), a cross‑site scripting issue in the truncatechars_html template filter (CVE‑2026‑115868), and a cache‑poisoning flaw that could be triggered by dot‑segment sequences in request paths (CVE‑2026‑125673). These bugs affect a broad set of Django projects, not just those using GeoDjango.
For developers and security teams, the immediate action is to upgrade to the patched versions: 6.1.4 for the latest stable line, 6.0.11 for the long‑term support branch, or 5.2.20 for the older LTS release. The upgrade is backward‑incompatible for raster handling; any code that passes raw byte values to spatial lookups must now wrap those bytes in a GDALRaster object. Byte strings that represent valid hexadecimal geometries remain accepted, but developers should audit all places where raster data enters the system.
Organizations should also review their staff authentication policies. Since staff‑level access is the only non‑default requirement, tightening admin permissions, employing multi‑factor authentication, and limiting raster upload endpoints to trusted users can reduce exposure while patches are rolled out. Logging should be enhanced to capture any attempts to assign raster data to RasterField objects, especially when the name parameter or driver is supplied by a user.
The Django4Shell chain illustrates how incremental patches can unintentionally leave attack surfaces open, especially in complex subsystems like GeoDjango that interact with native libraries such as GDAL. It underscores the importance of comprehensive regression testing for security fixes and the need for developers to treat all user‑supplied input as untrusted, even when it passes earlier validation stages.
By applying the updates, validating raster inputs, and tightening staff access, organizations can close the most dangerous vector exposed by CVE‑2026‑124827 and mitigate the ancillary bugs addressed in the same release. Failure to act promptly could leave web applications vulnerable to full server compromise without any obvious signs in application logs.

Source: The Hacker News · Cybersecurity

ShieldPack media