Django4Shell: How a Staff Login and GeoDjango RasterField Can Lead to Code Execution
CVE-2026-124827 lets a staff user write files via GeoDjango RasterField, risking RCE. Fixed in Django 6.1.4, 6.0.11, 5.2.20. Risk, detection and fixes.
Django4Shell CVE-2026-124827, December 3, 2026: Server-Side File Write in GeoDjango RasterField Assignment, Fixed in Django 6.1.4, 6.0.11 and 5.2.20
Summary: On December 2, 2026 the Django project released Django 6.1.4, 6.0.11 and 5.2.20 to fix seven security issues, as described in the official Django security advisory. The most discussed is CVE-2026-124827, nicknamed Django4Shell. When a GeoDjango model has a RasterField, a user-controlled raster definition assigned to that field can make GDAL write a file to a location of the user's choosing. Depending on the raster driver, Django states this could lead to remote code execution. Because RasterField falls back to a plain CharField form field, the flaw was reachable by default through admin forms, ModelForms and writable model serializers.
Why it matters: this is the third fix in four months for the same family of GDAL-backed raster handling in GeoDjango. CVE-2026-15307 (August) and CVE-2026-87890 (October) closed the spatial-lookup paths, and CVE-2026-124827 closes the field-assignment path that those fixes did not cover. The researcher who reported it describes a path from a form submission by a permitted user to code execution on the next Python process start. That chain is the researcher's description, not an observed attack.
Severity and exploit status: the Django project rates the issue High, and the CVE record carries CNA scores of CVSS 3.1 8.8 and CVSS 4.0 8.7. The researcher and press coverage cite 9.0 Critical, a figure that does not come from the CVE record. No exploitation in the wild has been reported, and the CVE was not in the CISA Known Exploited Vulnerabilities catalog at the time of writing. A researcher-documented chain exists, and educational reproduction material has been published. Django itself publishes no exploit code. The same release also fixes CVE-2026-132092, a SQL injection that Django rates High and that carries CNA scores of CVSS 3.1 9.8 and CVSS 4.0 9.3, both Critical. Upgrade to 6.1.4, 6.0.11 or 5.2.20.
Overview
django.contrib.gis), RasterField assignment. RasterField is implemented on PostGIS only.AV:N/AC:L/PR:L/UI:N| CVE | Component | Django severity | CVSS 3.1 (CNA) | CVSS 4.0 (CNA) | EPSS (Dec 3, 2026) | CISA KEV |
|---|---|---|---|---|---|---|
| CVE-2026-124827 | GeoDjango RasterField assignment | High | 8.8 High | 8.7 High | Not yet published | Not listed |
EPSS is published by FIRST once per day. At the time of writing the most recent dataset is dated December 2, 2026 and contains no entry for this CVE. The value should be checked again after the next daily update.
Why the Severity Rating Differs
Three severity statements circulate for this CVE, and they do not match. The Django project classifies it High under its own security policy. The CVE record, published by the Django Software Foundation as the CVE Numbering Authority (CNA), scores it 8.8 under CVSS 3.1 and 8.7 under CVSS 4.0. The 9.0 Critical figure comes from the researcher and press coverage. SecPod reports the CNA scores as the official record and shows the 9.0 figure for context, without reclassifying either.
The basis for the 9.0 figure is not documented in the CVE record, so SecPod does not offer a definitive explanation for the gap. What the record does show is that the CNA vector includes PR:L, meaning an authenticated, low-privileged user is required. The practical risk is still high where that condition is easy to meet. A compromised account that can submit the affected form is a plausible starting point, and the vulnerable field is exposed by default wherever a RasterField is registered in the admin or in a ModelForm, so no unusual configuration is needed.
Technical Analysis: How the Bug Works
GeoDjango's RasterField stores raster images in PostGIS. When a value is assigned to the field, Django converts it into a GDALRaster, which is a wrapper around the GDAL library. GDALRaster accepts either a file path or a dictionary that describes a raster: its name, its driver, its size and its pixel data. Some GDAL drivers write the raster they are given to disk. That makes the dictionary form dangerous whenever its name or driver comes from an untrusted user, which is the condition the August and October fixes addressed for spatial lookups.
Those earlier fixes closed the lookup path, where a value is passed to a spatial filter such as an admin changelist filter. The assignment path was left open. In that path, a value assigned to a RasterField through a form is converted without the guard that lookups use. The Django advisory describes the result: assigning a raster data definition with a user-controlled name and a non-default driver could make GDAL write a file to an attacker-chosen location.
Reachability is the second half of the problem. RasterField does not define a form field of its own, so Django falls back to the CharField form field. A user who is permitted to access and submit the affected form can therefore type or paste a JSON raster definition into the field's text box. In the default admin that means a staff user with access to the model, so not every staff account necessarily qualifies. Other application-defined ModelForms and writable serializers that include the field have their own access rules, which may be broader or narrower. The researcher notes that the write happens during form validation, before the model is saved, so no database write is needed.
Why a file write becomes code execution
Python imports a module named sitecustomize automatically at interpreter startup if it is found on the module search path, and it processes .pth files placed in site-packages directories. A process that can create or replace such a file in a location the Django worker, a reloader, a cron job or a subprocess will later import from can therefore run its content on the next start. This is a property of how Python starts, not a Django bug. The vulnerability supplies the ability to place the file; the startup mechanism supplies the execution. Overwriting application source files is another way a file write can turn into code execution, and the outcome depends on what the Django process user is permitted to write.
The limit on this path is the filesystem. A deployment where the application user cannot write to the project directory, to site-packages or to any directory on the import path removes the most direct routes to code execution, even though the arbitrary file write itself would still occur in locations the user can write.
What the fix changes
RasterFieldnow defaultseditabletoFalse, so it is excluded fromModelForms and the admin unless a developer explicitly includes it.- Assigning a dictionary or JSON string that names a non-default driver now raises
GDALException. - Code that needs a non-default driver can wrap the definition in
GDALRaster, which marks the value as trusted. Only trusted, application-built definitions should be wrapped this way. - The fix blocks the server-side file write only. Django states that server-side request forgery remains possible if untrusted input reaches a
RasterField, so untrusted values should be validated before use. - Geometry fields are not affected.
RasterFieldis implemented on PostGIS only.
editable=False default and the new GDALException can change behavior in applications that legitimately accept raster uploads or definitions through forms. Test those workflows in staging before the upgrade reaches production.Three Fixes in Four Months: Patch History and Timeline
The Django advisory and the researcher's disclosure describe CVE-2026-124827 as the last step in a series. Each fix closed one way of getting untrusted input into GDALRaster, and each left a neighbouring path open. The series is a patch history, not an attack chain; the three issues are separate and each is fixed independently by upgrading.
| Date | Event |
|---|---|
| August 4, 2026 | Django 6.0.8 and 5.2.17 fix CVE-2026-15307, a server-side file write and request forgery through spatial lookups (High). See the August advisory. |
| October 6, 2026 | Django 6.1.2, 6.0.9 and 5.2.18 fix CVE-2026-87890, an incomplete fix for CVE-2026-15307 that allowed SSRF through crafted VRT payloads in byte values (Moderate). See the October advisory. |
| December 2, 2026 | Django 6.1.4, 6.0.11 and 5.2.20 are released. CVE-2026-124827 is disclosed and fixed together with six other issues. See the December advisory. The researcher publishes the Django4Shell write-up the same day. |
| December 3, 2026 | Press coverage appears. EPSS for the CVE is not yet published. |
Exploit Maturity, PoC Status and Active Exploitation
The evidence for this CVE falls into different categories, and they should not be conflated.
| Evidence category | Status | Basis |
|---|---|---|
| Vendor-documented proof of concept | No | The Django advisory describes the flaw and the fix. It does not publish a reproduction procedure or exploit code. |
| Researcher-documented attack chain | Yes | The discoverer's write-up on the researcher's disclosure page describes the path from a form submission to a planted startup file, including the preconditions. |
| Publicly released reproduction material | Yes, educational | An educational lab that reproduces the chain in a controlled environment has been released publicly. It is described as non-destructive and tied to a specific Django release in the vulnerable range. SecPod does not link to or reproduce it. |
| Exploitation in the wild | Not reported | No vendor, researcher or government source reports exploitation attempts. |
| CISA Known Exploited Vulnerabilities | Not listed | Not in the catalog at the time of writing. |
| EPSS | Not yet published | The latest FIRST dataset is dated December 2, 2026 and has no entry for this CVE. |
A reproduction in a lab shows the chain is practical against an unpatched, default configuration. It does not show that attackers are using it. Because the vulnerable surface is the default admin, recheck this status after each EPSS and KEV update rather than assuming it stays unchanged.
Post-Exploitation
The outcomes below are the impacts the researcher and the Django advisory describe as possible. None has been observed in an attack.
- Execution of attacker-supplied Python code with the privileges of the Django process user at the next interpreter start, through a planted
sitecustomize.pyor.pthfile. - Overwriting application source or configuration files that the process user can write.
- Reading secrets available to the process, such as environment variables and database credentials, once code is running.
- Using the application host as a pivot into networks it can reach, including the database that holds PostGIS data.
MITRE ATT&CK
No specific MITRE ATT&CK techniques are established from the reviewed evidence, because no exploitation has been observed and the vendor advisory does not describe attacker behavior. SecPod does not map the researcher's hypothetical chain to tactics.
Other Vulnerabilities Addressed in the December 2026 Release
The same release fixes six other issues. Django classifies each under its own severity policy, while the CNA publishes CVSS scores that can rate an issue differently. Both are shown below because they disagree for the most serious of the six.
CVE-2026-132092 is a potential SQL injection in the range and in lookups. Django rates it High, while the CNA scores it CVSS 3.1 9.8 and CVSS 4.0 9.3, both Critical, with a network vector and no privileges or user interaction required. Django describes the trigger as queries that involve aliases or key transforms containing percent signs, so real-world exposure depends on whether an application builds such queries, not simply on running an affected version. It sits in the core query layer, so teams that do not use GeoDjango still have a reason to upgrade in the same window. Two of the seven issues, CVE-2026-124827 and CVE-2026-132809, are in GeoDjango code, so a team without GeoDjango is not exposed to those two.
For CVE-2026-124827 itself, the closest thing to a chain is the residual SSRF noted in the advisory. An upgraded system that still passes untrusted input into a RasterField can still be made to send requests, so the upgrade should be paired with input validation. A separate compromise path is also worth considering: the flaw needs a valid, permitted user session, which could come from any unrelated weakness such as credential reuse or phishing.
Affected Versions and Patch
| Django branch | Status for CVE-2026-124827 | Fixed release |
|---|---|---|
| 6.1 | Affected before 6.1.4 | 6.1.4 |
| 6.0 | Affected before 6.0.11 | 6.0.11 |
| 5.2 (LTS) | Affected before 5.2.20 | 5.2.20 |
| Django main (development) | Listed as affected in the advisory | Use a current main build |
| 5.1, 5.0, 4.2 and older | Not evaluated by Django because they are unsupported. They may be affected and receive no fix. | None. Move to a supported branch. |
The patch is a Django upgrade within the same branch, documented in the Django 6.1.4 and Django 5.2.20 release notes and the security advisory. Applications that import django.contrib.gis should confirm the installed Django version in every environment, including container base images, virtual environments inside build artifacts and vendored copies, because the vulnerable code lives in the installed Django package rather than in the application. Applications using RasterField should then test raster upload and assignment workflows, since the editable=False default and the new GDALException can change their behavior.
Indicators of Compromise
The Django project and the researcher publish no indicators of compromise, and no exploitation has been observed, so there are no confirmed IOCs. The artifacts below are derived from the researcher's description of the chain and are suitable for hunting, not for confirmation of compromise.
- New or modified
sitecustomize.py,usercustomize.pyor.pthfiles in the project directory, in site-packages or on the Python module path of any environment that runs Django. - Files with raster companion extensions such as
.hdror.prj, or raw pixel files, in locations that never hold raster data, such as the project root, application packages or the web root. - Application source, settings or template files whose modification time falls between two deployments without a matching release.
- Admin or form submissions in which a raster field contains JSON-like text that names a driver or a file path instead of an uploaded or encoded raster.
- After a suspicious change, Python worker processes that spawn unexpected children or make outbound connections they have never made before.
Detection and Monitoring
The most reliable detection is at the filesystem and the form layer, because the exploit is a legitimate-looking POST from a valid staff session that results in a file appearing where it should not.
- File integrity monitoring. Watch the application directory, site-packages and any directory on the Python path for new, modified or deleted files. Alert specifically on
sitecustomize.py,usercustomize.pyand.pthcreation, since these have few legitimate reasons to change outside a deployment. - Application logging. Record admin change-form submissions with the user, the model and the field names, and review submissions that touch raster fields for unusually long or structured values. Do not log full field contents where they may hold sensitive data.
- Authentication review. Review staff and other privileged sign-ins for new locations, new devices and off-hours activity, and review which staff accounts hold change permissions on models with raster fields. The attack needs a valid, permitted user session, so its precursors are account-level.
- Process and network behavior. On application hosts, alert on shells or interpreters launched by the web server user and on new outbound connections from application workers, especially after a configuration or file-integrity alert.
- Version inventory. Query every host and image for the installed Django version and for use of
django.contrib.gis, so that the exposed population is known rather than estimated.
Risk Assessment
The risk depends on whether the application uses GeoDjango rasters and who can reach the field. The qualitative ratings below are SecPod's assessment from the published evidence. They are not probabilities or time-to-exploit estimates.
| Scenario | Rating | Reason |
|---|---|---|
| GeoDjango with a RasterField exposed in the admin or a ModelForm, unpatched | Critical for the environment | Default exposure, low privilege required, no user interaction, file write that can become code execution; public educational reproduction material exists |
| GeoDjango with a RasterField excluded from forms and serializers, unpatched | High | The default form path is closed, but a later code change or an additional serializer can reopen it |
| Django without GeoDjango rasters, unpatched | High to Critical, driven by other CVEs | CVE-2026-124827 does not apply. The same release fixes CVE-2026-132092, a SQL injection that Django rates High and the CNA scores Critical under CVSS (3.1 9.8, 4.0 9.3). Actual exposure depends on whether queries use aliases or key transforms containing percent signs in range or in lookups. |
| Patched, with untrusted input still reaching a RasterField | Moderate | The file write is blocked, but SSRF remains possible per the advisory |
| Unsupported Django branch with GeoDjango rasters | Critical for the environment | No fix is issued and the branch was not evaluated; the upgrade path is a branch change |
Remediation
ModelForms and writable serializers, or set editable=False on the field, which is what the patch does by default. Restrict the Django admin to trusted networks or a VPN, and limit access to forms and permissions on models with raster fields to the people who need them.GDALRaster only when the application itself built it. The patch does not stop server-side request forgery from untrusted values, so validation is still required.django.contrib.gis, the Django branch each runs, and whether the admin is reachable from the internet. Three fixes in four months for the same code family make this inventory worth keeping current.SecPod Coverage
SecPod's SCAP content tracks the Django advisories below. The links open the vulnerability records in the SecPod SCAP repository.
| CVE | Issue | Django severity |
|---|---|---|
| CVE-2026-124827 | Server-side file write via RasterField assignment | High |
| CVE-2026-132092 | Potential SQL injection in range and in lookups | High (CNA CVSS 9.8 / 9.3 Critical) |
| CVE-2026-115868 | Potential XSS in truncatechars_html | Moderate |
| CVE-2026-125673 | Potential cache poisoning via dot segments in request paths | Low |
| CVE-2026-119642 | Information leakage in admin changelist via pk alias | Low |
| CVE-2026-127929 | Information leakage in admin changelist via reverse relations | Low |
| CVE-2026-132809 | Heap buffer overflow in OGRGeometry.wkb | Low |
Key Takeaways
- CVE-2026-124827 is a High-severity (CNA CVSS 3.1 8.8, 4.0 8.7) server-side file write in GeoDjango's
RasterFieldassignment path, fixed in Django 6.1.4, 6.0.11 and 5.2.20 on December 2, 2026. The 9.0 Critical figure comes from the researcher and press coverage. - It is reachable by default through admin forms,
ModelForms and writable serializers, and needs an authenticated user who is permitted to submit the affected form, which in the default admin is a staff user with access to the model. It affects only deployments that use GeoDjango with aRasterFieldon PostGIS. - The evidence is a researcher-documented chain and educational reproduction material, with no vendor-documented PoC. No exploitation in the wild is reported, the CVE is not in CISA KEV, and EPSS is not yet published.
- This is the third fix in four months for raster handling in GeoDjango, after CVE-2026-15307 and CVE-2026-87890. The patch blocks the file write but does not stop SSRF from untrusted raster input, so input validation is still needed.
- The same release fixes CVE-2026-132092, a SQL injection in core
rangeandinlookups that Django rates High and the CNA scores Critical (CVSS 3.1 9.8, 4.0 9.3), so teams without GeoDjango should upgrade in the same window. - Read-only deployments, restricted admin access and multi-factor authentication reduce the impact of this class of flaw.
Django4Shell is a small bug in a niche field with an outsized exposure pattern: a default form fallback, a library that can write files, and Python's startup behavior combine into a path from a permitted user's form submission to code execution. Upgrading Django closes the write, and making code locations read-only to the application user limits what the next similar flaw can do.
Instantly Fix Risks in Endpoints & Cloud with Saner
Saner is a continuous and integrated vulnerability & exposure management platform that instantly fixes risks in endpoints and cloud.
Featured Posts

CVE Research
HPE Patches 12 Critical Vulnerabilities in Networking Central On-Premises, Including Two CVSS 10.0 Flaws
HPE has patched 12 Critical vulnerabilities in Networking Central On-Premises, including two CVSS 10.0 hard-coded credential flaws. Explore authentication bypass, privilege escalation, command injection, affected versions, exploitation requirements, and security fixes.

CVE Research
Critical RabbitMQ OAuth2 Authentication Bypass Could Grant Admin Access: November 30, 2026
A critical RabbitMQ OAuth2 vulnerability rated 9.1 allows unauthorized privileged token issuance in affected management configurations. Explore technical analysis, security risks, affected versions, exploitation evidence, available security patches and recommended remediation strategies.


