Django4Shell: The GeoDjango Flaw That Survived Two Incomplete Patches

Developer workstation with a satellite map and blurred code on two monitors

Django4Shell: The GeoDjango Flaw That Survived Two Incomplete Patches

Developer workstation with a satellite map and blurred code on two monitors

Django4Shell: The GeoDjango Flaw That Survived Two Incomplete Patches

Django4Shell is the name a security researcher has given to a GeoDjango flaw that could let an attacker write files on a server and, in the right conditions, run code there. The vulnerability, tracked as CVE-2026-124827, is the third issue in four months to emerge from the same corner of Django’s geographic framework, after two earlier patches each closed one route and left another open.

Django’s maintainers released versions 6.1.4, 6.0.11 and 5.2.20 on December 2 to address seven security vulnerabilities, including this one. The researcher who named the flaw, Mohamed K. Fathy, head of cybersecurity at Robusta Technology Group, rates it at 9.0 on the CVSS scale. Django’s own advisory classifies the issue as high severity under its security policy.

The flaw does not affect every Django site. It concerns applications that use GeoDjango, Django’s built-in geographic framework, with a particular kind of field for raster data. That narrower scope is reassuring for many teams and no comfort at all for the mapping, government, agricultural and environmental platforms where such fields are common. For those teams, the advice is simple: upgrade first, then review who can submit data to the field.

Three patches for one subsystem in four months

The second issue, CVE-2026-87890, followed in October. It targeted the same module and enabled server-side request forgery through crafted raster payloads that referenced an external source. Django’s maintainers acknowledged the connection in their October release notes, saying the issue had been overlooked in the fix for the August flaw.

That October fix required raster values supplied as bytes to be wrapped in a GDALRaster object before being used in spatial lookups. The maintainers flagged the change as backward incompatible, meaning some existing code would need adjustment. It was a deliberate tightening of how untrusted raster data could enter the system.

The December flaw exists because those protections did not extend to a different entry point: assigning a value directly to a RasterField. Fathy describes CVE-2026-124827 as an incomplete fix for the October issue, which was itself an incomplete patch for the August issue. Django’s advisory does not use the phrase incomplete fix, so that framing should be understood as the researcher’s analysis rather than the maintainers’ wording.

Even with that caveat, the pattern is hard to ignore. Each fix sealed the reported path, and each time a neighbouring path into the same underlying machinery remained reachable. The subsystem in question is raster handling, where Django relies on GDAL, the Geospatial Data Abstraction Library, to read and write geographic data in many formats.

Raster data is the grid-based side of geographic information: satellite imagery, elevation models, land-cover maps and similar layers made of cells rather than points and lines. GeoDjango’s RasterField stores that kind of data in a database. Django notes that RasterField is only implemented on PostGIS, the spatial extension for PostgreSQL, which further narrows the exposed population.

How a map field becomes a server problem

Printed topographic maps and a laptop on a desk beside network cables
Raster data powers maps and terrain models, but the GeoDjango field that stores it became a route to server file writes.

Django’s advisory describes the flaw in careful terms. Assigning a raster data definition to a RasterField with a user-controlled name parameter and a non-default driver could cause GDAL to write a file to a location the attacker chooses. Depending on the raster driver involved, that file write could enable remote code execution.

The reason the flaw was reachable by default is a piece of framework behaviour that many developers would never think about. RasterField fell back to the ordinary CharField form field, so models registered in the Django admin, or exposed through ModelForms or writable model serializers, presented the field as a text input. Data submitted through those paths could reach the vulnerable assignment code.

Fathy told reporters that the attacker controls the target path, file content and filename through a crafted raster definition, and that this allows overwriting application source code, dropping web shells into static directories, or corrupting configuration files. Those impact scenarios are the researcher’s, reported through the press; Django’s own advisory speaks more narrowly of a file write to an attacker-controlled location that could enable code execution depending on the driver.

The researcher also described how a file placed where Python automatically imports it at startup could execute with the privileges of the web server user when workers restart or scheduled jobs run. The broader point for defenders is that a file-write flaw in a web application is rarely just about the file. Where the written file lands, and what later reads or executes it, decides whether the result is defacement, data theft or full server compromise.

According to Fathy, successful exploitation hinges on four preconditions, three of which are satisfied by default in a standard Django and GeoDjango deployment. The application must use GeoDjango with a RasterField model, which he calls moderately prevalent. The field must be exposed through a ModelForm or the default admin, which he rates as very likely because Django auto-generates admin forms for registered models unless they are explicitly excluded or customised.

The remaining conditions concern the environment. The GDAL installation must include a particular driver, which the researcher says ships in standard GDAL builds across common platforms. And there must be a writable target path, which he argues is usually true of the worker’s working directory. His summary is that the primary requirement is staff-level authentication, and that organisations running GeoDjango with raster data, standard admin access and a default GDAL build should consider themselves exposed until patched.

