Django4Shell (CVE-2026-124827): Analyzing GeoDjango’s RasterField Assignment Vulnerability and the December 2026 Django Security Release
Architectural analysis of Django4Shell (CVE-2026-124827) and the Dec 2, 2026 Django security release (6.1.4, 6.0.11, 5.2.20): how GeoDjango RasterField reached file-backed GDAL drivers, plus CVE-2026-132092 SQLi and hardening.
CVE-2026-124827 ("Django4Shell") + 6 Companion Dec 2, 2026 Django CVEs (incl. CVE-2026-132092 Critical SQLi) (CWE-73 External File Path Control, CWE-434 Unrestricted File Write & CWE-89 SQL Injection)
Severity: CRITICAL / HIGH (ARBITRARY SERVER-SIDE FILE WRITE IN GEODJANGO & ORM SQL INJECTION) (CVSS High / Critical (GeoDjango RasterField File Write -> RCE & ORM range/in SQL Injection))
Threat Actor: Mohamed K. Fathy (CVE-2026-124827 "Django4Shell") & Django Security Team — Dec 2, 2026
Status: Emergency Security Releases Shipped Dec 2, 2026; Immediate Framework Upgrade Required
Affected Systems: Django < 5.2.20, 6.0.x < 6.0.11, and 6.1.x < 6.1.4 (GeoDjango PostGIS RasterField & Core ORM)
Fixed In: Django 6.1.4, Django 6.0.11, and Django 5.2.20 (LTS)
On December 2, 2026, the Django Software Foundation released urgent security updates (Django 6.1.4, 6.0.11, and 5.2.20) remediating seven vulnerabilities across GeoDjango, the Django ORM, caching middleware, template truncation filters, and Django Admin. The headline GeoDjango flaw—tracked as CVE-2026-124827 and dubbed "Django4Shell" by researcher Mohamed K. Fathy—closes an incomplete patch lineage stemming from the August 2026 GDAL raster advisories (CVE-2026-15307 and CVE-2026-87890). While those earlier patches restricted raster definitions inside spatial lookups, the model field assignment path on django.contrib.gis.db.models.RasterField remained reachable via default Django Admin panels, ModelForms, and writable model serializers. Because RasterField defaulted to editable=True, fell back to a plain CharField form widget, and forwarded dictionary or JSON raster definitions directly into GDALRaster, untrusted input specifying a non-default file-backed GDAL driver and target path could trigger arbitrary server-side file writes on PostGIS-backed GeoDjango deployments.

