CVE-2025-59681
JSON

7.1high

Django vulnerable to SQL injection in column aliases

Severity
7.1high CVSS:3.1 by mitre
Exploit likelihood
0.66% (higher than 52% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
mitre
Also known as
GHSA-hpr9-3m2g-3j9pBIT-DJANGO-2025-59681PYSEC-2025-106

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

Product or packageVersionsReported by
djangoproject Djangofrom 4.2 before 4.2.25, from 5.1 before 5.1.13, from 5.2 before 5.2.7CVE List, NVD
django (PyPI)from 4.2 before 4.2.25, from 5.1 before 5.1.13, from 5.2 before 5.2.7GitHub Advisory Database, PyPA Advisory Database
django (Bitnami)from 4.2.0 before 4.2.25, from 5.1.0 before 5.1.13, from 5.2.0 before 5.2.7Bitnami Vulnerability Database

All scores

mitre7.1high CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:N
GitHub7.1high CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:N
NVD9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
PyPA Advisory Database9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Bitnami Vulnerability Databasecritical rating

Classification

CWE-89

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

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

NVD (es)

Se descubrió un problema en Django 4.2 anterior a 4.2.25, 5.1 anterior a 5.1.13 y 5.2 anterior a 5.2.7. QuerySet.annotate(), QuerySet.alias(), QuerySet.aggregate() y QuerySet.extra() están sujetos a inyección SQL en los alias de columna, al usar un diccionario adecuadamente diseñado, con expansión de diccionario, como los kwargs pasados a estos métodos (en MySQL y MariaDB).

References

https://docs.djangoproject.com/en/dev/releases/security/advisory, vendor-advisory
https://groups.google.com/g/django-announceadvisory, release-notes, vendor-advisory, web
https://www.djangoproject.com/weblog/2025/oct/01/security-releases/advisory, release-notes, vendor-advisory
http://www.openwall.com/lists/oss-security/2025/10/01/3web
https://nvd.nist.gov/vuln/detail/CVE-2025-59681advisory, web
https://github.com/django/django/commit/41b43c74bda19753c757036673ea9db74acf494aweb
https://github.com/django/django/commit/43d84aef04a9e71164c21a74885996981857e66eweb
https://docs.djangoproject.com/en/dev/releases/securityweb
https://github.com/django/djangopackage
https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2025-106.yamlweb
https://www.djangoproject.com/weblog/2025/oct/01/security-releasesweb
https://github.com/advisories/GHSA-hpr9-3m2g-3j9padvisory

Sources

SourceRecordLicence
CVE ListCVE-2025-59681 changed 2025-11-04CVE Terms of Use
GitHub Advisory DatabaseGHSA-hpr9-3m2g-3j9p changed 2026-09-10CC-BY-4.0
NVDCVE-2025-59681 changed 2026-10-12Public domain
PyPA Advisory DatabasePYSEC-2025-106 changed 2026-06-10CC-BY-4.0
Bitnami Vulnerability DatabaseBIT-DJANGO-2025-59681 changed 2026-09-08Apache-2.0