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 package | Versions | Reported by |
|---|---|---|
| djangoproject Django | from 4.2 before 4.2.25, from 5.1 before 5.1.13, from 5.2 before 5.2.7 | CVE List, NVD |
| django (PyPI) | from 4.2 before 4.2.25, from 5.1 before 5.1.13, from 5.2 before 5.2.7 | GitHub 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.7 | Bitnami Vulnerability Database |
All scores
| mitre | 7.1high CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:N |
| GitHub | 7.1high CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:N |
| NVD | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| PyPA Advisory Database | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| Bitnami Vulnerability Database | critical rating |
Classification
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
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-59681 changed 2025-11-04 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-hpr9-3m2g-3j9p changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2025-59681 changed 2026-10-12 | Public domain |
| PyPA Advisory Database | PYSEC-2025-106 changed 2026-06-10 | CC-BY-4.0 |
| Bitnami Vulnerability Database | BIT-DJANGO-2025-59681 changed 2026-09-08 | Apache-2.0 |