Django4Shell (CVE-2026-124827): who is exposed, how to check, and why GeoDjango needed a third fix
Django 6.1.4, 6.0.11 and 5.2.20 fix seven security bugs. The worst lets a logged-in staff user with a GeoDjango raster form write a file where the attacker picks, which can lead to running code. This page shows who is exposed, a short check, and why this is the third fix in the same code since August.
Read the original first: https://www.djangoproject.com/weblog/2026/dec/02/security-releases/
In one minute
- Django released 6.1.4, 6.0.11 and 5.2.20 on December 2. They fix seven security bugs. Django asks everyone to upgrade as soon as possible.
- The worst one, CVE-2026-124827, is in GeoDjango's RasterField. A crafted raster value with a non-default driver can make GDAL write a file to a place the attacker picks. Django says this could lead to remote code execution.
- Django rates it high. The Hacker News reports a CVSS score of 9.0, and the finder calls it Django4Shell.
- It needs a logged-in user who can reach a form or serializer with a RasterField, such as the default admin. The finder says staff login is the main barrier.
- This is the third Django fix in the same raster code since August 2026. Each fix closed one way in and missed another.
- Apps with only geometry fields are not affected by this bug. RasterField works only on PostGIS.
- One other bug needs a step after you upgrade: clear your cache. Django says old cached responses are not removed by the upgrade.
What broke
GeoDjango is Django's add-on for maps and spatial data. A RasterField stores grid data, like elevation maps or satellite images. Django hands raster data to GDAL, a widely used library that reads and writes geodata files.
Django's advisory says that assigning a raster definition to a RasterField, with a user-controlled name and a non-default driver, could make GDAL write a file to an attacker-controlled location. Depending on the driver, that could enable remote code execution.
Why forms matter: RasterField falls back to a plain text form field. So the bug was reachable by default on models with a RasterField registered in the admin, used in a ModelForm, or used in a writable serializer.
The finder, Mohammed Fathy of Robusta Technology Group, told The Hacker News the attacker controls the file path, the content and the file name. His example is writing a sitecustomize.py file, which Python loads at start, so the code runs the next time a worker restarts. His advisory page says the write happens during form validation, inside form.is_valid(), before anything is saved.
Three fixes, one area
This is the third Django advisory about GeoDjango rasters in four months:
- August 4, CVE-2026-15307 (high): spatial lookups passed text and dict values to GDALRaster, which could write a file or make a network request. Django blocked those types in lookups. Its note said the new block did not apply to model field assignments, which still accepted those types.
- October 6, CVE-2026-87890: raster values given as bytes to a lookup could hold a VRT file that points GDAL at an outside source, so the server makes network requests. Django said this path was overlooked in the August fix.
- December 2, CVE-2026-124827 (high): the field assignment path can write files.
Our reading: each fix closed the input path that was reported and left a nearby one open. The December fix changes a default instead. RasterField now has editable=False, so it drops out of a ModelForm unless you add it on purpose. A dict or JSON value with a non-default driver now raises GDALException.
The fix is not a full wall. Django says server-side request forgery (making the server fetch a URL for the attacker) is still possible if untrusted input reaches a RasterField. Django asks you to validate raster input yourself.
Who can reach which bug
The seven bugs do not need the same access. Sorted by who can reach them, from Django's advisory:
- A logged-in staff user: the RasterField file write (high), and two admin list-page leaks that let a staff user with view rights work out hidden values through repeated searches (both low).
- Anyone, under some setups: cache poisoning through . and .. in request paths (low). It needs the cache middleware or cache_page and certain URL setups.
- Only if your code does certain things: SQL injection in the range and in lookups (high), which needs percent signs in aliases or key transforms; cross-site scripting in truncatechars_html (moderate), when the output lands in an HTML attribute; and a buffer overflow in OGRGeometry.wkb for geometries larger than 4 GB (low).
So the scariest bug needs a login, and one of the low ones does not. Rate them for your own app, not by the headline.
Check your project
These are plain commands. We did not run them against a real GeoDjango app.
# Which Django do you run? Fixed versions: 6.1.4, 6.0.11, 5.2.20 python -m django --version # Do you use RasterField anywhere? grep -rn "RasterField" --include=*.py . # Does your GDAL build include the EHdr driver the finder used? gdalinfo --formats | grep -i ehdr
If grep finds no RasterField, the file write bug does not apply to you. Upgrade anyway for the other six.
If it finds one, check whether that model is in the admin, a ModelForm or a writable serializer. Those are the paths Django names.
After the upgrade, clear your cache if you use Django's cache middleware or cache_page.
Who is affected
| Case | Status |
|---|---|
| Django 6.1 before 6.1.4 | Affected. Fixed in 6.1.4. |
| Django 6.0 before 6.0.11 | Affected. Fixed in 6.0.11. |
| Django 5.2 before 5.2.20 | Affected. Fixed in 5.2.20. |
| Django main branch | Patched. |
| Apps with geometry fields only | Not affected by the file write bug, per Django. |
| Databases other than PostGIS | RasterField is only built for PostGIS. |
What to do
- Upgrade to Django 6.1.4, 6.0.11 or 5.2.20.
- Search your code for RasterField. If you have one, check who can reach its admin page, forms and serializers.
- If you add a RasterField back to a form on purpose, validate the raster input. Server-side request forgery is still possible.
- Clear caches after the upgrade if you use UpdateCacheMiddleware or cache_page.
- Review staff accounts and their passwords. The worst bug needs a staff login.
What is still unknown
- Whether anyone has used the file write bug in attacks. Django's advisory does not say.
- Where the 9.0 score comes from. Django's post gives only its own high rating.
- Older Django versions that are no longer supported. The advisory lists only main, 6.1, 6.0 and 5.2.
- Whether more raster input paths remain. Django still warns that server-side request forgery is possible with untrusted raster input.
Sources
- Django security releases issued: 6.1.4, 6.0.11, and 5.2.20 (Django project, Dec. 2, 2026) - the original report
- Django 6.1.4 release notes
- Django security releases, October 6, 2026 (CVE-2026-87890)
- Django security releases, August 4, 2026 (CVE-2026-15307)
- The Hacker News: New Django4Shell Vulnerability Enables Django RCE via GeoDjango Form Validation
- Django4Shell advisory page (Mohammed Fathy, Robusta Technology Group)