Vulnerability · Published Oct 1, 2025 · Assigned by mitre

CVE-2025-59681

High 7.1

In plain English

A high-severity SQL injection in Django from djangoproject. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.6% (higher than 51% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)7.1High
Exploit odds (30 days)0.6%top 49.2% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack toolingNoneno public tooling known

Official description

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).

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Alpine:v3.22py3-django4.2.25-r0ALPINE-CVE-2025-59681
Alpine:v3.23py3-django4.2.25-r0ALPINE-CVE-2025-59681
Alpine:v3.24py3-django4.2.25-r0ALPINE-CVE-2025-59681
Debian:12python-django3:3.2.25-0+deb12u1DSA-6136-1
Debian:12python-django3:3.2.25-0+deb12u1DEBIAN-CVE-2025-59681
Debian:13python-django3:4.2.27-0+deb13u1DSA-6117-1
Debian:13python-django3:4.2.27-0+deb13u1DEBIAN-CVE-2025-59681
Debian:14python-django3:4.2.25-1DEBIAN-CVE-2025-59681
PyPIdjango4.2.25, 5.1.13, 5.2.7PYSEC-2025-106
PyPIdjango5.2.7GHSA-hpr9-3m2g-3j9p
PyPIdjango5.1.13GHSA-hpr9-3m2g-3j9p
PyPIdjango4.2.25GHSA-hpr9-3m2g-3j9p
Ubuntu:22.04:LTSpython-django2:3.2.12-2ubuntu1.22USN-7794-1
Ubuntu:22.04:LTSpython-django2:3.2.12-2ubuntu1.22UBUNTU-CVE-2025-59681
Ubuntu:24.04:LTSpython-django3:4.2.11-1ubuntu1.11UBUNTU-CVE-2025-59681
Ubuntu:24.04:LTSpython-django3:4.2.11-1ubuntu1.11USN-7794-1
Ubuntu:25.10python-django3:5.2.4-1ubuntu2UBUNTU-CVE-2025-59681
Ubuntu:26.04:LTSpython-django3:5.2.4-1ubuntu2UBUNTU-CVE-2025-59681

Affected products (as reported)

VendorProductVersions
djangoproject Django 4.2 – before 4.2.255.1 – before 5.1.135.2 – before 5.2.7

Weakness: CWE-89 · Vector: CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:N

References