That staff-login requirement is worth pausing on. It means the flaw is not, in the ordinary case, something an anonymous visitor can trigger from the public internet. But staff accounts get phished, reused and leaked, and a public form or an API endpoint built on a writable serializer changes the picture entirely. Django’s own wording focuses on reachability through the admin, ModelForms and writable serializers, and defenders should audit all three rather than rely on the login screen as the only control.

What the December fix changes

The fixed releases are Django 6.1.4, 6.0.11 and 5.2.20, covering the three supported branches. Earlier releases in each branch are presumed vulnerable. Teams on older, unsupported series face a harder problem: Django does not issue patches for them, and its guidance is that older versions may also be vulnerable, so the remedy is to move to a supported series.

The fix changes behaviour in two ways that developers should know about before deploying. First, RasterField now defaults to not being editable, which excludes it from ModelForms unless it is included deliberately. If a project edits rasters through the admin on purpose, those fields will disappear from the form after the upgrade, and adding them back should only happen alongside proper validation.

Second, assigning a dictionary or JSON string that names a non-default driver now raises an exception. To use another driver with trusted input, developers are expected to wrap the definition in a GDALRaster object, signalling that the source is trusted. The design pushes developers to make an explicit decision about trust instead of letting submitted data make it for them.

Django is candid about the limits of the change. The new exception only limits server-side file writes; server-side request forgery remains possible if untrusted input is assigned to a RasterField. Even on a patched version, the documentation warns against assigning untrusted input to the field without custom validation. The patch closes the worst route, not every risk in handling raster data.

The December release also fixes six other issues, which gives every Django team a reason to upgrade even if GeoDjango is not in use. They include an SQL injection flaw in range and in lookups, tracked as CVE-2026-132092 and rated high by Django, a potential cross-site scripting issue in a template filter, and a cache poisoning flaw involving dot segments in request paths.

For teams deciding how much this matters to their own stack, the surrounding tooling choices are part of the picture. Developers comparing VS Code and PyCharm for Python work are making everyday decisions about how code gets written and reviewed, and a framework security release is a reminder that the review habit matters as much as the editor.

Who should worry, and in what order

The exposure test has three parts. A project is in scope if it uses GeoDjango with a model that has a RasterField, runs PostGIS as its database backend, and is on a Django version below the fixed release for its branch. Only then does the fourth question arise: can untrusted or semi-trusted users send data that ends up assigned to that field?

Because the flaw is a file write, checking for tampering is prudent where exposure was real. Unexpected Python startup files, modified application source, or files in static directories that nobody deployed all deserve investigation. Where a project deploys from a version-controlled checkout or an immutable image, comparing the running files against that reference is the cleanest check.

If something unexpected turns up, the host should be treated as compromised: isolate it, preserve logs, rotate the secrets the process could read, and redeploy from a clean image. That advice is general incident practice rather than anything Django’s advisory prescribes, but a file-write flaw with a code-execution path is exactly the situation it exists for.

Newer Python developers may find the vocabulary here dense, and that is normal. Guides to choosing a code editor as a Python beginner are a gentler entry point, but the underlying lesson applies at every level: framework defaults decide a great deal of security, and knowing which defaults your project inherits is part of the job.

The incomplete-fix pattern

No active exploitation in the wild has been reported by the sources covering the flaw so far. That absence should be stated plainly, because it separates this story from cases where attackers are already inside. It also should not breed complacency, since the preconditions are common in exactly the deployments that use raster data.

The deeper question is about how fixes are scoped. When a maintainer patches the specific payload a researcher reported, sibling payloads that reach the same underlying capability can survive. Here, the underlying capability is untrusted input reaching GDAL with writable output, and GDAL’s driver surface is broad. Three patches in four months suggests the entry points were being closed one at a time.

To Django’s credit, the December fix changes defaults rather than merely filtering a payload. Making RasterField non-editable by default removes it from generated forms, and requiring an explicit wrapper for non-default drivers forces a trust decision into the open. Those are structural changes, and they are the kind that tend to end a chain of bypasses rather than extend it.

Security tooling can help teams respond faster when something does go wrong, as in Wiz putting AI-orchestrated cloud containment in security teams’ hands. But no containment tool substitutes for applying a framework patch that is already available.

The bottom line

Django4Shell is a serious flaw with a bounded audience. If your project uses GeoDjango raster fields on PostGIS, treat the upgrade to 6.1.4, 6.0.11 or 5.2.20 as urgent, restart every worker, and audit who can submit data to those fields. If it does not, upgrade anyway for the SQL injection and other fixes in the same release, and use the moment to check that no dependency has quietly brought a raster field with it.

The wider lesson travels well beyond Django. A patch that closes the reported route but leaves the underlying capability reachable is an invitation to the next researcher, or the next attacker. In 2027, the frameworks and teams that earn trust will be those that fix the class of problem, change the unsafe default, and say clearly what the fix does not cover.

on this page