Skip to navigation

Threat reportVulnerabilityTL-2026-7303

Django4Shell (CVE-2026-124827): GeoDjango RasterField Arbitrary File Write Enabling Remote Code Execution

criticalACTIVE

CVE-2026-124827 ("Django4Shell") is a server-side arbitrary file-write flaw in GeoDjango's RasterField (PostGIS only). A staff-level user can supply crafted raster JSON with a user-controlled name and a non-default GDAL driver to make GDAL write attacker-controlled content to an attacker-chosen path, which can lead to remote code execution.

By

Key facts

IdentifiersTL-2026-7303, CVE-2026-124827, CVE-2026-87890, CVE-2026-15307, CVE-2026-1207
Also known asDjango4Shell
SeverityCRITICAL
CVSS9
First disclosed
Exploitation statusPublic proof-of-concept exploit for a linked CVE
EPSSCVE-2026-15307: 1.1% (65.5th percentile); CVE-2026-87890: 0.2% (21.3th percentile)
Affected productsDjango Software Foundation Django (GeoDjango RasterField, PostGIS backend)
MalwareDjango, Python
ToolsGDAL EHdr driver
MITRE ATT&CK techniquesT1059.006 Command and Scripting Interpreter: Python, T1078 Valid Accounts, T1190 Exploit Public-Facing Application, T1505.003 Server Software Component: Web Shell, T1546.018 Event Triggered Execution: Python Startup Hooks, T1565.001 Data Manipulation: Stored Data Manipulation
MotivationUNKNOWN
Target sectorstechnology, government administration, news - media, geospatial
Target regionsGlobal
Detection rules9 (1 shown free)
Sources7 cited sources

Detection coverage

As of 2026-12-02, Threadlinqs Intelligence publishes 9 detection rule(s) for TL-2026-7303 across Splunk SPL, Microsoft KQL and Sigma, covering 10 indicator(s) of compromise. The whole corpus is readable without an account. Every threat comes with one complete detection in Splunk SPL, Microsoft KQL and Sigma, free for everyone; a free account adds daily TL Creds to unlock the rest. Paid plans add a larger daily allowance, correlation and the MCP server. Threadlinqs MCP server · View plans.

Free detection: Django4Shell CVE-2026-124827 - Django/WSGI Worker Writes Python Startup Hook (sitecustomize.py / .pth)

Detects a Django/WSGI/ASGI application process (python, gunicorn, uwsgi, daphne, uvicorn, hypercorn) creating sitecustomize.py, usercustomize.py or a site-packages .pth file. This is the documented post-write RCE path for the GeoDjango RasterField arbitrary file write (CVE-2026-124827, Django4Shell, GDAL EHdr driver), where the written file executes at the next interpreter start or fork. A web application worker has no legitimate reason to create these files. Telemetry assumption: Sysmon for Linux file-create events (EventID 11).

  • Languages: Splunk SPL, Microsoft KQL, Sigma
  • ATT&CK: T1190, T1546.018
  • Data sources: sysmon_for_linux (index=linux sourcetype=sysmon:linux EventID=11), DeviceFileEvents (Microsoft Defender for Endpoint on Linux)
  • Severity: critical
  • Confidence: high

Splunk SPL

index=linux sourcetype="sysmon:linux" EventID=11 earliest=-24h
```Django4Shell CVE-2026-124827 - app worker dropping a Python startup hook (T1546.018)```
| where match(Image, "/(python[0-9.]*|gunicorn|uwsgi|daphne|uvicorn|hypercorn)$")
| where match(TargetFilename, "(?i)/(sitecustomize|usercustomize)[.]py$") OR match(TargetFilename, "(?i)/(site|dist)-packages/[^/]+[.]pth$")
| stats count min(_time) as first_seen max(_time) as last_seen values(TargetFilename) as files values(User) as users by Computer Image
| eval first_seen=strftime(first_seen, "%F %T"), last_seen=strftime(last_seen, "%F %T")
| table Computer Image users files count first_seen last_seen

Microsoft KQL

DeviceFileEvents
| where Timestamp > ago(24h)
| where ActionType in ('FileCreated', 'FileModified', 'FileRenamed')
| where InitiatingProcessCommandLine has_any ('gunicorn', 'uwsgi', 'daphne', 'uvicorn', 'hypercorn')
| where FileName in~ ('sitecustomize.py', 'usercustomize.py') or (FileName endswith '.pth' and (FolderPath contains 'site-packages' or FolderPath contains 'dist-packages'))
| project Timestamp, DeviceName, ActionType, FolderPath, FileName, InitiatingProcessAccountName, InitiatingProcessFileName, InitiatingProcessCommandLine, SHA256
| order by Timestamp desc

