{"id":"CVE-2025-59681","title":"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","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 …","severity":"high","cvss":7.1,"cvssVector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:N","cwe":["CWE-89"],"vendor":"djangoproject","product":"django","affected":["django >= 4.2, < 4.2.25","django >= 5.1, < 5.1.13","django >= 5.2, < 5.2.7"],"patched":["django 5.2.7"],"published":"2025-10-01","updated":"2026-06-17","sourceUpdated":"2026-06-17T09:46:30.740","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2025-59681","references":[{"url":"https://docs.djangoproject.com/en/dev/releases/security/","label":"cve@mitre.org"},{"url":"https://groups.google.com/g/django-announce","label":"cve@mitre.org"},{"url":"https://www.djangoproject.com/weblog/2025/oct/01/security-releases/","label":"cve@mitre.org"},{"url":"http://www.openwall.com/lists/oss-security/2025/10/01/3","label":"af854a3a-2127-422b-91ae-364da2661108"},{"url":"https://security.access.redhat.com/data/csaf/v2/vex/2025/cve-2025-59681.json"},{"url":"https://access.redhat.com/security/cve/CVE-2025-59681"},{"url":"https://bugzilla.redhat.com/show_bug.cgi?id=2400449"},{"url":"https://www.cve.org/CVERecord?id=CVE-2025-59681"},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-59681"},{"url":"https://access.redhat.com/errata/RHSA-2025:18984"},{"url":"https://access.redhat.com/errata/RHSA-2025:23196"}],"tags":["nvd","cve.org","csaf","vex","red-hat"],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"partial","timestamp":"2025-10-01T19:12:04.911087Z"},"ingestedAt":"2026-09-14T00:17:34.983Z","epss":0.00625,"epssPercentile":0.48277,"scores":{"nvd":7.1,"vendor":8.1},"slug":"CVE-2025-59681","body":"## Overview\n\nAn 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).\n\n## Affected\n\n- `django >= 4.2, < 4.2.25`\n- `django >= 5.1, < 5.1.13`\n- `django >= 5.2, < 5.2.7`\n\n## Remediation\n\nUpgrade past the affected range:\n\n- `django 5.2.7`\n\n## Vendor advisories\n\n- **RHSA-2025:18984** · Red Hat · fixed in: Red Hat Ansible Automation Platform 2.5 for RHEL 8 · released 2025-10-22 · [advisory](https://access.redhat.com/errata/RHSA-2025:18984)\n- **RHSA-2025:23196** · Red Hat · fixed in: Red Hat Ansible Automation Platform 2.6 · released 2025-12-15 · [advisory](https://access.redhat.com/errata/RHSA-2025:23196)\n- **Red Hat VEX** · Important · affected: OpenShift Service Mesh 3, Red Hat Certification for Red Hat Enterprise Linux 7, Red Hat Discovery 2 · no fix planned: OpenShift Service Mesh 3, Red Hat Certification for Red Hat Enterprise Linux 7, Red Hat Discovery 2 · updated 2026-09-21 · [vex](https://security.access.redhat.com/data/csaf/v2/vex/2025/cve-2025-59681.json)","depth":"twilight","depthScore":39,"depthScoreParts":{"impact":39.1,"likelihood":0.1,"exploitation":0,"ransomware":0},"changes":[]}