Published
- 15 min read
The Django RasterField Patch Needs Running-Version Proof
Books by the author
Compare all 5As an Amazon Associate I earn from qualifying purchases. Buying through these links costs you nothing extra and helps pay for the blog.
A Django version changed in requirements.txt. The pull request is green. Somewhere behind a load balancer, yesterday’s container is still serving requests.
That gap matters after Django’s 2 December 2026 security release. Django 6.1.4, 6.0.11, and 5.2.20 fix seven security issues. The highest-priority one, CVE-2026-124827, sits in GeoDjango’s RasterField. Under a narrow but serious set of conditions, an untrusted raster definition could tell the server where to write a file. The result could reach code execution, depending on the raster driver and the process’s filesystem permissions.
Respond at the service boundary. Find deployments that actually use RasterField and close any route that accepts untrusted raster definitions. Deploy the correct release line, then ask the running process which version it loaded. Keep the receipt.
What Django fixed on 2 December
The Django release notice covers Django 6.1.4, 6.0.11, and 5.2.20. Those releases address seven security issues. This article concentrates on CVE-2026-124827 because it crosses a boundary developers can easily miss: data assigned to a model field could make the server write a file.
Django describes the affected operation precisely. A raster data definition assigned to django.contrib.gis.db.models.RasterField could include a user-controlled name and a non-default driver. GDAL, the geospatial library doing the raster work, could then write a file to the location named by that input. Django’s notice says, “Depending on the raster driver, this could enable remote code execution.” The GitHub advisory records the affected release lines and the same file-write consequence.
Several conditions have to meet. The application must use GeoDjango’s RasterField. That field is implemented only on PostGIS. A reachable assignment path must accept a dictionary or JSON raster definition that an untrusted user can influence, including a non-default driver and a name. The running process must also have useful write permissions, and any path from a written file to code execution depends on the selected driver and where the process can write.
Those conditions narrow the affected population. They do not excuse guesswork. A platform team may know that “we use Django” while missing the single mapping service that uses PostGIS and accepts model updates through a writable serializer. Snyk’s analysis also centres the practical response on finding GeoDjango deployments, checking exposed assignment paths, and moving them to fixed releases.
Django moved the trust decision to two visible boundaries. RasterField now defaults editable to False, leaving it out of an automatically generated ModelForm unless a developer includes it explicitly. A dictionary or JSON definition that requests a non-default driver raises GDALException. When a trusted application genuinely needs that driver, it must construct GDALRaster explicitly, putting the choice in reviewable application code rather than an ordinary-looking model assignment with hidden operating-system consequences.
How a model field reached the filesystem
A raster is more than a grid of numbers. Its definition can describe dimensions, spatial reference, pixel data, and the driver used to interpret or create it. GDAL supports many drivers because geospatial software has to read and write many formats. That flexibility becomes dangerous when an untrusted caller can choose both the driver and a file-like name.
Several independent routes can reach the same application boundary: JSON accepted by a model serializer, a submitted value bound by a form, or a record edited by an administrator. Each can pass a value to RasterField for GDAL to handle. If the definition selects a non-default driver with file-writing behaviour, the database-looking operation reaches the server’s filesystem.
The route may begin with a dictionary in an API request and pass through routine model-assignment code. Risk appears at the driver handoff: RasterField gives the definition to GDAL, which understands both the requested driver and its output location. Reviews limited to familiar upload controls can therefore miss the filesystem operation entirely.
The Django notice points reviewers to models registered in Django admin, uses of ModelForm, and writable model serializers. Treat them as route-discovery leads rather than proof of exploitation. Establish who can reach the admin path, whether a serializer includes the field, and what representation the form’s validation permits.
Consider a mapping service with a writable layer endpoint. The public API accepts a JSON document and passes permitted fields into a model serializer. The team’s API review focuses on authentication and object ownership. Nobody notices that raster accepts a structured definition rather than an inert identifier. If an external account can control the driver and name, the server may perform a write outside the database transaction the reviewers thought they were approving.
Filesystem permissions decide how far that write travels. A process confined to a narrow, read-only image with a dedicated scratch directory has fewer useful destinations than a process that can alter application code, templates, startup files, or a served directory. This is why the release notice says code execution “could” follow. The file write is the core issue; the surrounding deployment determines its consequence.
Patch the field behaviour and remove untrusted assignment paths; independently restrict the process’s write access. Verify the patched RasterField behaviour together with the reachable routes, then test filesystem permissions under the deployment identity and record each result against its control.
Find the applications that can actually reach the path
An organisation-wide search for “Django” will produce noise. The useful inventory begins with RasterField. Search source repositories for imports and model declarations such as django.contrib.gis.db.models.RasterField, then follow each result to the service and deployment that runs it. Package inventories can identify Django and GDAL, but only code and route inspection can show whether the field is present and writable.
Begin with workloads that can receive traffic. A repository archived last year cannot receive a request, while a forgotten container receiving health checks remains in scope. Connect each code result to an image, process, serverless package, or virtual environment that exists in production, staging, or an internet-reachable test system.
For every use, answer four questions in writing. Which Django release line does the running service load? Which forms, admin registrations, API serializers, tasks, or import jobs can assign the field? Who can control the raster definition? Where can the service account write? Those answers turn a vulnerability announcement into a bounded engineering task.
Admin access deserves careful treatment. “Admin only” reduces exposure when the admin is restricted, strongly authenticated, and used by a small trusted group. It provides weaker comfort when support accounts are numerous, staff sessions are exposed to phishing, or a partner receives delegated access. The release changed the default because automatic form generation made the field available too easily. Check explicit inclusions as well as generated forms.
Writable serializers need the same route-level review. Look at fields, exclude, custom create() and update() methods, nested serializers, and any generic code that passes a request dictionary into a model. A field absent from the web serializer may still be reachable through a bulk import endpoint or a background job reading customer-controlled files.
Then inspect the data shape. A service that accepts only a server-generated raster identifier has a different risk from one that accepts raw dictionary or JSON definitions. Validation that allows a fixed driver and a server-chosen storage location can cut off the dangerous choices. Validation that merely checks whether the JSON parses misses the point.
Geometry fields can leave this specific worklist. Django states that they were unaffected, while RasterField is implemented only on PostGIS. Attach the search evidence to that exclusion so the deep review stays with deployments that use RasterField on PostGIS.
End the inventory with serving workloads rather than repository names. For each named deployment, record its owner and running version, then identify exposed routes, input trust, and write permissions. This service-level record shows whether the affected code receives traffic.
Prove the fixed version in the serving runtime
A dependency file records the intended build. The serving artifact also reflects a particular commit, build time, and rollout, including any older replicas the deployment system leaves alive. Patch closure therefore depends on evidence from the running environment.
A developer may update Django to 5.2.20 and merge the change while an unrelated deployment check leaves the old image live. Another rollout may replace eight replicas and stall before reaching two older workers. In both cases, the dependency pull request is correct and vulnerable code continues to serve requests.
Lock files add another opportunity for drift. Even when a direct requirement permits a fixed range, a stale lock or constraints file may resolve the old package. Cached layers can supply dependencies to a multi-stage container build. In a long-lived virtual environment, the package may update on disk while worker processes keep the old module loaded until restart.
For that reason, proof has to come from the serving environment. Run a trusted diagnostic inside each deployed artifact or expose the version through an authenticated operational endpoint. In Python, django.get_version() reports the loaded Django version. Package metadata is useful supporting evidence, but the loaded runtime answers the question that matters.
Check every release line against the fixed target from 2 December 2026. A service maintained on Django 5.2 needs 5.2.20. A service on 6.0 needs 6.0.11. A service on 6.1 needs 6.1.4. Avoid a rushed major-line jump during incident work unless the application already planned and tested it. The security release exists on each supported line so teams can make a controlled change.
A complete deployment receipt links the source change, resolved dependency, built artifact digest, rollout, and runtime response. It should answer: which commit requested the fixed version, which immutable image or package contains it, which replicas now serve traffic, and what version does each running process report? If the system cannot answer those questions, this incident has found a release-engineering weakness worth fixing after the immediate patch.
Autoscaling can reintroduce old code after the visible rollout. Old machine images may supply new nodes, and a function alias may still point to an earlier published version. Disaster-recovery regions can also run through a separate pipeline. Inspect the templates and references that will create the next instance as part of the patch window.
Rollback targets must also contain the fixed build. If the standard target still carries the vulnerable Django version, an unrelated outage tomorrow could restore it. Mark that artifact as disallowed or publish a fixed replacement at the rollback point before closing the patch work.
The patch leaves a separate request-forgery problem
Django’s release notice draws the boundary directly: the new exception “only limits server-side file writes.” The project warns that server-side request forgery, usually shortened to SSRF, remains possible when untrusted input is assigned to RasterField. Crafted raster input may still make the server fetch something the caller chose.
Proving the fixed version closes the CVE-2026-124827 file-write task. Any endpoint that accepts an untrusted raster definition still needs separate treatment because the caller may influence network requests made from inside the service.
Internal network position makes those requests interesting. The application may reach addresses, metadata services, storage endpoints, or management interfaces unavailable to the original caller. Even when a response is not returned directly, timing, error messages, or side effects may reveal information. The exact consequence depends on the environment and how raster input is processed.
Input validation therefore remains part of the design. Accept the narrowest representation the product needs. Choose drivers in server code rather than accepting arbitrary driver names. Generate storage locations on the server. If remote source retrieval is required, apply an allowlist that matches the real business need and resolve names carefully so a permitted-looking host cannot redirect toward a private address.
Network controls add another layer. A service that has no business reaching cloud metadata or arbitrary internal addresses should have those routes blocked. Outbound access through a controlled proxy can make destinations visible and enforce policy. Those controls reduce the impact of missed validation elsewhere, but they do not make an unsafe assignment interface acceptable.
Keep the evidence separated by the question it answers. The runtime version establishes whether the known file-write fix is loaded; route and input tests document which raster definitions cross the application’s trust boundary. If validation misses a route, egress-policy tests measure what the service can still reach. Each result supports only its stated conclusion.
Check for earlier exposure without writing an exploit
A patched service can still carry the result of an earlier write. Teams with a confirmed untrusted RasterField path should perform a proportionate lookback, especially when the process could write to executable, served, template, configuration, or startup locations. Search for evidence of earlier writes without recreating the vulnerability on a live system.
Begin with the exposure window. Use deployment records to identify when the vulnerable route first appeared and when the fixed runtime reached every replica. If logs do not cover the whole period, say so. An honest evidence boundary is more useful than a clean finding based on three days of data for a route that existed for a year.
Review application and reverse-proxy logs for requests to the affected endpoints, focusing on unexpected raster definition structures, non-default driver values, suspicious names, parsing errors, and unusual response patterns. Preserve original logs before running broad searches if the system may become an incident. Avoid publishing suspected payloads in tickets or chat rooms where they will be copied into more systems.
Compare files in writable application locations against the known image or package. Immutable container filesystems make this easier because changes should be rare and the expected contents come from the image digest. On mutable hosts, use package manifests, deployment records, integrity data, and file timestamps carefully. Timestamps alone are weak evidence and can be altered by normal operations.
Look for the consequence that fits the environment. A process able to write only into an isolated temporary directory has a different review from one running with a writable application tree. Check restart and deployment history before interpreting a missing file as proof that no write occurred. A replaced container may remove the file while leaving related access or credential use elsewhere.
Escalate when evidence supports it. An unexpected file in a sensitive location, a request carrying a non-default driver and chosen path, or unexplained child-process activity around that request deserves incident-response handling. Preserve the affected artifact, restrict access, rotate credentials that the process could read, and rebuild from a trusted source rather than trying to clean an uncertain host in place.
Set the lookback’s pace and depth from the reachable assignment path and the process’s write capability. Code and route evidence showing no exposed path supports a small review, followed by patching on a schedule appropriate to the high-severity release and deployment verification. A public writable serializer with broad filesystem permissions warrants immediate attention to the full exposure window.
A practical release sequence
A defensive sequence should leave checkable evidence at each step and stay bounded to the affected RasterField path rather than expanding into a vague “Django audit.”
-
Identify deployed
RasterFielduse. Search active source and built artifacts for GeoDjangoRasterField, then map every result to a serving workload and owner. Exclude geometry-only applications with the evidence attached. -
Trace every assignment route. Review admin registrations,
ModelFormclasses, writable serializers, bulk imports, background jobs, and custom model update code. Mark who can supply the raster definition and whether they can influencenameordriver. -
Close exposed input while the rollout moves. If untrusted callers can submit raw raster definitions, disable that field or endpoint until the fixed build is everywhere. Keep explicit validation afterward because Django’s notice says SSRF remains possible.
-
Update within the current release line. Move affected services to Django 5.2.20, 6.0.11, or 6.1.4 as appropriate. Resolve and inspect the lock or constraints file so the built artifact receives the intended package.
-
Build an immutable artifact. Give the image or package a digest and connect it to the source commit. Rebuild rather than modifying a long-lived server in place when the platform supports immutable deployment.
-
Roll through every serving location. Replace workers, replicas, regions, scheduled jobs, and standby environments. Update autoscaling templates and remove the vulnerable artifact from ordinary rollback choices.
-
Ask the runtime for its version. Run
django.get_version()through a trusted operational path inside each deployed workload. Save the output with the artifact digest and replica or region identity. -
Test the security behaviour safely. Confirm untrusted dictionary or JSON input cannot select a non-default driver, and confirm product-required trusted raster flows still work through explicit
GDALRasterhandling. Use benign fixtures in a test environment, without attempting to write to sensitive locations. -
Review the exposure window when warranted. For routes that accepted untrusted raster definitions, examine request evidence and writable locations according to the process permissions and log coverage. Escalate concrete anomalies to incident response.
-
Keep the receipt. Record the in-scope services, fixed versions, artifact digests, rollout completion, runtime checks, route tests, remaining SSRF controls, and any limits in historical evidence. Close the ticket against those facts.
Containment comes first: stop the risky route and replace the code. Once that work is complete, use the gaps revealed by deployment proof to guide broader release improvements instead of attempting a platform rewrite on patch day.
Trace the capability behind RasterField
Treat RasterField as a capability boundary rather than passive model data. Start with who can supply a raster definition and whether its driver and name can reach GDAL. Then determine where the deployment identity can write.
Close the file-write task only when each serving process reports the fixed Django version and that result is tied to the built artifact. Keep separate evidence for every route that still accepts untrusted raster definitions: input validation and outbound controls address the continuing SSRF risk, which runtime version proof does not.
If you want one calm, practical security email each month, join the newsletter on this site.
Sources
- Django: Django security releases issued: 6.1.4, 6.0.11, and 5.2.20, accessed 2026-12-03
- GitHub Advisory Database: GHSA-fh3p-824r-m74q, accessed 2026-12-03
- Snyk: Django4Shell, CVE-2026-124827 in GeoDjango RasterField, accessed 2026-12-03
- Cybersecurity News: Django4Shell vulnerability, accessed 2026-12-03
- Canadian Centre for Cyber Security: Django security advisory AV26-1219, accessed 2026-12-03