Sigma

title: Django4Shell - Application Worker Writes Python Startup Hook
id: 3f2a9c1e-7b64-4d1a-9e0b-5a1c2d3e4f01
status: experimental
description: Detects a Django/WSGI/ASGI worker process creating sitecustomize.py, usercustomize.py or a site-packages .pth file, the documented post-write RCE path for CVE-2026-124827 (Django4Shell, GeoDjango RasterField arbitrary file write).
references:
  - https://www.djangoproject.com/weblog/2026/dec/02/security-releases/
  - https://orca.security/resources/research/django4shell-cve-2026-124827-critical-geodjango-rasterfield-flaw-enables-remote-code-execution/
author: Threadlinqs Team
date: 2026-12-02
tags:
  - attack.initial-access
  - attack.t1190
  - attack.persistence
  - attack.privilege-escalation
  - attack.t1546.018
  - cve.2026.124827
logsource:
  product: linux
  category: file_event
detection:
  selection_proc:
    Image|re: '/(python[0-9.]*|gunicorn|uwsgi|daphne|uvicorn|hypercorn)$'
  selection_startup:
    TargetFilename|re: '(?i)/(sitecustomize|usercustomize)[.]py$'
  selection_pth:
    TargetFilename|re: '(?i)/(site|dist)-packages/[^/]+[.]pth$'
  condition: selection_proc and (selection_startup or selection_pth)
falsepositives:
  - Deployment or package installation run through a python interpreter under the same account as the web worker
  - Management commands that install packages from within the application environment
level: critical

Known false positives:

  • pip or deployment tooling executed as the same service account as the web worker
  • Legitimate package that ships a .pth file installed by an application-level update job

Tuning notes: Adjust index, sourcetype and the EventID field name (EventID vs EventCode) to match your Sysmon for Linux ingestion. Exclude the deploy account or CI hosts that legitimately run pip under a python image. If workers run under a distinct service user, add a User filter to tighten. Treat any hit as high priority, then check Django version against 6.1.4 / 6.0.11 / 5.2.20 and review recent admin POSTs.

8 more detection rules (Splunk SPL, Microsoft KQL, Sigma) · unlock with TL Creds. Sign up free to unlock the detection rules or query them with the Threadlinqs MCP server (Purple and Gold in full, 2 calls a day on a free account)
  • Django4Shell CVE-2026-124827 - Django Worker Writes Application Source or Config ([indicator], .py, .env) · unlock with TL Creds
  • Django4Shell CVE-2026-124827 - Django Worker Spawns Shell, Downloader or Recon Tooling · unlock with TL Creds
  • Django4Shell CVE-2026-124827 - Django Worker Outbound Connection to Public IP on Non-Web Port · unlock with TL Creds
  • Django4Shell CVE-2026-124827 - Django Worker Writes Script Content Into Static Directory (Web Shell) · unlock with TL Creds
  • Django4Shell CVE-2026-124827 - Web Shell Access Pattern in Django Static Directory · unlock with TL Creds
  • Django4Shell CVE-2026-124827 - Python One-Liner Reverse Shell (socket + pty/dup2/shell) · unlock with TL Creds
  • Django4Shell CVE-2026-124827 - Rare [indicator] / site-packages .pth Creation Outside Package Managers · unlock with TL Creds
  • Django4Shell CVE-2026-124827 - RasterField Exploit Payload (Non-Default GDAL Driver + Raster Name) in Form or API Request Body · unlock with TL Creds

Indicators of compromise

As of 2026-12-02, Threadlinqs Intelligence tracks 10 indicators of compromise for TL-2026-7303.

10 indicators of compromise · unlock with TL Creds. Compare plans

Technical analysis

It is an incomplete fix for CVE-2026-87890 and is fixed in Django 6.1.4, 6.0.11 and 5.2.20.

CVE-2026-124827 was disclosed in the Django security release of 2026-12-02 (post titled "Server-side file-write via RasterField assignment", credited to reporter Mohammed Fathy) and branded "Django4Shell" by Orca Security. Assigning a raster data definition to a RasterField with a user-controlled name and a non-default GDAL driver can cause GDAL to write a file to an attacker-controlled location. Depending on the driver, this can lead to remote code execution. RasterField is implemented only on the PostGIS backend; geometry fields are not affected.

