Description
An issue was discovered in Django 5.2 before 5.2.17 and 6.0 before 6.0.8.
GeoDjango spatial lookups optimistically parse the right-hand-side value as a raster by passing it to the `django.contrib.gis.gdal.GDALRaster` constructor. Any value used in a spatial lookup against a `GeometryField` or `RasterField` reaches this constructor, including untrusted input, for example a spatial-field filter submitted through the Django admin changelist query string by a staff user with view permission. A `dict`, or a `str` holding its JSON representation, is opened in write mode regardless of the constructor's `write=False` default, allowing a file with an attacker-chosen name and contents to be written through a file-backed GDAL driver. Any other `str` is treated as a datasource, allowing an outbound network request through a GDAL virtual filesystem handler. Writing a file to a location later imported by the application can result in remote code execution.
Earlier, unsupported Django series (such as 5.1.x, 5.0.x, and 4.2.x) were not evaluated and may also be affected.
Django would like to thank Bence Nagy, localhost-detect, and kimchunbok_ for reporting this issue.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| djangoproject | Django | 6.0 – < 6.0.8, 5.2 – < 5.2.17 | 6.0.8 |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | python-django | 3:5.2.17-1 | — |
| Debian 13 | python-django | No fix yet | — |
| Debian 12 | python-django | No fix yet | — |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 26.04 LTS | python-django | 3:5.2.9-0ubuntu4.3 | USN-8848-1 |
| Ubuntu 24.04 LTS | python-django | 3:4.2.11-1ubuntu1.18 | USN-8848-1 |
| Ubuntu 22.04 LTS | python-django | 2:3.2.12-2ubuntu1.29 | USN-8848-1 |
Show 4 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu Pro 20.04 LTS | python-django | 2:2.2.12-1ubuntu0.29+esm10 | USN-8848-1 |
| Ubuntu Pro 18.04 LTS | python-django | 1:1.11.11-1ubuntu1.21+esm17 | USN-8848-1 |
| Ubuntu Pro 16.04 LTS | python-django | 1.8.7-1ubuntu5.15+esm13 | USN-8848-1 |
| Ubuntu Pro 14.04 LTS | python-django | 1.6.11-0ubuntu1.3+esm12 | USN-8848-1 |
Red Hat
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Red Hat Ansible Automation Platform Developer 2 | automation-controller-cli | 4.6.32-1.el8ap | RHSA-2026:59136, RHSA-2026:59135 |
| Red Hat Ansible Automation Platform Developer 2 | python-django +1 | 5.2.17-1.el10ap | RHSA-2026:59137, RHSA-2026:59136 |
| Red Hat Ansible Automation Platform Developer 2 | python3.12-django | 5.2.17-1.el8ap | RHSA-2026:59137, RHSA-2026:59136, RHSA-2026:59135 |
| Red Hat Ansible Automation Platform 2 | automation-controller-cli +1 | 4.6.32-1.el8ap | RHSA-2026:59137, RHSA-2026:59136, RHSA-2026:59135 |
| Red Hat Ansible Automation Platform 2 | automation-gateway-server | 2.5.20260824-1.el8ap | RHSA-2026:59135 |
| Red Hat Ansible Automation Platform 2 | automation-platform-ui | 2.6.13-1.el9ap | RHSA-2026:59136 |
| Red Hat Ansible Automation Platform 2 | python-django +1 | 5.2.17-1.el10ap | RHSA-2026:59137, RHSA-2026:59136 |
| Red Hat Ansible Automation Platform 2 | python3.12-aiohttp | 3.14.3-1.el8ap | RHSA-2026:59136, RHSA-2026:59135 |
| Red Hat Ansible Automation Platform 2 | python3.12-django | 5.2.17-1.el8ap | RHSA-2026:59137, RHSA-2026:59136, RHSA-2026:59135 |
| Red Hat Ansible Automation Platform 2 | python3.12-gitpython | 3.1.59-1.el8ap | RHSA-2026:59136, RHSA-2026:59135 |
SUSE
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| SLES 15 SP7 | python-Django | 4.2.11-150600.3.65.1 | SUSE-SU-2026:3503-1 |
openSUSE
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| openSUSE Tumbleweed | python-Django | 6.0.8-1.1 | openSUSE-SU-2026:11464-1 |
| openSUSE Tumbleweed | python-Django4 | 4.2.30-5.1 | openSUSE-SU-2026:11465-1 |
| openSUSE Tumbleweed | python-Django5 | 5.2.17-1.1 | openSUSE-SU-2026:11491-1 |
| openSUSE Leap 16.0 | python-Django | 5.2.4-bp160.11.1 | openSUSE-SU-2026:21543-1 |
Alpine
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Alpine v3.24 | py3-django | 5.2.17-r0 | — |
Affected packages
| Ecosystem | Package | Affected | Fixed | Record |
|---|---|---|---|---|
| PyPI | django | < 5.2.17 | 5.2.17 | GHSA-wvqv-fj8w-qmhm |
| PyPI | django | >= 6.0a1, < 6.0.8 | 6.0.8 | GHSA-wvqv-fj8w-qmhm |
| PyPI | django | < 5.2.17 · >= 6.0a1, < 6.0.8 | 5.2.17, 6.0.8 | PYSEC-2026-4035 |
Advisories 10
- WID-SEC-2026-2649 Django: Mehrere Schwachstellen BSI CERT-Bund (WID) · Nov 5, 2026
- RHSA-2026:59135 Red Hat Security Advisory: Red Hat Ansible Automation Platform 2.5 Product Security and Bug Fix Update Red Hat Security Advisories (RHSA) · Oct 20, 2026
- RHSA-2026:59136 Red Hat Security Advisory: Red Hat Ansible Automation Platform 2.6 Product Security and Bug Fix Update Red Hat Security Advisories (RHSA) · Oct 20, 2026
- RHSA-2026:59137 Red Hat Security Advisory: Red Hat Ansible Automation Platform 2.7 Product Security and Bug Fix Update Red Hat Security Advisories (RHSA) · Oct 10, 2026
- USN-8848-1 python-django vulnerabilities Ubuntu Security Notices (USN) · Oct 2, 2026
- openSUSE-SU-2026:11491-1 python313-Django5-5.2.17-1.1 on GA media SUSE / openSUSE Security Updates · Aug 11, 2026
- openSUSE-SU-2026:21543-1 Security update for python-Django SUSE / openSUSE Security Updates · Aug 7, 2026
- openSUSE-SU-2026:11465-1 python313-Django4-4.2.30-5.1 on GA media SUSE / openSUSE Security Updates · Aug 7, 2026
- openSUSE-SU-2026:11464-1 python313-Django-6.0.8-1.1 on GA media SUSE / openSUSE Security Updates · Aug 7, 2026
- SUSE-SU-2026:3503-1 Security update for python-Django SUSE / openSUSE Security Updates · Aug 6, 2026
References
- Django security archive vendor-advisory
- Django releases announcements mailing-list
- https://github.com/django/django/commit/f1949c1f9758947ade984c895ff16bef46f56520 patch
- https://github.com/django/django/commit/39b3e2d0c743a338def6c473086ebc06865e86b6 patch
- https://github.com/django/django/commit/208f80cb682868b584ed0a78f23e4ba6304212aa patch
- https://github.com/django/django/commit/115ffd0463a765ab1cc93de18e94b5459b8a300e patch
- Django security releases issued: 6.0.8 and 5.2.17 vendor-advisory