Django 5.2.20 release notes

December 2, 2026

Django 5.2.20 fixes two security issues with severity "high", one security issue with severity "moderate", four security issues with severity "low", and one bug in 5.2.19.

CVE-2026-124827: Server-side file-write via RasterField assignment

Assigning a raster data definition to RasterField with a user-controlled name parameter and a non-default driver could cause GDAL to write a file to an attacker-controlled location. Depending on the raster driver, this could enable remote code execution. Because RasterField falls back to the CharField form field, the flaw was reachable by default on models with RasterField registered in the admin or using ModelForms or writable model serializers.

RasterField now defaults editable to False, excluding it from a ModelForm unless explicitly included. RasterField also now raises GDALException when assigning a dict or JSON string specifying a non-default driver. To use other drivers, wrap the definition in GDALRaster to signify the value is trusted. This exception only limits server-side file writes. Server-side request forgery is still possible if untrusted input is assigned to RasterField. See raster security considerations and implement validation before accepting untrusted input.

Geometry fields were not affected. RasterField is only implemented on PostGIS.

This issue has severity "high" according to the Django security policy.

CVE-2026-132092: Potential SQL injection in range and in lookups

The range and in lookups were subject to SQL injection in queries involving aliases or key transforms containing percent signs. The __range flaw required incorrectly using more than two right-hand side values. The __in flaw required a bilateral transform.

The range lookup now requires exactly two right-hand side values.

Note that using percent signs in column aliases and key transforms was deprecated in Django 6.0 and is scheduled for removal in Django 2028.

This issue has severity "high" according to the Django security policy.

CVE-2026-115868: Potential cross-site scripting vulnerability in truncatechars_html

The truncatechars_html template filter and the django.utils.text.Truncator.chars() method (with html=True) were subject to a potential cross-site scripting (XSS) attack when certain inputs whose text length matched the truncation length were processed and rendered in an HTML attribute.

This issue has severity "moderate" according to the Django security policy.

CVE-2026-125673: Potential cache poisoning via dot segments in request paths

UpdateCacheMiddleware and cache_page() were affected by a bug in build_absolute_uri(), which incorrectly normalized request paths containing . or .. segments. Under certain deployment and URL configurations, this could allow an unauthenticated attacker to cause cached responses to be served for unintended URLs.

build_absolute_uri() now preserves dot segments in the request path when called without a location. Existing cached responses are not invalidated, so users should clear any potentially affected caches after upgrading.

This issue has severity "low" according to the Django security policy.

CVE-2026-119642: Information leakage in admin changelist via "pk" alias for OneToOneField

The admin changelist allowed staff users with view permissions on a registered model with a custom OneToOneField primary key to enumerate data from those models by including the pk alias in the querystring and performing repeated lookup searches. This requires sufficient knowledge of the fields on the related model. It is a special case of CVE 2010-4534.

Models using multi-table inheritance were affected by default, as the implicit primary key field created by Django is a OneToOneField.

This issue has severity "low" according to the Django security policy.

CVE-2026-127929: Information leakage in admin changelist via reverse relations

The admin changelist allowed staff users with view permissions on a registered model to enumerate values on those models via manipulating the querystring to perform repeated lookup searches. This requires knowledge of the related model names or related_query_name overrides. It is a special case of CVE 2010-4534 that regressed in Django 5.0.3.

This issue has severity "low" according to the Django security policy.

CVE-2026-132809: Heap buffer overflow in OGRGeometry.wkb

The OGRGeometry.wkb property allocated an undersized buffer for geometries larger than 4GB on 64-bit platforms. This could result in segmentation faults or undefined behavior. The hex and geos properties of OGRGeometry and its pickling were also affected.

This issue has severity "low" according to the Django security policy.

Bugfixes