Django Security Update Fixes GeoDjango File Writes and SQL Injection: What to Check

Django 6.1.4, 6.0.11 and 5.2.20 fix seven security issues. Check GeoDjango raster inputs, unusual SQL lookups and caches as you upgrade.

Django has released security updates for seven vulnerabilities, including a GeoDjango file-write flaw that can lead to remote code execution and a separate SQL injection issue affecting certain query patterns. The fixes are available in Django 6.1.4, 6.0.11 and 5.2.20, released December 2.

Both prominent flaws require specific application behavior: an affected Django version alone does not establish that an attacker can exploit either one. Still, the Django security team recommends upgrading, and the release also addresses cache poisoning, cross-site scripting and information leaks.

Which Django versions should you install?

For supported branches, upgrade to 6.1.4, 6.0.11 or 5.2.20, as appropriate for your application. Check the version in the environment that actually runs the service, not just on a developer laptop:

python -m django --version

Inspect each deployed environment, including background workers and container images. Update your dependency lock or deployment configuration, rebuild images, run your tests and redeploy. If your operating system supplies Django, check its security advisories for backported fixes rather than relying on the version number alone. Unsupported branches, including 4.2, 5.0 and 5.1, were not evaluated for the SQL injection issue and may also be affected; plan a move to a supported release.

GeoDjango: identify raster inputs

CVE-2026-124827 concerns RasterField, a GeoDjango field implemented on PostGIS. A raster definition with an attacker-controlled name and a non-default driver could cause the GDAL library to write a file at a location chosen by the attacker. Depending on the driver, the write could lead to code execution.

The route into the field matters. Django’s advisory notes that models with a RasterField registered in the admin, or exposed through ModelForm or writable model serializers, could reach the vulnerable assignment path by default. Review whether untrusted users can supply raster definitions through those interfaces or custom code. Ordinary geometry fields are not affected by this particular flaw.

The update makes raster fields non-editable by default and rejects dictionary or JSON definitions specifying a non-default driver on assignment. Applications that deliberately use another driver must wrap a trusted definition in GDALRaster. This is also a compatibility change worth testing before deployment.

Do not treat the patch as a substitute for input validation. Django cautions that server-side request forgery remains possible when untrusted input is assigned to a raster field. Until the upgrade is deployed, keep untrusted data away from that field and exclude it from admin forms and writable serializers; check custom assignment paths as well.

Security firm Upwind notes that an August fix addressed a related raster issue in spatial lookups, while the December issue concerns field assignment. Installing the August update alone therefore does not supply the December fix.

SQL injection requires a specific query pattern

CVE-2026-132092 affects Django’s range and in lookups when a query includes an alias or key transform containing a percent sign. The range case requires more than two values on the right-hand side; the in case requires a bilateral transform, which applies transformations to both sides of a lookup.

Review code that constructs aliases or JSON key transforms dynamically, particularly where users influence those values. The fixed release requires exactly two values for range, so tests should catch applications relying on the old behavior. Django had already deprecated percent signs in aliases and key transforms in version 6.0.

Clear affected caches after upgrading

Another fix, CVE-2026-125673, addresses cache poisoning involving dot segments such as . and .. in request paths. Under certain deployment and URL configurations, responses could be cached for unintended URLs. The update does not remove entries already cached, so Django advises clearing potentially affected caches after the upgrade.

The release also fixes an HTML truncation cross-site scripting issue, two admin information leaks and a GeoDjango geometry buffer overflow. Check the full advisory against your application’s templates, admin access and GIS features; the two high-severity issues are not the only reasons to update.

Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

Chrome 158 Fixes 229 Security Flaws: How to Check Your Version and Update

Related Posts