Vulnerabilities and exploitation

Django4Shell: Django patches GeoDjango flaw that can lead to remote code execution

Django 5.2.20, 6.0.11 and 6.1.4 fix seven bugs, including a RasterField flaw that lets an authenticated user write arbitrary files to the server.

By Junglewise News DeskPublished 4 min read
Video: Junglewise Live

The Django project has released three security updates, 5.2.20, 6.0.11 and 6.1.4, fixing seven vulnerabilities. The one drawing attention is CVE-2026-124827, a flaw in GeoDjango's RasterField that lets an authenticated user write files to arbitrary paths on the server, and in the right conditions turn that into remote code execution.

Applications in scope are GeoDjango deployments on PostGIS that define a RasterField, according to SecurityWeek, with the greatest exposure where that field is reachable through the Django admin, a ModelForm or a writable model serializer. The flaw has been given the name Django4Shell, and SecurityWeek reports that a proof-of-concept exploit is publicly available. No exploitation in the wild has been recorded.

The uncomfortable part of the story is the lineage. SecurityWeek reports that CVE-2026-124827 is an incomplete fix for CVE-2026-87890, a server-side request forgery bug patched in October, which was itself an incomplete fix for CVE-2026-15307, a file-write and request forgery issue patched in August. This is the patch for the patch for the patch.

Orca Security said the protections added by the earlier patches never covered the path by which a RasterField is assigned, which SecurityWeek reports left a recurring attack surface that Django has now addressed more thoroughly.

What to do now

  1. Upgrade to Django 6.1.4, 6.0.11 or 5.2.20, whichever matches the major version in use. The fixes are in the Django security releases announced alongside the advisory.
  2. If the deployment runs 5.1.x, 5.0.x or 4.2.x, treat it as potentially affected and plan a move to a supported branch.
  3. Find out whether GeoDjango is actually in play. Search the codebase for django.contrib.gis and for RasterField. Projects that do not use PostGIS raster fields are not exposed to this particular bug, although the other six fixes in the release still apply.
  4. Where a RasterField exists, check how it is exposed: registered in the Django admin, included in a ModelForm, or writable through a model serializer in an API. Those are the paths SecurityWeek reports make the flaw reachable by default.
  5. If an immediate upgrade is not possible, remove or restrict write access to those paths as a stopgap. Taking the model out of the admin, making the serializer field read-only or dropping the field from the form all remove that exposure.
  6. Validate raster input before accepting it from untrusted sources. The Hacker News notes that developers should review Django's raster security considerations, because server-side request forgery risk remains even after patching.
  7. Review who can authenticate, since the flaw requires an authenticated attacker rather than an anonymous one.
  8. Check for unexpected files in the application's working directory and in site-packages, and compare deployed source against what the repository says should be there. Orca Security said an attacker could drop Python files into the working directory, write to site-packages, overwrite source code, plant web shells or corrupt configuration files.

Technical details

CVE-2026-124827 sits in django.contrib.gis.db.models.RasterField. The name parameter in raster data can be manipulated to point at an arbitrary file path, and the field does not validate that path properly. The result is a file write under attacker control. Depending on the raster driver underneath, such as GDAL, that file write can escalate to remote code execution.

The weakness is classified as CWE-73, external control of a file name or path. The National Vulnerability Database rates it high severity with a CVSS score of 8.8. The vector string published with that score describes an attack reachable over the network, of low complexity, requiring some level of privilege but no interaction from a user, with high impact on confidentiality, integrity and availability. SecurityWeek also cites a score of 8.8.

Affected versions are Django 6.1 before 6.1.4, 6.0 before 6.0.11 and 5.2 before 5.2.20. The unsupported 5.1.x, 5.0.x and 4.2.x series may also be affected. Fixed versions are 6.1.4, 6.0.11 and 5.2.20.

On reachability, Django's maintainers explained that RasterField defaults to the CharField form field, which is why the problem showed up without any special configuration wherever the model was exposed through the admin, a ModelForm or a writable serializer, as reported by SecurityWeek. In other words, developers did not have to do anything unusual to be exposed; they only had to use the field the obvious way.

Orca Security described exploitation as a crafted JSON raster body carrying a user-controlled name parameter together with a non-default GDAL driver, according to SecurityWeek. From there the researchers listed the outcomes above: files dropped into the working directory, writes into site-packages, overwritten source, web shells and corrupted configuration.

The same release, published on a Wednesday, also fixed cross-site scripting, cache poisoning, information disclosure, a heap buffer overflow and SQL injection issues. Details of those six have not been broken out in the reporting available, so the severity of each is not yet clear from the coverage.

What is not known at this point: whether any of the seven issues has been exploited against real deployments, how widely the public proof-of-concept has circulated, and how many of the unsupported 5.1.x, 5.0.x and 4.2.x installations are affected in practice. Django has not published a count of impacted projects, and no vendor or researcher in the available reporting has attributed activity to a named group.

Share this article

On Junglewise Threat Intelligence

Scan your domain free: see what attackers can see from outside, in about 30 seconds.

This article as Markdown. Atom feed.