Django4Shell

Disclosed Dec 2, 2026

Updated Dec 2, 2026

*4ShellCVSS 8.8Authenticated RCE

A server-side arbitrary file-write vulnerability in GeoDjango's RasterField assignment path that allows an authenticated user with form or Django Admin access to invoke GDAL drivers to write Python payloads (such as sitecustomize.py) to disk and achieve remote code execution.

Component

GeoDjango RasterField Assignment (GDAL Driver File Write)

Attack Vector & Class

Authenticated RCE

Logic / Deserialization

Exploitation Status

No confirmed wild attacks

No public PoC

CVSS & Ecosystems

8.8 (v3.1)

Python, Django, GeoDjango

Affected Versions

  • Django 6.1 before 6.1.4, 6.0 before 6.0.11, and 5.2 before 5.2.20 (older unsupported branches such as 5.1 and earlier were not evaluated)
  • Requires GeoDjango (django.contrib.gis) with a RasterField exposed via ModelForm, Django Admin, or writable serializer and a file-writing GDAL driver such as EHdr

Fixed / Recommended Versions

  • Django 6.1.4+, 6.0.11+, or 5.2.20+

Technical Root Cause

CVE-2026-124827 bypasses earlier GeoDjango spatial-lookup hardening (CVE-2026-15307 and CVE-2026-87890) because lookup guards did not execute on the RasterField assignment and ModelForm validation path. Because RasterField previously fell back to a plain CharField in forms, submitting a crafted JSON raster definition specifying a non-default GDAL driver (such as EHdr) and attacker-controlled name parameter causes GDALCreate() to write arbitrary bytes to disk inside form.is_valid() before model.save() is called. Writing sitecustomize.py into a writable sys.path directory yields OS-user code execution on the next Python process start or worker fork.

Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Remediation & Hardening

  1. 1Upgrade immediately to Django 6.1.4, 6.0.11, or 5.2.20 and rebuild container images.
  2. 2Audit codebases for django.contrib.gis and RasterField usage; set editable=False and exclude RasterField from Django Admin, ModelForms, and writable serializers if patching cannot be applied immediately.
  3. 3Ensure application source directories and site-packages are read-only for the web worker OS user.