# Django4shell (CVE-2026-124827) - Django RCE via GeoDjango RasterField Form Validation

> CVE-2026-124827 ("Django4shell", CVSS 9.0 per press; rated High by the Django project) lets a staff-level user make GDAL write attacker-controlled files via the GeoDjango RasterField assignment path, enabling potential remote code execution. It is an incomplete fix of CVE-2026-87890 and was patched in Django 6.1.4, 6.0.11 and 5.2.20.

- **Author:** Threadlinqs Team
- **Published:** 2026-12-02T16:46:13Z
- **Last updated:** 2026-12-02T16:59:44.106Z
- **Canonical:** https://intel.threadlinqs.com/threat/TL-2026-7295
- **ID:** TL-2026-7295
- **Severity:** CRITICAL (CVSS 9)
- **Category:** VULNERABILITY
- **Status:** PATCHED
- **Detections:** 9 (1 shown free below) · **IOCs:** 17 (3 shown free below)
- **CVEs:** CVE-2026-124827, CVE-2026-87890, CVE-2026-15307, CVE-2026-132092, CVE-2026-115868, CVE-2026-125673, CVE-2026-119642, CVE-2026-127929, CVE-2026-132809

## Description

CVE-2026-124827, branded "Django4shell" and reported by Mohamed K. Fathy (Robusta Technology Group), affects django.contrib.gis (GeoDjango). Assigning a user-controlled raster definition to a RasterField together with a non-default GDAL driver allows GDAL to write files to attacker-chosen locations. The attacker controls target path, file content and filename through a crafted JSON raster body supplied in a user-controlled name parameter. The flaw is an incomplete fix of CVE-2026-87890: the earlier protections (requiring raster values passed as bytes to be wrapped in GDALRaster for spatial lookups) did not extend to the RasterField assignment path. No database interaction or model.save() call is needed.

Preconditions per the researcher: django.contrib.gis with a model using RasterField; the RasterField exposed via a ModelForm or the default admin (RasterField falls back to the CharField form field); GDAL with the EHdr driver available (near-universal); a writable target path such as the project root on sys.path; and, as the primary requirement, staff-level authentication. Described post-write techniques: dropping sitecustomize.py into the worker's current working directory (imported by Python at startup), dropping .pth files into site-packages, overwriting application source, dropping web shells into static directories, and corrupting configuration. Payloads would fire on runserver reload, gunicorn worker fork, a manage.py cron job or subprocess execution, running as the web server's OS user, with access to secrets and environment variables and potential pivoting into the host or network.

The vulnerability sits in a chain of GeoDjango raster-handling issues: CVE-2026-15307 (CVSS 8.8, spatial lookups opened dict/JSON raster input in write mode, fixed in Django 5.2.17 and 6.0.8, August 2026) was incompletely fixed, followed by CVE-2026-87890 (SSRF via crafted GDAL VRT bytes in spatial lookups, published 2026-10-06, fixed in 6.1.2, 6.0.9, 5.2.18), followed by CVE-2026-124827. The Django fix makes RasterField default to editable=False and raises GDALException for non-default drivers unless the value is wrapped in GDALRaster; the project warns SSRF remains possible with untrusted input, so untrusted input must be validated. The same security release (2026-12-02) fixed seven issues, including SQL injection in range/in lookups (CVE-2026-132092, High), XSS in truncatechars_html (CVE-2026-115868), cache poisoning via dot segments (CVE-2026-125673), and low-severity admin enumeration and OGRGeometry buffer issues.

Exploitation in the wild is not stated in any source reviewed, and no threat actor, malware family, network IOC or hash has been published. The django4shell.com project page could not be read beyond its title ("Critical RCE in Django 6.1.2 GeoDjango RasterField"), so public PoC status is unverified. IOCs below are behavioral/file artifacts derived from the described exploitation techniques.

## MITRE ATT&CK

- T1190 Exploit Public-Facing Application
- T1078 Valid Accounts
- T1059.006 Python
- T1546.018 Python Startup Hooks
- T1505.003 Web Shell
- T1552.001 Credentials In Files
- T1565.001 Stored Data Manipulation

## Free detection (Splunk SPL, Microsoft KQL, Sigma)

**Django4shell CVE-2026-124827 - GDAL EHdr Arbitrary File Write Artifacts by Web Worker: Startup Hooks, Web Shells, Source/Config Tampering (Splunk)** (`TL-2026-7295-SPL-001`)

Detects the file-write outcomes of CVE-2026-124827 (Django4shell), where a staff user makes GDAL (EHdr driver) write attacker-controlled files via a GeoDjango RasterField. Fires when a web-service account creates or modifies sitecustomize.py/usercustomize.py/.pth Python startup hooks (T1546.018), script files in static/media directories (web shells, T1505.003), Django settings/wsgi/asgi/urls/manage.py/.env files (T1565.001), or GDAL EHdr sidecar files (.hdr/.bil/.flt) outside media/tmp. A worker account should essentially never write these. No network IOCs are published, so detection is behaviour-based.

