# Django4Shell (CVE-2026-124827): GeoDjango RasterField file-write bug can lead to code execution. Update to 6.1.4, 6.0.11 or 5.2.20

> Django's December 2 security release fixes seven bugs. The most serious is a GeoDjango flaw that lets a user who can edit a RasterField write files to the server, and the researcher shows it reaching remote code execution. It is the third fix in four months for the same raster code. Here's who is exposed and what to do.

Published Dec 2, 2026 by TechMeasured Staff · Security · Canonical: https://techmeasured.com/security/django4shell-cve-2026-124827-geodjango-rasterfield-file-write-update-what-to-do

**Django released versions 6.1.4, 6.0.11 and 5.2.20 on December 2. Together they fix seven security issues: two rated "high", one "moderate" and four "low". The headline bug is CVE-2026-124827, which its finder calls "Django4Shell".** Django's release notes say that assigning a raster definition with a user-controlled `name` and a non-default GDAL driver to a GeoDjango `RasterField` could make GDAL write a file anywhere the attacker chooses. Depending on the driver, that can mean remote code execution.

This matters because the field was exposed by default. Django says `RasterField` falls back to a plain `CharField` form field, so any model with a `RasterField` was reachable through the admin, a `ModelForm` or a writable model serializer. It is also the third attempt to close the same hole. Django's security archive shows an August 4 fix (CVE-2026-15307, file write and request forgery through spatial lookups) and an October 6 fix (CVE-2026-87890, request forgery through spatial lookup byte values). The Hacker News reports that the new bug is an incomplete fix for the October one.

## Who is exposed

Django says only PostGIS implements `RasterField` and geometry fields are not affected. So the realistic exposure is GeoDjango projects on PostGIS that have a `RasterField` model which untrusted or semi-trusted users can edit.

According to The Hacker News, researcher Mohamed K. Fathy of Robusta Technology Group lists four preconditions:

| Condition (per Fathy, via The Hacker News) | His estimate of how common |
|---|---|
| `django.contrib.gis` with a `RasterField` model | Moderate |
| That field exposed through a `ModelForm` or the default admin | Very high |
| GDAL built with the EHdr driver | Near-universal |
| A writable path, such as the worker's current directory | Very high |

The Hacker News says the main requirement is **staff-level authentication**. Fathy's examples of what an attacker could then do include dropping a web shell, overwriting source files and planting `sitecustomize.py` or `.pth` files that Python runs at startup. The Hacker News rates the bug CVSS 9.0. Django's own rating is "high" on its severity scale. Neither source reports exploitation in the wild.

## What Django changed

- `RasterField` now defaults to `editable=False`, so `ModelForm`s leave it out unless you include it explicitly.
- Assigning a `dict` or JSON string that names a non-default driver now raises `GDALException`. To use another driver, you must wrap the value in `GDALRaster` to mark it as trusted.
- **The fix only blocks server-side file writes.** Django warns that server-side request forgery (SSRF) is still possible if untrusted input is assigned to a `RasterField`. You still need to validate the input yourself.

## The other six fixes

| CVE | Issue | Django severity |
|---|---|---|
| CVE-2026-132092 | SQL injection in `range` and `in` lookups involving aliases or key transforms that contain percent signs | High |
| CVE-2026-115868 | XSS in the `truncatechars_html` filter / `Truncator.chars(html=True)` | Moderate |
| CVE-2026-125673 | Cache poisoning via `.`/`..` path segments in `cache_page` and `UpdateCacheMiddleware` (unauthenticated) | Low |
| CVE-2026-119642 | Admin changelist data leak via the `pk` alias on `OneToOneField` primary keys (affects multi-table inheritance by default) | Low |
| CVE-2026-127929 | Admin changelist data leak via reverse relations (a regression from 5.0.3) | Low |
| CVE-2026-132809 | Heap buffer overflow in `OGRGeometry.wkb` for geometries over 4 GB | Low |

The SQL injection fix changes behaviour: `__range` now requires exactly two right-hand values. Django says the `__range` flaw needed more than two values to trigger, and the `__in` flaw needed a bilateral transform.

We read the 6.1.4, 6.0.11 and 5.2.20 release notes in Django's repository, and all three list the same seven CVEs. The release tags were cut between 11:31 and 11:48 UTC on December 2.

## What to do

1. **Upgrade** to 6.1.4, 6.0.11 or 5.2.20 (`pip install -U "Django==6.1.4"` or the matching version for your series). These are the only three series Django patched.
2. **If you use GeoDjango rasters,** search your code for `RasterField`. Check every form, admin class and serializer that exposes it, and check which users can reach them. Treat staff accounts as part of the attack surface. Fathy's attack starts from a staff login.
3. **Validate raster input yourself.** After upgrading, SSRF is still possible with untrusted raster definitions, according to Django. Don't wrap user input in `GDALRaster` just to get around the new exception.
4. **Clear your caches** if you use `cache_page` or the cache middleware. Django says cached responses from before the upgrade are not invalidated.
5. **Check anything that passes more than two values to `__range`.** It will now raise an error instead of silently working.
6. **If you can't patch immediately,** set the `RasterField` to `editable=False` yourself or remove it from admin and forms. Also review recent writes to your app's working directory for unexpected files, especially `.pth` or `sitecustomize.py`. This is our suggestion, not Django's guidance.

Django's own December 2 weblog post and the researcher's django4shell.com write-up could not be fetched for this article. The details above come from the release notes and security archive in Django's repository, plus The Hacker News's report.


## Sources

1. [Django (GitHub) — Django 6.1.4 release notes](https://github.com/django/django/blob/6.1.4/docs/releases/6.1.4.txt)
2. [Django (GitHub) — Security archive (docs/releases/security.txt)](https://github.com/django/django/blob/main/docs/releases/security.txt)
3. [The Hacker News — New Django4Shell Vulnerability Enables Django RCE via GeoDjango Form Validation](https://thehackernews.com/2026/12/new-django4shell-vulnerability-enables.html)