1. Complete Matrix of the December 2, 2026 Django Security Release
Even deployments that do not use GeoDjango or PostGIS must treat this release as urgent because it bundles a Critical ORM SQL Injection (CVE-2026-132092) alongside six additional security fixes:
| CVE Identifier | Severity | Component | Technical Summary |
|---|---|---|---|
| CVE-2026-124827 ("Django4Shell") |
High | django.contrib.gis (RasterField) |
Arbitrary server-side file write (code execution risk) when untrusted dict/JSON raster definitions specifying non-default GDAL drivers are assigned to RasterField (PostGIS only). |
| CVE-2026-132092 | Critical | Django ORM (range / in lookups) |
SQL injection when range or in query lookups operate over query aliases or key transforms containing percent signs (%). |
| CVE-2026-132809 | High | django.contrib.gis (OGRGeometry.wkb) |
Heap buffer overflow during Well-Known Binary (WKB) geometry handling in OGRGeometry.wkb. |
| CVE-2026-115868 | Moderate | truncatechars_html / Truncator |
Cross-Site Scripting (XSS) when truncating HTML strings at specific boundary lengths inside HTML attributes. |
| CVE-2026-125673 | Moderate | Cache / Path Normalization | Web cache poisoning via dot segments in incoming request paths. |
| CVE-2026-119642 & CVE-2026-127929 |
Moderate | django.contrib.admin (Changelist) |
Information disclosure in Django Admin changelist queries via pk aliases and reverse model relations. |
2. Incomplete Patch Lineage: From CVE-2026-15307 to Django4Shell (CVE-2026-124827)
In August 2026, Django patched CVE-2026-15307 (and follow-up CVE-2026-87890), which prevented GeoDjango spatial lookups from forwarding untrusted raster definitions into GDAL’s file-backed drivers. However, organizations that installed those August updates (such as Django 5.2.17 or 6.0.8) remained exposed through a parallel entry point: direct model field assignment on RasterField.
HTTP Request (Django Admin / ModelForm / Writable API Serializer)
│
▼
[1] Form / Serializer binds string or dict to Model.raster_field
(Previously reachable by default: editable=True, fallback = CharField)
│
▼
[2] django/contrib/gis/db/models/proxy.py :: SpatialProxy.__set__()
& django/contrib/gis/db/models/fields.py :: RasterField
├─► Coerces JSON string / dictionary directly into GDALRaster(value)
└─► Does NOT restrict the 'driver' key to the in-memory 'MEM' driver!
│
▼
[3] django/contrib/gis/gdal/raster/source.py :: GDALRaster.__init__()
├─► Reads 'driver' parameter (non-default file-backed GDAL driver)
├─► Reads 'name' parameter (attacker-controlled local filesystem path)
└─► Invokes GDAL C API (GDALCreate) -> writes raster file directly to disk!
│
▼
[4] Server-Side File Write Impact
└─► Overwriting writable Python modules (e.g., sitecustomize.py),
templates, or application scripts can escalate to remote code execution.RasterField Was Reachable by Default
In django/contrib/gis/db/models/fields.py, RasterField.contribute_to_class() attaches a SpatialProxy descriptor wrapping GDALRaster. Because RasterField previously inherited editable=True and lacked a dedicated form widget, it fell back to a standard forms.CharField in Django Admin, ModelForms, and writable model serializers—allowing raw JSON raster configurations to invoke file-backed GDAL drivers instead of the safe in-memory "MEM" driver.3. Defensive Changes in Django 6.1.4, 6.0.11, and 5.2.20
The December 2, 2026 security patches introduce two decisive behavioral invariants inside GeoDjango’s RasterField pipeline:
editable=Falseby Default:RasterFieldnow defaults toeditable=False, automatically excluding it from Django Admin forms andModelForms unless a developer explicitly opts back in.GDALExceptionon Non-Default Drivers: Assigning a dictionary or JSON string specifying any non-default GDAL driver directly to aRasterFieldnow raises aGDALException. Applications that legitimately require file-backed GDAL drivers must explicitly instantiate and pass a trustedGDALRaster(...)object.
Exposure Preconditions for CVE-2026-124827
- Running Django
< 5.2.20,6.0.x < 6.0.11, or6.1.x < 6.1.4. - Using GeoDjango configured with PostGIS (the only backend supporting
RasterField). - Exposing a model containing a
RasterFieldvia Django Admin, aModelForm, a writable serializer, or view logic accepting user-controlled input. - Having a file-backed GDAL raster driver available with filesystem write permissions.
4. Detection Engineering & Telemetry Rules
1. ModSecurity / Coraza WAF Rules (IDs 950045–950046)
# ColibriSec WAF Rules for Django4Shell (CVE-2026-124827)
SecRule REQUEST_BODY|ARGS \
"@rx (?i)(?:\"driver\"|'driver')\s*:\s*(?:\"(?!mem\")[^\"\\]{1,32}\"|'(?!mem')[^'\\]{1,32}').{0,500}(?:\"name\"|'name')\s*:\s*[\"'](?:/|\.\./|[a-zA-Z]:\\\\|/vsi)" \
"id:950045,phase:2,deny,status:403,log,auditlog,t:none,\
msg:'Django4Shell (CVE-2026-124827): GeoDjango RasterField non-MEM GDAL driver with filesystem path',\
tag:'attack-rce',tag:'cve-2026-124827',tag:'django4shell'"
SecRule REQUEST_BODY|ARGS \
"@rx (?i)(?:\"name\"|'name')\s*:\s*[\"'](?:/|\.\./|[a-zA-Z]:\\\\|/vsi).{0,500}(?:\"driver\"|'driver')\s*:\s*(?:\"(?!mem\")[^\"\\]{1,32}\"|'(?!mem')[^'\\]{1,32}')" \
"id:950046,phase:2,deny,status:403,log,auditlog,t:none,\
msg:'Django4Shell (CVE-2026-124827): GeoDjango RasterField filesystem path with non-MEM GDAL driver',\
tag:'attack-rce',tag:'cve-2026-124827',tag:'django4shell'"2. Suricata Network IDS Signature (sid:2026124827)
alert http $EXTERNAL_NET any -> $HOME_NET any (msg:"COLIBRISEC EXPLOIT Django4Shell CVE-2026-124827 GeoDjango RasterField Non-MEM GDAL Driver Assignment"; flow:established,to_server; http.request_body; content:"driver"; nocase; content:"bands"; nocase; pcre:"/"driver"s*:s*"(?!MEM")[^"]{1,32}"/i"; reference:cve,2026-124827; classtype:web-application-attack; sid:2026124827; rev:1;)3. Sigma Rule: Unexpected Python Runtime / site-packages File Writes
title: Unexpected File Write to Python Source or site-packages by Django Worker (CVE-2026-124827)
id: 7e2a91c4-4b88-41f3-9c12-202612482701
status: experimental
description: Detects gunicorn, uwsgi, daphne, or python web worker processes writing files into Python site-packages, application source directories, or sitecustomize.py.
references:
- https://colibrisec.org/django4shell-cve-2026-124827-geodjango-rasterfield-security-analysis/
author: James Luther (ColibriSec)
date: 2026-12-02
logsource:
category: file_event
product: linux
detection:
selection_process:
Image|endswith:
- '/python'
- '/python3'
- '/gunicorn'
- '/uwsgi'
- '/daphne'
- '/uvicorn'
selection_target:
TargetFilename|contains:
- 'site-packages'
- 'dist-packages'
- 'sitecustomize.py'
- 'usercustomize.py'
- '.pth'
- '/templates/'
condition: selection_process and selection_target
level: critical
tags:
- attack.persistence
- attack.execution
- cve.2026.1248275. Remediation & Hardening Playbook
# 1. Verify current Django version
python3 -m django --version
# 2. Upgrade immediately to December 2, 2026 security releases:
# Django 6.1.4 | Django 6.0.11 | Django 5.2.20 (LTS)
pip install --upgrade "Django>=5.2.20,<5.3"
# 3. Audit repositories for RasterField / GDALRaster usage
grep -rn "RasterField\|GDALRaster" --include="*.py" .- Immutable Runtime Filesystem: Mount Python
site-packagesand application code read-only (readOnlyRootFilesystem: truein Kubernetes or systemdProtectSystem=strict) so a file-write primitive cannot modify Python startup hooks or application modules. - Explicit Field Allow-Lists: Avoid
fields = '__all__'on DjangoModelFormand DRFModelSerializerclasses, and explicitly exclude spatial raster fields from public write endpoints.