- **Languages:** Splunk SPL, Microsoft KQL, Sigma
- **ATT&CK:** T1190, T1546.018, T1505.003, T1565.001, T1059.006
- **Data sources:** sysmon_for_linux, DeviceFileEvents, linux_file_event
- **Severity:** critical
- **Confidence:** high

### Splunk SPL

````spl
index=linux sourcetype="sysmon:linux" EventCode=11 earliest=-24h User IN ("www-data","apache","nginx","django","gunicorn") ```CVE-2026-124827 Django4shell: GDAL EHdr arbitrary file write artifacts - Python startup hooks, web shells, source/config tampering``` | eval path=lower(TargetFilename), fname=replace(lower(TargetFilename),"^.*/","") | eval hook=if(in(fname,"sitecustomize.py","usercustomize.py") OR like(fname,"%.pth"),1,0), shell=if(match(path,"/(static|staticfiles|media)/.*[.](py|php|phtml|jsp|jspx|sh|pl|cgi)$"),1,0), cfg=if(match(path,"/(settings|local_settings|wsgi|asgi|urls|manage)[.]py$") OR match(path,"/[.]env$"),1,0), gdal=if(match(path,"[.](hdr|bil|flt)$") AND NOT match(path,"/(media|tmp)/"),1,0) | where hook=1 OR shell=1 OR cfg=1 OR gdal=1 | eval artifact=case(hook=1,"python_startup_hook",shell=1,"web_shell_candidate",cfg=1,"app_config_tamper",true(),"gdal_ehdr_sidecar") | stats count min(_time) as first_seen max(_time) as last_seen values(Image) as writer by host, User, artifact, TargetFilename | convert ctime(first_seen) ctime(last_seen)
````

### Microsoft KQL

```kql
DeviceFileEvents
| where Timestamp > ago(24h)
| where ActionType in ("FileCreated", "FileModified", "FileRenamed")
| where InitiatingProcessAccountName in~ ("www-data", "apache", "nginx", "django", "gunicorn")
| extend Path = tolower(FolderPath), Fname = tolower(FileName)
| extend Artifact = case(
    Fname in ("sitecustomize.py", "usercustomize.py") or Fname endswith ".pth", "python_startup_hook",
    Path matches regex @"/(static|staticfiles|media)/" and Fname matches regex @"[.](py|php|phtml|jsp|jspx|sh|pl|cgi)$", "web_shell_candidate",
    Fname in ("settings.py", "local_settings.py", "wsgi.py", "asgi.py", "urls.py", "manage.py", ".env"), "app_config_tamper",
    Fname matches regex @"[.](hdr|bil|flt)$" and not(Path matches regex @"/(media|tmp)/"), "gdal_ehdr_sidecar",
    "")
| where Artifact != ""
| project Timestamp, DeviceName, Artifact, ActionType, FolderPath, FileName, InitiatingProcessAccountName, InitiatingProcessFileName, InitiatingProcessCommandLine, SHA256
```

### Sigma

```yaml
title: Django4shell CVE-2026-124827 GDAL Arbitrary File Write Artifacts by Web Worker Account
id: 7c1e5a52-3b0d-4f6e-9a41-0d6f2b7a1001
status: experimental
description: Detects Python startup hooks (sitecustomize.py, usercustomize.py, .pth), script files in static/media directories, Django settings/wsgi/asgi/urls/manage.py/.env files, or GDAL EHdr sidecar files written by a web service account, the post-write outcomes described for the Django4shell GeoDjango RasterField arbitrary file write.
references:
  - https://www.djangoproject.com/weblog/2026/dec/02/security-releases/
  - https://thehackernews.com/2026/12/new-django4shell-vulnerability-enables.html
author: Threadlinqs Team
date: 2026-12-02
modified: 2026-12-02
tags:
  - attack.persistence
  - attack.t1546.018
  - attack.t1505.003
  - attack.impact
  - attack.t1565.001
  - attack.execution
  - attack.t1059.006
  - attack.initial-access
  - attack.t1190
  - cve.2026.124827
logsource:
  product: linux
  category: file_event
detection:
  selection_user:
    User:
      - 'www-data'
      - 'apache'
      - 'nginx'
      - 'django'
      - 'gunicorn'
  selection_hook:
    TargetFilename|endswith:
      - '/sitecustomize.py'
      - '/usercustomize.py'
      - '.pth'
  selection_static_dir:
    TargetFilename|contains:
      - '/static/'
      - '/staticfiles/'
      - '/media/'
  selection_script_ext:
    TargetFilename|endswith:
      - '.py'
      - '.php'
      - '.phtml'
      - '.jsp'
      - '.jspx'
      - '.sh'
      - '.pl'
      - '.cgi'
  selection_config:
    TargetFilename|endswith:
      - '/settings.py'
      - '/local_settings.py'
      - '/wsgi.py'
      - '/asgi.py'
      - '/urls.py'
      - '/manage.py'
      - '/.env'
  selection_gdal:
    TargetFilename|endswith:
      - '.hdr'
      - '.bil'
      - '.flt'
  filter_gdal_benign:
    TargetFilename|contains:
      - '/media/'
      - '/tmp/'
  condition: selection_user and (selection_hook or (selection_static_dir and selection_script_ext) or selection_config or (selection_gdal and not filter_gdal_benign))
falsepositives:
  - Deployments, collectstatic runs or package installs executed under the web service account
  - Applications that legitimately accept script uploads into media directories
level: critical
```

