CVE-2025-59681 json
Django vulnerable to SQL injection in column aliases
published 2025-10-01 13 mo ago modified 2026-10-12 27 d ago also BIT-django-2025-59681 , EUVD-2025-32691 , GHSA-hpr9-3m2g-3j9p , PYSEC-2025-106
- cvss
- 7.1
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 0.6%
- EPSS 0.6% chance of exploitation in 30 days, percentile 50%
- public exploits
- 0
- none known
Summary
An issue was discovered in Django 4.2 before 4.2.25, 5.1 before 5.1.13, and 5.2 before 5.2.7. QuerySet.annotate(), QuerySet.alias(), QuerySet.aggregate(), and QuerySet.extra() are subject to SQL injection in column aliases, when using a suitably crafted dictionary, with dictionary expansion, as the **kwargs passed to these methods (on MySQL and MariaDB).
Patch / fix
- pypi django 4.2.25, 5.1.13, 5.2.7
- bitnami django 4.2.25, 5.1.13, 5.2.7
- djangoproject Django 4.2.25, 5.1.13, 5.2.7
- python-django Debian 12 3:3.2.25-0+deb12u1
- python-django Debian 13 3:4.2.27-0+deb13u1
- python-django Debian 14 3:4.2.25-1
debian advisories DEBIAN-CVE-2025-59681
- python-django Ubuntu 22.04 LTS 2:3.2.12-2ubuntu1.22
- python-django Ubuntu 24.04 LTS 3:4.2.11-1ubuntu1.11
- python-django Ubuntu 26.04 LTS, Ubuntu 25.10 3:5.2.4-1ubuntu2
- python-django Ubuntu Pro 14.04 LTS 1.6.11-0ubuntu1.3+esm8
- python-django Ubuntu Pro 16.04 LTS 1.8.7-1ubuntu5.15+esm9
- python-django Ubuntu Pro 18.04 LTS 1:1.11.11-1ubuntu1.21+esm12
- python-django Ubuntu Pro 20.04 LTS 2:2.2.12-1ubuntu0.29+esm4
ubuntu advisories UBUNTU-CVE-2025-59681
Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0
- python-Django SLE Module for Package Hub 15 SP7, SLE Module for Package Hub 15 SP6, openSUSE Leap 15.6 4.2.11-150600.3.33.1
suse advisories SUSE-SU-2025:03446-1
- python-Django5 openSUSE Tumbleweed 5.2.16-1.1
- python-Django6 openSUSE Tumbleweed 6.0-1.1
- python-Django openSUSE Leap 16.0 5.2.4-bp160.3.1
- python-Django openSUSE Tumbleweed 5.2.7-1.1
- python-Django4 openSUSE Tumbleweed 4.2.25-1.1
opensuse advisories openSUSE-SU-2026:11270-1openSUSE-SU-2026:10005-1openSUSE-SU-2025:20022-1openSUSE-SU-2025:15598-1openSUSE-SU-2025:15596-1
- py3-django Alpine 3.24, Alpine 3.23, Alpine 3.22 4.2.25-r0
alpine advisories ALPINE-CVE-2025-59681
Alpine secdb © Alpine Linux, from https://secdb.alpinelinux.org via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0
Vendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2025-59681 updated cvss 8.1
django: Potential SQL injection in QuerySet.annotate(), alias(), aggregate(), and extra() on MySQL and MariaDB1
-
Red Hat OpenShift Service Mesh 3 openshift-service-mesh/istio-proxyv2-rhel9 Red Hat Certification for Red Hat Enterprise Linux 7 python-django Red Hat Discovery 2 discovery/discovery-server-rhel9affected: workaround, no fix available
-
Red Hat Ansible Automation Platform 2.5 for RHEL 8 ansible-automation-platform-25/lightspeed-rhel8 2.5.250924-2fixed: vendor fix RHSA-2025:18984
-
Red Hat Ansible Automation Platform 2.6 ansible-automation-platform-tech-preview 2.6-1765600296fixed: vendor fix RHSA-2025:23196
-
Red Hat OpenShift Service Mesh 3 openshift-service-mesh/istio-cni-rhel9, openshift-service-mesh/istio-pilot-rhel9, openshift-service-mesh/istio-rhel9-operator, openshift-service-mesh/istio-must-gather-rhel9, openshift-service-mesh/istio-sail-operator-bundle, openshift-service-mesh-tech-preview/istio-ztunnel-rhel9 Red Hat Ansible Automation Platform 2 python-django, automation-controller, ansible-automation-platform-24/lightspeed-rhel8, ansible-automation-platform-25/ansible-dev-tools-rhel8 Red Hat Ansible Automation Platform 2.5 for RHEL 8 ansible-automation-platform-25/hub-rhel8 4.10.9-1, ansible-automation-platform-25/hub-web-rhel8 4.10.9-1, ansible-automation-platform-25/receptor-rhel8 1.6.0-1, ansible-automation-platform-25/de-minimal-rhel8 1.1.7-14, ansible-automation-platform-25/controller-rhel8 4.6.21-13, ansible-automation-platform-25/ee-minimal-rhel8 1.0.0-982, +26 more Red Hat Ansible Automation Platform 2.5 for RHEL 9 ansible-automation-platform-25/de-minimal-rhel9 1.1.7-15, ansible-automation-platform-25/ee-minimal-rhel9 1.0.0-983, ansible-automation-platform-25/de-supported-rhel9 1.1.7-13, ansible-automation-platform-25/ee-supported-rhel9 1.0.0-1108, ansible-automation-platform-25/ansible-builder-rhel9 3.1.0-260, ansible-automation-platform-25/ee-cloud-services-rhel9 1.0.0-316, +2 more Red Hat Discovery 1 discovery/discovery-server-rhel9not affected: vulnerable code not present
-
Red Hat OpenStack Platform 16.2 python-django20, python3-django20, python-django20-bash-completion Red Hat OpenStack Platform 17.1 python-django, python3-django Red Hat OpenStack Platform 18.0 python-djangonot affected: vulnerable code not in execute path
-
Red Hat Satellite 6 python-django, python2-django, python-django-bash-completionnot affected: component not present
-
Red Hat Update Infrastructure 4 for Cloud Providers python-djangonot affected: vulnerable code not present
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
CISA SSVC
- Exploitation
- none
- Automatable
- no
- Technical impact
- partial
- Assessed
- 13 mo ago
Exploit prediction
0.64% chance of exploitation in the next 30 days, higher than 50% of all scored CVEs (FIRST EPSS, 2026-11-08).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 7.1 | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:N |
| GitHub | 3.1 | 7.1 | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:N |
| NVD | 3.1 | 9.8 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| OSV | 3.1 | 9.8 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| pypi | django | >=4.2, <4.2.25 >=5.1, <5.1.13 >=5.2, <5.2.7 |
4.2.25 5.1.13 5.2.7 |
| bitnami | django | >=4.2.0, <4.2.25 >=5.1.0, <5.1.13 >=5.2.0, <5.2.7 |
4.2.25 5.1.13 5.2.7 |
Affected products
- djangoproject Django
Classification
- Weakness
-
- CWE-89 Improper Neutralization of Special Elements used in an SQL Command
- Technology feeds
References
-
github.com
/django/django/commit/41b43c74bda19753c757036673ea9db74acf494a
web
-
github.com
/django/django/commit/43d84aef04a9e71164c21a74885996981857e66e
web
-
docs.djangoproject.com
/en/dev/releases/security/
vendor-advisory, advisory
-
groups.google.com
/g/django-announce
web, release-notes, vendor-advisory, advisory
-
djangoproject.com
/weblog/2025/oct/01/security-releases/
release-notes, vendor-advisory, advisory
-
openwall.com
/lists/oss-security/2025/10/01/3
web
-
nvd.nist.gov
/vuln/detail/CVE-2025-59681
advisory, web
-
docs.djangoproject.com
/en/dev/releases/security
web
-
github.com
/django/django
package
-
github.com
/pypa/advisory-database/tree/main/vulns/django/PYSEC-2025-106.yaml
web
-
djangoproject.com
/weblog/2025/oct/01/security-releases
web
-
github.com
/advisories/GHSA-hpr9-3m2g-3j9p
advisory
Sources
- CVE List CVE-2025-59681
- GitHub Advisory GHSA-hpr9-3m2g-3j9p
- NVD CVE-2025-59681
- OSV BIT-django-2025-59681
- OSV PYSEC-2025-106
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.