In GeoDjango, a RasterField shows up in the Django admin as a plain text box. Before the 2 December 2026 fix, a raster description typed into that box could pick a file-writing GDAL driver and a file path, and Django wrote the file the moment the form was validated. Write the right file, and Python runs it the next time it starts. That’s Django4Shell, CVE-2026-124827.
It needs four things to line up, and most Django sites don’t have a RasterField at all. But the same release fixes a High SQL injection that needs no GeoDjango, so everyone on Django should update. Here’s the bug, who is exposed, a check on a real GeoDjango site, the fix, and a plan B.
Check your own project and read the official advisory first. Don’t blindly copy commands or setting changes; try them on staging: Django security releases · 6.1.4 release notes.
Watch the video
The bug explained simply, all four conditions, and a real Ubuntu 26.04 GeoDjango site: check, fix and plan B.
The quick fix
- Upgrade Django to 6.1.4, 6.0.11 or 5.2.20, in every virtualenv and container image.
- Update the pin in
requirements.txt/ lock files, or the next deploy rolls you back. - Restart your app server. Gunicorn and uWSGI keep the old code in memory.
- Clear your caches (CVE-2026-125673: poisoned entries survive the upgrade).
What is the bug?
Django accepts a raster as a JSON description: width, height, srid, bands, name and driver.
- With the default in-memory driver (MEM),
nameis just a label. - With a file driver such as EHdr (in standard GDAL builds),
namebecomes a file path, and GDAL writes there.
RasterField falls back to a CharField form field, so it appears in the admin, ModelForms and writable serializers by default. And the write happens on assignment, during form validation. No save() needed.
From a file write to code (high level only): drop a file Python runs automatically at start-up, such as sitecustomize.py or a .pth file, or overwrite code or static files. It runs as the web server’s user at the next worker restart, reload or manage.py run.
This is the third fix for the same area: CVE-2026-15307 (4 Aug), CVE-2026-87890 (6 Oct), and now CVE-2026-124827 (2 Dec).
Who is actually exposed?
All four must be true:
- Your project has a RasterField (GeoDjango, PostGIS only; geometry fields are not affected).
- It’s editable through the admin, a ModelForm or a writable serializer.
- Your GDAL can write files with a driver like EHdr. Standard builds can.
- Someone can submit that form. Usually that means a staff account.
How worried should you be? Django rates it High; Snyk gives CVSS 4.0 8.7; the researcher and Orca say 9.0. No attacks were seen in the wild as of 2 Dec, though SecurityWeek reports proof-of-concept details are public.
Check your project
What I ran on a throwaway Ubuntu 26.04 VM with a tiny GeoDjango site on Django 6.1.3. Nothing was ever submitted to the RasterField.
python -m django --version # 6.1.3 = one release before the fix
grep -i django requirements.txt # the pin brings the bug back on every deploy
grep -rn RasterField --include=models.py . # condition 1
cat maps/admin.py # condition 2: admin.site.register(...)
python manage.py shell -v0 -c "from maps.models import Elevation as E; print(E._meta.get_field('rast').editable)" # True
gdalinfo --formats | grep -i ehdr # condition 3: EHdr, read and write
find ~/mapsite ~/venv/lib -name sitecustomize.py -o -name '*.pth' # anything planted?
The form the admin really builds had two fields: name and rast. The raster field was right there as a text box. (maps, Elevation and rast are my demo names; use yours.)
The fix: Django 6.1.4, restart, verify
pip install 'django==6.1.4'
sed -i 's/Django==6.1.3/Django==6.1.4/' requirements.txt
sudo systemctl restart mapsite # your gunicorn / uwsgi service
python manage.py shell -v0 -c "from django.core.cache import cache; cache.clear()"
After the upgrade, editable printed False, and the admin form had only name. The raster field is gone.
What changed: RasterField is now editable=False by default, and a dict/JSON definition with a non-default driver raises GDALException. To use trusted data with another driver, wrap it in GDALRaster yourself. Django notes the fix only limits file writes, so still validate untrusted rasters.
Plan B: can’t upgrade today?
Keep the raster field out of the admin:
from django.contrib import admin
from .models import Elevation
@admin.register(Elevation)
class ElevationAdmin(admin.ModelAdmin):
exclude = ["rast"]
Restart the app, and the admin form shows only name. But this is a stopgap, not the fix: your ModelForms and API serializers need the same treatment, and you should limit staff accounts. Upgrade as soon as you can.
The whole 2 Dec release (7 CVEs)
| CVE | Django rating | What |
|---|---|---|
| CVE-2026-124827 | High | Django4Shell: file write via RasterField |
| CVE-2026-132092 | High | SQL injection in __range / __in (no GeoDjango needed) |
| CVE-2026-115868 | Moderate | XSS in truncatechars_html |
| CVE-2026-125673 | Low | Cache poisoning via dot segments: clear caches |
| CVE-2026-119642, CVE-2026-127929 | Low | Admin changelist info leaks |
| CVE-2026-132809 | Low | Heap overflow in OGRGeometry.wkb (>4 GB geometries) |
Were you already hit?
If you exposed a RasterField, hunt for unexpected sitecustomize.py or .pth files and recently changed .py or static files.
Everything shown was run in a throwaway test VM. No raster definition with a file-writing driver was ever crafted or submitted, and no exploit is shown. Understand each command, try it on staging first, and use it at your own risk.
Summary
- The bug: a RasterField text box could make GDAL write a file anywhere, during form validation.
- Exposed: RasterField + editable in a form + a file-writing GDAL driver + someone who can submit it.
- Fix: Django 6.1.4 / 6.0.11 / 5.2.20, update the pin, restart, clear caches. Everyone should update because of the SQL injection.
Credit: found by Mohammed Fathy (Robusta Technology Group).
More Python and web bugs: phpAfterShell: 12 new PHP bugs · binary-parser: the npm bug npm audit missed
Sources: Django security releases · Django 6.1.4 release notes · The Hacker News · SecurityWeek · Snyk · Orca Security
More on YouTube
Prefer watching? The full Django4Shell walkthrough is on our YouTube channel: watch the video. For more hands-on breakdowns of security bugs, Linux servers and dev tools, subscribe at youtube.com/@fineshotai.