**Known false positives:**

- Package installs or deployments that run as the web service account and legitimately add .pth files to site-packages
- collectstatic or deployment jobs running as the web service account writing scripts under static directories
- Intentional sitecustomize.py in a managed Python environment (e.g. APM agents)

**Tuning notes:** Replace the User list with the real web-worker accounts. Allow-list deployment paths, CI accounts and APM-agent hooks. Run workers with read-only source, static and site-packages directories so any hit is high-fidelity. Requires Sysmon for Linux FileCreate (EventCode 11) covering the project root, site-packages and static dirs.

### 8 more detection rules (Splunk SPL, Microsoft KQL, Sigma), unlock with TL Creds

- Django4shell CVE-2026-124827 - GDAL EHdr Arbitrary File Write Artifacts by Web Worker: Startup Hooks, Web Shells, Source/Config Tampering (Sentinel KQL) (locked: unlock with TL Creds)
- Django4shell CVE-2026-124827 - Staff Admin POST Carrying GDAL EHdr Raster Driver Payload (Sentinel KQL) (locked: unlock with TL Creds)
- Django4shell CVE-2026-124827 - Django Worker Spawning Shell/Download Tool, Reading Secrets or Making Metadata/Shell Egress (Sentinel KQL) (locked: unlock with TL Creds)
- Django4shell CVE-2026-124827 - GDAL EHdr Arbitrary File Write Artifacts by Web Worker: Startup Hooks, Web Shells, Source/Config Tampering (Sigma) (locked: unlock with TL Creds)
- Django4shell CVE-2026-124827 - Staff Admin POST Carrying GDAL EHdr Raster Driver Payload (Sigma) (locked: unlock with TL Creds)
- Django4shell CVE-2026-124827 - Django Worker Spawning Shell/Download Tool, Reading Secrets or Making Metadata/Shell Egress (Sigma) (locked: unlock with TL Creds)
- Django4shell CVE-2026-124827 - Staff Admin POST Carrying GDAL EHdr Raster Driver Payload (Splunk) (locked: unlock with TL Creds)
- Django4shell CVE-2026-124827 - Django Worker Spawning Shell/Download Tool, Reading Secrets or Making Metadata/Shell Egress (Splunk) (locked: unlock with TL Creds)

Sign up free to unlock the detection rules: https://threadlinqs.com/?modal=signup

## Sample indicators (3 of 17)

Defanged, TLP:CLEAR.

- File hash: `a3934abd4c0d43430efec34d6ae933794df2c2f5`
- File hash: `b70d098878ae1a65fa2377be776610500ff44336`
- File hash: `6b5d29eae050ac7cf72cc5a407d2094ad8e83789`

Full set of 17 indicators unlocks with TL Creds: https://threadlinqs.com/tl-creds

## Sources

- [The Hacker News - New Django4Shell Vulnerability Enables Django RCE via GeoDjango Form Validation](https://thehackernews.com/2026/12/new-django4shell-vulnerability-enables.html)
- [Django security releases (Dec 2, 2026)](https://www.djangoproject.com/weblog/2026/dec/02/security-releases/)
- [Django4shell project page](https://django4shell.com/)
- [NVD - CVE-2026-15307](https://nvd.nist.gov/vuln/detail/CVE-2026-15307)
- [Django 5.2.17 release notes](https://docs.djangoproject.com/en/6.1/releases/5.2.17/)
- [Red Hat - CVE-2026-87890](https://access.redhat.com/security/cve/CVE-2026-87890)
- [stack.watch - CVE-2026-87890 Django Remote Request via VRT in Spatial Lookups](https://stack.watch/vuln/CVE-2026-87890/)
- [Red Hat Bugzilla 2511095 - CVE-2026-15307 Remote code execution via GeoDjango spatial lookups](https://bugzilla.redhat.com/show_bug.cgi?id=2511095)

## Full data

The other 8 detection rules (Splunk SPL / Microsoft KQL / Sigma) unlock with TL Creds; a free account includes daily creds: https://threadlinqs.com/?modal=signup
Indicator values unlock with TL Creds, at a lower price on Red and Purple; AI agents can query rules and IOCs through the Threadlinqs MCP server (Purple and Gold in full, 2 calls a day on a free account): https://intel.threadlinqs.com/mcp

Canonical: https://intel.threadlinqs.com/threat/TL-2026-7295
