Django4Shell CVE-2026-124827 is a GeoDjango RasterField file write flaw that can become remote code execution when untrusted raster input reaches the wrong form, serializer, or admin path. This guide gives SRE teams the exposure test, patch order, audit commands, stopgap, container rebuild steps, and detection signals needed to close the issue without overstating the blast radius.
What Is Django4Shell CVE-2026-124827 in Production Terms?
Django4Shell is the public name for CVE-2026-124827, a GeoDjango RasterField file write flaw fixed on 2 December 2026. A user controlled raster name and non default driver could make GDAL write to an attacker chosen path. Depending on the driver and writable paths, that write can become remote code execution.
Django4Shell is not a flaw in every Django view, template, or ORM query. The vulnerable surface is narrow and specific: a GeoDjango model that declares django.contrib.gis.db.models.RasterField, running on PostGIS, with a path that lets less trusted input reach that field. Django fixed the issue on 2 December 2026 in Django 6.1.4, 6.0.11, and 5.2.20, and rated it high under the Django security policy. The CVE record scores it 8.8 under CVSS 3.1, while some vendor summaries round the story into a louder critical headline. For an SRE response, the useful number is not the headline score. The useful question is whether your service combines the vulnerable version, the field, the input path, and a file writing GDAL driver in one reachable request flow.
The mechanism is a trust boundary failure between form input handling and GDAL raster parsing. A raster data definition can carry a name and a driver. When those values come from user input, GDAL may treat the definition as an instruction to create a raster file instead of a passive value to store. Django now blocks that assignment pattern in two ways: RasterField defaults to editable=False, and assigning a dict or JSON string with a non default driver raises GDALException. Trusted code can still wrap a definition in GDALRaster, which makes the trust decision explicit in code review.
| Question | Production answer |
|---|---|
| Is every Django app exploitable through Django4Shell? | No. The RCE path needs GeoDjango, PostGIS, a RasterField model, untrusted input reaching the field, and a driver plus writable path that can turn the write into code execution. |
| Should every Django app patch? | Yes. The same security release also fixes a core SQL injection, so version based patching still applies even when RasterField is absent. |
| Is this the same pattern as other shell class flaws? | The name invites comparison, but the preconditions differ. Our React2Keys and React2Shell SRE response guide covers a broader unauthenticated pattern, while Django4Shell needs a much narrower application shape. |
Treat Django4Shell as a patch first, argue later incident for GeoDjango services. For non GeoDjango services, treat the release as a normal urgent security upgrade and spend the saved time checking the SQL injection pattern covered later in this guide.
The 970+ Incident Handbook & K8s Runbooks are exclusive to subscribers — unlock for FREE
Get battle-tested production runbooks, AWS architecture blueprints, and zero-downtime CI/CD post-mortems sent directly to your inbox. 100% free, no spam.
Which Django Apps Are Exposed to Django4Shell?
A Django app is exposed to Django4Shell when it runs an unfixed supported version and stores raster data through RasterField on PostGIS. Exposure becomes practical when admin forms, ModelForms, or writable serializers accept raster values from users who should not control server file paths or GDAL driver choices.
Start with versions, then narrow the result by code shape and runtime configuration. Django 6.1 before 6.1.4, Django 6.0 before 6.0.11, and Django 5.2 before 5.2.20 are the supported affected ranges. Django did not evaluate the unsupported 5.1, 5.0, and 4.2 series for this issue, and those lines receive no fix. That unsupported caveat matters for old internal tools that still run GeoDjango behind a VPN and never joined the normal upgrade train. The safe operational answer for those systems is an upgrade to a supported branch, with RasterField input locked down during the migration window.
The second filter is the field itself, because RasterField exists only on the PostGIS backend, and geometry fields such as PointField or PolygonField were not affected by this CVE. A mapping service that stores only points, lines, and polygons does not carry the Django4Shell RCE path. A service that stores satellite tiles, elevation grids, weather rasters, land parcel imagery, or agricultural raster layers deserves a closer look because those domains are where RasterField tends to appear.
The third filter is reachability through real request and job paths. Before the fix, RasterField fell back to a character form field, so registered admin models, ModelForms, and writable serializers could accept a raster definition as text by default. Django's CVSS scoring treats required privileges as low, which usually means an authenticated user rather than an anonymous internet visitor. Staff access is still a meaningful boundary in production because staff accounts get phished, contractors keep access longer than planned, and internal tools often expose admin surfaces to wider employee groups than the threat model assumes.
Use this exposure table during triage:
| Service shape | Django4Shell posture | First action |
|---|---|---|
| No GeoDjango installed | Not exposed to the RasterField path | Patch Django for the same release SQL injection and other fixes |
| GeoDjango with geometry fields only | Not exposed to this CVE | Patch, then confirm no RasterField exists in migrations or models |
| RasterField exists, input only from trusted jobs | Lower practical risk | Patch first in the queue and review job input validation |
| RasterField reachable through admin, forms, or serializers | Highest priority | Restrict the input path, patch, rebuild images, and review worker file writes |
The table keeps the response honest. It also prevents two common errors: paging every Django owner as if the sky fell, and dismissing the CVE because the average Django blog does not use PostGIS rasters.
Why Did the August GDAL Fix Leave Django4Shell Open?
The August 2026 fix closed spatial lookup values that reached GDALRaster, and the October 2026 fix closed byte values that could carry external raster references. Django4Shell survived because model field assignment still accepted raster definitions. The December fix closes that assignment path and makes RasterField non editable by default.
Django4Shell is the third round of one GDAL trust problem. On 4 August 2026, Django 6.0.8 and 5.2.17 fixed CVE-2026-15307, where spatial lookups passed string and dict values into GDALRaster. That fix rejected dict values and strings that were not valid geometry in lookups, because a lookup value could open a raster in write mode or trigger an outbound request through GDAL virtual file system handlers. The August advisory still left model field assignments accepting those input types, on the premise that application code validates what it assigns.
On 6 October 2026, Django 6.1.2, 6.0.9, and 5.2.18 fixed CVE-2026-87890. That issue covered raster values supplied as bytes to spatial lookups. The bytes could contain a VRT document referencing an external raster source, so GDAL could issue network requests as the Django process user while preparing the lookup. Django described that case as overlooked in the August fix and required bytes to be wrapped in GDALRaster before use in spatial lookups.
December closes the remaining door by guarding the assignment path into RasterField. CVE-2026-124827 sits on assignment to RasterField, where a raster definition with a user controlled name and a non default driver could make GDAL write a file. The pattern is familiar to anyone who has reviewed parser hardening work: the sink stayed the same, while the guarded caller changed. A lookup gate protects queries, while an assignment gate protects forms, serializers, imports, and admin edits, and Django4Shell exists because the second gate arrived later than the lookup protections.
For platform teams, the lesson is wider than GeoDjango. When a framework patch says one input path is now safe, ask which sibling paths reach the same sink. Search for every constructor, parser, deserializer, and file format handler that accepts the same untrusted shape. Our Ruby2Shell version guide shows the same operational habit from another ecosystem: version lists help, but path analysis decides whether the patch story is complete.
How Fast Should Teams Patch Django4Shell CVE-2026-124827?
Patch Django4Shell immediately when a service uses RasterField with any user influenced input path. Upgrade to Django 6.1.4, 6.0.11, or 5.2.20, rebuild images, and redeploy workers as well as web processes. Services without RasterField still patch promptly because the same release fixes a separate SQL injection flaw.
Patch order should follow reachability, not team convenience, during the first response window. Put GeoDjango services with RasterField and writable input paths at the front of the queue. Put GeoDjango services with trusted raster ingestion next, because trusted pipelines have a habit of growing a web form later. Put every other Django service in the same release train, since the December release also fixes CVE-2026-132092, a SQL injection in range and in lookups under specific alias and key transform conditions.
Use the fixed versions as hard gates in CI:
python -m django --version
pip show django
python - <<'PY'
import django
print(django.get_version())
PY
For containerised services, check the image that will run in production, not the laptop environment that produced the lock file:
docker run --rm --entrypoint python your-registry/your-django-app:current -m django --version
A practical patch sequence looks like this. First, inventory Django versions across services, workers, cron jobs, and one off management commands. Second, grep for RasterField and django.contrib.gis to split the fleet into RCE relevant and patch only groups. Third, upgrade the RCE relevant group, rebuild images, and roll web and worker processes together so old workers do not keep serving traffic with the vulnerable library. Fourth, run the same upgrade through the rest of the Django fleet and clear caches where the release notes require cache attention for other fixes.
Do not let a green dependency scanner close the ticket by itself. Scanners often report version ranges without proving whether the running image changed. The closeout evidence should name the deployed image digest, the Django version inside that image, and the service revision that reached production.
How Do You Audit Django4Shell CVE-2026-124827 Exposure in Code and Images?
Audit Django4Shell by checking the running Django version, searching models and migrations for RasterField, and tracing every form, admin registration, serializer, import job, and API endpoint that can write that field. Finish by checking deployed images and worker processes, because source fixes do not patch running containers by themselves.
Run the audit from the outside in so production evidence leads the investigation. Start with the deployed version, then move to code, then move to input paths. That order prevents a common false negative where the repository looks patched while production still runs an older image built before the dependency update landed.
python -m django --version
grep -rn "RasterField" --include='*.py' .
grep -rn "django.contrib.gis" --include='*.py' .
grep -rn "GDALRaster" --include='*.py' .
For each model that declares RasterField, answer four questions in writing. Which database backend stores the model, and is it PostGIS? Which users can create or update rows through the admin, a ModelForm, a serializer, an import command, or a background task? Does any code assign request data, uploaded JSON, or third party payloads to the field without a validation layer? Which GDAL drivers are installed in the runtime image, and which directories can the web or worker user write to?
Serializer review deserves special care because generated write surfaces hide in plain sight. A writable serializer that exposes all model fields can turn a harmless looking API into a RasterField write path. The same applies to admin registrations that rely on generated forms. Before the December fix, generated forms accepted raster definitions as text because the field fell back to a character form field. After the fix, the field is non editable by default, so forms should stop showing it unless a trusted workflow adds it back deliberately.
Record the audit result per service:
| Audit item | Evidence to keep |
|---|---|
| Django version in production | Image digest plus python -m django --version output from the running image |
| RasterField presence | Grep output across models and migrations, with model names listed |
| Input paths | Admin, form, serializer, import, and task endpoints that can write the field |
| Runtime write surface | Directories writable by the Django process user and GDAL drivers present |
| Patch state | Deployed revision, rollout time, and worker restart confirmation |
Keep the audit evidence with the change record rather than scattering it across chat threads and scanner exports. A future responder should be able to reopen the ticket and see which services carried RasterField, which input paths were reviewed, which image digests replaced the vulnerable builds, and which worker pools restarted onto the fixed code. That evidence turns a vague security ticket into an auditable production change. It also gives the next engineer a map when a similar parser sink appears in another framework release.
What Stopgap Reduces Django4Shell Risk Before the Upgrade?
Before the upgrade lands, set editable=False on every RasterField, remove the field from admin forms and writable serializers, and stop assigning untrusted input to raster fields. Treat the stopgap as a short bridge to Django 6.1.4, 6.0.11, or 5.2.20, because validation mistakes can reopen the same GDAL trust boundary.
Django does not publish a separate workaround that replaces the upgrade. The practical stopgap mirrors the fix: make RasterField non editable, keep it out of generated forms, and refuse untrusted raster definitions until the patched version is deployed. That stopgap reduces the easiest reachability paths while the release moves through staging and production.
A minimal model change looks like this:
from django.contrib.gis.db import models
class ElevationTile(models.Model):
rast = models.RasterField(editable=False)
For admin and serializer surfaces, exclude the field explicitly instead of relying on memory:
class ElevationTileAdmin(admin.ModelAdmin):
exclude = ("rast",)
class ElevationTileSerializer(serializers.ModelSerializer):
class Meta:
model = ElevationTile
fields = ("id", "name", "created_at")
Trusted ingestion code needs a clearer contract. Parse and validate raster metadata in a dedicated service function, reject unexpected drivers, reject path like names, and wrap trusted definitions in GDALRaster only after validation succeeds. Keep the validation close to the assignment site so reviewers can see the trust decision without hunting through layers of form code.
The stopgap has limits that should stay visible in the incident ticket. It does not fix the SQL injection in the same release. It does not make old unsupported Django branches safe. It also does not remove server side request forgery risk when untrusted input still reaches RasterField, a caveat Django keeps in the advisory after the file write fix. Use the stopgap to buy hours or days, then finish the upgrade and rebuild.
How Do Containers Change Django4Shell Patching?
Containers change Django4Shell patching because upgrading a laptop or lock file does not change the Django version inside a running image. Teams must rebuild images with Django 6.1.4, 6.0.11, or 5.2.20, verify the version inside the image, redeploy web and worker workloads, and retire old image tags from rollback paths.
Most Django fleets run from images, so the patch unit is the image digest. A merged dependency bump is only the start of the production patch sequence. The build must produce a new image, the registry must store it, the deployment system must roll it out, and workers must restart onto the same code. Any shortcut in that chain leaves a vulnerable process answering traffic or consuming jobs.
Build the verification into the pipeline:
docker build -t your-registry/your-django-app:django-5.2.20 .
docker run --rm --entrypoint python your-registry/your-django-app:django-5.2.20 -m django --version
docker run --rm --entrypoint python your-registry/your-django-app:django-5.2.20 - <<'PY'
from django.contrib.gis.db.models import RasterField
print(RasterField)
PY
The second check matters for GeoDjango images because GDAL and GEOS system libraries shape the runtime behaviour. A base image change can alter available drivers, file system permissions, and worker startup paths. Test raster ingestion with trusted fixtures after the upgrade, especially where forms previously displayed the field or where code assigns JSON raster definitions directly.
Rollback planning needs the same care as the forward rollout plan. Rolling back to an image with Django before the fixed versions reopens the vulnerability, even if the rollback fixes an unrelated application bug. Mark pre fix digests as unsafe for GeoDjango services, and prefer a forward fix on the patched branch. For distribution packages, apply the vendor update when it appears, then rebuild or restart according to how the host receives Python packages.
Our HTTP2Shell production fix guide follows the same rule for another stack: the patch is complete only when the running artifact proves the fixed version under production conditions.
Which Django4Shell CVE-2026-124827 Detection Signals Should SREs Watch?
Watch for raster input containing path fragments or GDAL virtual file system prefixes, Django workers writing outside application and media directories, unexpected child processes from web workers, and new Python startup artefacts such as sitecustomize files or .pth files. Treat those signals as incident evidence until a benign deployment explains them.
Detection for Django4Shell should focus on the edges around a quiet file write. The write itself may not produce a dramatic application error. The surrounding behaviour is louder: strange raster names in form submissions, worker processes touching paths they never touch during normal traffic, and Python startup files appearing in places that deployment tooling did not put them.
Start with request and application logs before moving to host level evidence. Search for raster submissions that contain path separators, parent directory fragments, absolute paths, or GDAL virtual file system prefixes. Those values do not belong in ordinary raster metadata from untrusted users. Pair that search with admin and serializer audit logs so responders can tell whether a staff account, an API token, or a background import supplied the value.
Next, watch the worker file system for writes outside expected application directories. A Django process normally writes to media storage, temporary upload directories, cache locations, and log paths. Writes into application code directories, site packages, current working directories, or static asset roots deserve immediate review. Pay close attention to new sitecustomize.py files and .pth files, because Python startup mechanisms can turn a file write into code execution on the next process start.
Process telemetry gives the strongest signal when a file write turns into code execution. Web workers should not spawn shells, download tools, package installers, or unrelated interpreters during normal request handling. When a worker child process appears beside a suspicious raster submission, preserve the host state, capture the process tree, and treat the service as potentially compromised until forensic review clears it.
| Signal | Why it matters | First response |
|---|---|---|
| Raster name contains path fragments | Suggests probing against GDAL file handling | Preserve request logs and identify the submitting account |
| Worker writes outside expected directories | Matches the file write primitive | Snapshot file metadata and compare with deployment records |
| New sitecustomize or .pth file | Can execute code at Python startup | Isolate the workload and rotate secrets after evidence capture |
| Unexpected shell or download child process | Suggests code execution after the write | Start incident response and preserve process lineage |
Set a review window that covers the period from disclosure through the completion of patching across every worker pool. File write attempts can hide inside ordinary admin traffic, and the first suspicious request may precede the first alert by several days. Retain request logs, admin audit events, deployment records, and process telemetry for that window so responders can reconstruct the sequence without guessing. As of the research date for this guide, Django had not reported exploitation, and the CVE was not listed in the CISA Known Exploited Vulnerabilities catalog. Public proof of concept reporting conflicted across secondary sources, so the safe statement is narrow: exploitation was not confirmed by Django or CISA at that time, while patching urgency remains high for exposed GeoDjango services.
Why Does CVE-2026-132092 Make the Django4Shell Release Urgent?
CVE-2026-132092 matters because the same Django security release fixes a SQL injection in range and in lookups involving aliases or key transforms with percent signs. Teams without RasterField still need the upgrade, although exploitation needs a specific query pattern and attacker influence over the affected lookup inputs.
The December release shipped seven security fixes, and Django4Shell received the memorable name. The quieter issue, CVE-2026-132092, is the reason non GeoDjango teams should not park the upgrade in a low priority queue. Django describes a potential SQL injection in range and in lookups when queries involve aliases or key transforms containing percent signs. The __range case required incorrectly using more than two right hand side values, and the __in case required a bilateral transform.
That pattern is narrower than a generic ORM injection headline. Normal application code rarely builds aliases or JSON key transforms with percent signs under attacker control. Still, core framework SQL injection deserves a prompt patch because query construction spreads through reporting code, admin filters, analytics endpoints, and internal tools that reviewers rarely inspect with the same care as public APIs.
The release also fixes lower severity issues, including an XSS case in truncatechars_html, cache poisoning through dot segments, admin changelist information leakage cases, and a heap buffer overflow in OGRGeometry.wkb. Those fixes strengthen the case for a fleet wide upgrade. They also explain why version based scanners flag every unfixed Django service even when only a subset carries the RasterField RCE path.
Use separate language in tickets and status updates, naming Django4Shell for the GeoDjango RasterField file write and CVE-2026-132092 for the SQL injection. Mixing the two creates the false impression that every Django service carries a 9.8 RCE, which wastes incident attention and makes the real GeoDjango exposure harder to prioritise.
What Breaks After the Django4Shell Fix Ships?
After the Django4Shell fix, RasterField disappears from generated forms by default, dict or JSON raster definitions with non default drivers raise GDALException, and trusted workflows must wrap approved definitions in GDALRaster. Teams should test admin edits, imports, serializers, and raster ingestion before production rollout completes.
The December fix changes behaviour on purpose, so expect a few sharp edges during rollout. After the upgrade, RasterField defaults to editable=False in generated forms. Admin pages and ModelForms leave the field out unless the form includes it explicitly. That change can surprise operators who used the admin to correct raster metadata by hand. The safe response is a trusted, reviewed workflow for raster edits, not a broad return to generated forms for every staff user.
Assignments also become stricter for dict and JSON raster definitions. A dict or JSON string that names a non default driver raises GDALException. Trusted code that needs another driver should wrap the definition in GDALRaster after validation. That wrapper is a code review signal: it says the caller accepts responsibility for the raster definition. Treat every new wrapper as a security sensitive change and test it with malformed metadata, unexpected drivers, and path like names.
| Symptom after upgrade | Likely cause | Production response |
|---|---|---|
| RasterField no longer appears in admin or forms | The fix defaults the field to non editable | Add a trusted edit workflow only for approved operators and log changes |
| GDALException during raster import | Code assigns a dict or JSON string with a non default driver | Validate the definition, then wrap trusted input in GDALRaster |
| Raster ingestion still triggers outbound requests | Untrusted input reaches RasterField through another path | Validate raster input before assignment and review GDAL virtual file system exposure |
| Old Django branch has no fixed release | The branch is unsupported and was not evaluated | Upgrade to a supported branch and keep RasterField input restricted during migration |
| Scanner still flags the service | The running image or worker still carries the old Django version | Rebuild, redeploy, and verify the version inside the running image |
Test the upgrade with the same seriousness as a database migration. Run admin smoke tests, serializer contract tests, raster import fixtures, worker job tests, and a staging request that proves untrusted raster definitions are rejected. Keep the test data defensive: the goal is to prove rejection and safe handling, not to reproduce an attack against a production like system.
What Should Senior Teams Learn From Django4Shell?
Senior teams should treat Django4Shell as a parser trust boundary lesson: every path into GDALRaster needs the same suspicion, generated forms need review, and patch verification must prove the running artifact changed. The durable fix combines framework upgrades, input validation, least privilege file access, and detection around worker behaviour.
Django4Shell rewards teams that read patches as system changes rather than version bumps. The August fix protected spatial lookups, the October fix protected byte values in lookups, and the December fix protected field assignment. Each step made sense in isolation, yet the sink remained reachable through a sibling path until the assignment gate arrived. Senior review should ask a blunt question after every parser patch: which other callers can hand the same untrusted shape to the same dangerous constructor?
Generated surfaces deserve the same scrutiny as hand written APIs. Admin forms, ModelForms, and writable serializers are production input paths, even when the team thinks of them as internal tooling. A field that falls back to a text input can quietly widen the attack surface. Security review should include generated forms whenever a model field wraps a parser, a file format, a query language, or a native library.
Least privilege limits the blast radius when validation fails. Run Django workers with write access only to the directories the application needs. Keep code directories read only in production images where the platform allows it. Separate media storage from executable code paths wherever the platform gives you that control. Alert on worker writes outside expected locations and review those alerts beside deployment records. Those controls do not replace the Django patch, but they decide whether a file write becomes a contained incident or a host compromise.
Finally, close the loop in the runbook while the incident details remain fresh. Record the fixed Django versions, the RasterField audit command, the image verification step, and the detection queries used during the response. Link the runbook entry to the same shell class playbooks used for React and Ruby incidents, then review it after the next framework security release. Run a short tabletop exercise with the next framework security release and test whether the team can find every caller of the affected sink within one working session. Measure the time from advisory publication to image verification in production, and record where the process slowed down. The goal is a repeatable habit: find the sink, map every door, patch the artifact, and prove the running system changed.
Frequently Asked Questions
Direct answers to common technical, architectural, and production troubleshooting questions.
What is Django4Shell CVE-2026-124827?
Django4Shell is the public name for CVE-2026-124827, a GeoDjango RasterField file write flaw fixed on 2 December 2026. A user controlled raster name and non default driver could make GDAL write to an attacker chosen location, which can lead to remote code execution depending on the driver and writable paths.
Which Django versions are affected by Django4Shell CVE-2026-124827?
Supported affected versions are Django 6.1 before 6.1.4, Django 6.0 before 6.0.11, and Django 5.2 before 5.2.20. Django did not evaluate unsupported 5.1, 5.0, and 4.2 series for this issue, so teams on those branches should upgrade to a supported release and restrict RasterField input during migration.
Am I exposed to Django4Shell without GeoDjango rasters?
The Django4Shell RCE path needs GeoDjango on PostGIS with a RasterField model and untrusted input reaching that field. Teams without RasterField should still upgrade because the same release fixes CVE-2026-132092, a separate SQL injection in range and in lookups under specific query conditions.
How do I fix Django4Shell CVE-2026-124827?
Upgrade to Django 6.1.4, 6.0.11, or 5.2.20, rebuild container images, and redeploy web and worker processes. Before the upgrade lands, set editable=False on RasterField, remove it from admin forms and writable serializers, and validate raster input before any assignment reaches the field.
Is Django4Shell CVE-2026-124827 being exploited in the wild?
As of the 3 December 2026 research check, Django had not reported exploitation and CVE-2026-124827 was not listed in the CISA Known Exploited Vulnerabilities catalog. Secondary reporting conflicted on public proof of concept availability, so exposed GeoDjango teams should patch promptly without waiting for exploitation confirmation.