Reachability: in common configurations RasterField falls back to the CharField form field, so the flaw is reachable wherever RasterField is exposed through the Django admin, ModelForms, or writable model serializers. Orca reports that exploitation needs staff-level authentication, that the attacker controls target path, file content and filename, and that it does not require database interaction or a call to model.save(). Orca names the EHdr GDAL driver as near-universal in GeoDjango deployments. Orca states a proof of concept is publicly available through the researcher's disclosure; no in-the-wild exploitation is reported in the sources reviewed.

Post-write RCE paths described by Orca: writing sitecustomize.py in the working directory (executed at interpreter startup on the next reload or fork), dropping .pth files into site-packages, overwriting application source code, planting web shells in static directories, and corrupting configuration files.

This is the third fix for the same attack surface: CVE-2026-15307 (GeoDjango spatial lookups parsed the right-hand-side value as a raster via GDALRaster, patched August 2026) was incompletely fixed by CVE-2026-87890 (October 2026), which was in turn incompletely fixed by CVE-2026-124827. An earlier, distinct RasterField issue, CVE-2026-1207 (SQL injection via band index in RasterField lookups), was fixed in February 2026.

Severity note: Orca rates the issue 9.0 Critical; the Django project rates it high. No CVSS vector or CWE was published in the sources reviewed, so neither is recorded here. The same Django release also fixes CVE-2026-132092 (SQL injection in range/in lookups, High), CVE-2026-115868 (XSS in truncatechars_html), CVE-2026-125673 (cache poisoning via dot segments), CVE-2026-119642 and CVE-2026-127929 (admin information leaks) and CVE-2026-132809 (heap buffer overflow in OGRGeometry.wkb). The NVD page for this CVE could not be retrieved and independent search engines did not index the CVE ID at research time, so the Django project post and Orca article are the only primary sources.

MITRE ATT&CK techniques by tactic:

Execution

T1059.006 Command and Scripting Interpreter: Python

Initial Access

T1078 Valid Accounts; T1190 Exploit Public-Facing Application

Persistence

T1505.003 Server Software Component: Web Shell; T1546.018 Event Triggered Execution: Python Startup Hooks

Privilege Escalation

T1546.018 Event Triggered Execution: Python Startup Hooks

Impact

T1565.001 Data Manipulation: Stored Data Manipulation

Remediation

Patches

  • Django 6.1.4
  • Django 6.0.11
  • Django 5.2.20

Immediate actions

  • Upgrade Django to 6.1.4, 6.0.11 or 5.2.20 depending on release branch
  • Restrict Django admin access and review staff and superuser accounts
  • Hunt for unexpected sitecustomize.py and .pth files and for web shells in static directories
  • Clear caches after upgrading (cache poisoning fix in the same release)

Workarounds

  • Do not expose RasterField through admin, ModelForms or writable serializers (the fix sets editable=False by default)
  • Reject dict or JSON raster input that specifies a non-default GDAL driver

Longer-term hardening

  • Validate all raster input and wrap only trusted values in GDALRaster
  • Run Django application processes with read-only code and site-packages directories
  • Monitor for anomalous file writes by the application process

Affected and fixed versions

  • Django Software Foundation — Django (GeoDjango RasterField, PostGIS backend)
    Vulnerable versions: main; 6.1.x before 6.1.4; 6.0.x before 6.0.11; 5.2.x before 5.2.20
    Fixed in: 6.1.4; 6.0.11; 5.2.20

Timeline

  • Earlier distinct RasterField issue CVE-2026-1207 (SQL injection via band index) fixed in Django 6.0.2, 5.2.11 and 4.2.28 (month approximate per search summaries).
  • CVE-2026-15307 (GeoDjango spatial lookups parsed right-hand-side values as rasters via GDALRaster, leading to RCE) patched in Django 5.2.17 and 6.0.8.
  • CVE-2026-87890, an incomplete fix for CVE-2026-15307, patched (month per Orca; exact day not stated).
  • Threadlinqs hunt identifies the threat; no in-the-wild exploitation reported in the reviewed sources.
  • Orca Security publishes the Django4Shell analysis, rating the flaw 9.0 Critical and noting that PoC details are public via the researcher's disclosure.
  • Django releases 6.1.4, 6.0.11 and 5.2.20 fixing CVE-2026-124827 along with CVE-2026-132092 and five lower-severity issues.

Sources cited

AI-drafted from 7 cited sources; published ; last updated —.

Threadlinqs Intelligence — Real-Time Threat Detection Platform

// threat_feed
$ sort --newest
Showing all threats

Live intelligence console

Threat level

Latest Threats