SQL injection in djangoproject Django
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Impact type
- SQL injection
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Partial Red Hat: 2 fixed, 3 without a fix
Attack profile from CVSS 3.1 · NVD. Fix status from CNA, GitHub and Red Hat. Impact type from CWE-89.
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).
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- No
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| djangoproject | Django | 4.2 to before 4.2.25; 5.1 to before 5.1.13; 5.2 to before 5.2.7 | 4.2.25, 5.1.13, 5.2.7 | Patch available | CNA |
| — | Django (PyPI) | 4.2 to before 4.2.25 | 4.2.25 | Patch available | GHSA-hpr9-3m2g-3j9p |
| — | Django (PyPI) | 5.1 to before 5.1.13 | 5.1.13 | Patch available | GHSA-hpr9-3m2g-3j9p |
| — | Django (PyPI) | 5.2 to before 5.2.7 | 5.2.7 | Patch available | GHSA-hpr9-3m2g-3j9p |
- Django Vendordjangoproject Affected 4.2 to before 4.2.25; 5.1 to before 5.1.13; 5.2 to before 5.2.7 Fixed in 4.2.25, 5.1.13, 5.2.7 Patch available CNA
- Django (PyPI) Vendor— Affected 4.2 to before 4.2.25 Fixed in 4.2.25 Patch available GHSA-hpr9-3m2g-3j9p
- Django (PyPI) Vendor— Affected 5.1 to before 5.1.13 Fixed in 5.1.13 Patch available GHSA-hpr9-3m2g-3j9p
- Django (PyPI) Vendor— Affected 5.2 to before 5.2.7 Fixed in 5.2.7 Patch available GHSA-hpr9-3m2g-3j9p
CPE configurations NVD · 1
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:djangoproject:django:*:*:*:*:*:*:*:* | 4.2 to before 4.2.25; 5.1 to before 5.1.13; 5.2 to before 5.2.7 | Vulnerable | djangoproject |
- cpe:2.3:a:djangoproject:django:*:*:*:*:*:*:*:* Versions 4.2 to before 4.2.25; 5.1 to before 5.1.13; 5.2 to before 5.2.7 Vulnerable ·djangoproject
Remediation
- Fix · CNA Django (djangoproject) Fixed in 4.2.25, 5.1.13, 5.2.7
- Fix · GHSA-hpr9-3m2g-3j9p Django (PyPI) Fixed in 4.2.25 Advisory →
- Fix · GHSA-hpr9-3m2g-3j9p Django (PyPI) Fixed in 5.1.13 Advisory →
- Fix · GHSA-hpr9-3m2g-3j9p Django (PyPI) Fixed in 5.2.7 Advisory →
Red Hat 2 advisories
- RHSA-2025:23196 Released 2025-12-15 · Red Hat rating ImportantRed Hat Ansible Automation Platform 2.6 Ansible DevSpaces Container Release Update
- Red Hat Ansible Automation Platform 2.6 registry.redhat.io/ansible-automation-platform-tech-preview/ansible-devspaces-rhel9
- RHSA-2025:18984 Released 2025-10-22 · Red Hat rating ImportantRed Hat Ansible Automation Platform 2.5 Container Release Update
- Red Hat Ansible Automation Platform 2.5 for RHEL 8 ansible-automation-platform-25/lightspeed-chatbot-rhel8, ansible-automation-platform-25/lightspeed-rhel8
Fixed in the same release
Records fixed by the same vendor advisory or release, as the CNA lists them.
- Release ·
djangoproject Django 4.2.25, 5.1.13, 5.2.7
2 records Highest priority Priority MEDIUM 1 MEDIUM, 1 LOW
Other records, highest priority first
- TI-2025-37145 Path traversal in djangoproject DjangoPriority LOW 31
Vendor assessments
Red Hat
Red Hat rating: Important. Red Hat's page for this CVE →
| Product | Status | Plan or fix |
|---|---|---|
| OpenShift Service Mesh 3 | Affected | No fix yet |
| Red Hat Certification for Red Hat Enterprise Linux 7 | Affected | No fix yet |
| Red Hat Discovery 2 | Affected | No fix yet |
| Red Hat Ansible Automation Platform 2.5 for RHEL 8 | Fixed | RHSA-2025:18984 |
| Red Hat Ansible Automation Platform 2.6 | Fixed | RHSA-2025:23196 |
Not affected: 10 products
- OpenShift Service Mesh 3
- Red Hat Ansible Automation Platform 2
- Red Hat Ansible Automation Platform 2.5 for RHEL 8
- Red Hat Ansible Automation Platform 2.5 for RHEL 9
- Red Hat Discovery 1
- Red Hat OpenStack Platform 16.2
- Red Hat OpenStack Platform 17.1
- Red Hat OpenStack Platform 18.0
- Red Hat Satellite 6
- Red Hat Update Infrastructure 4 for Cloud Providers
Timeline
- 2026-10-02 Threatist record created from CVE-2025-59681
- 2026-10-03 Alias added: GHSA-hpr9-3m2g-3j9p
- 2026-10-23 EPSS moved to the 50th–90th percentile
References
Advisory 4
Other 7
- https://github.com/django/django/commit/41b43c74bda19753c757036673ea9db74acf494a
- https://github.com/django/django/commit/43d84aef04a9e71164c21a74885996981857e66e
- https://docs.djangoproject.com/en/dev/releases/security
- https://github.com/django/django
- https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2025-106.yaml
- https://www.djangoproject.com/weblog/2025/oct/01/security-releases
- http://www.openwall.com/lists/oss-security/2025/10/01/3
More djangoproject Django vulnerabilities
- TI-2022-15177 An issue was discovered in Django 3.2 before 3.2.14 and 4.0 before 4.0.6. CVSS 3.1CRITICAL 9.8
- TI-2020-05994 Django 1.11 before 1.11.28, 2.2 before 2.2.10, and 3.0 before 3.0.3 allows SQL Injection… CVSS 3.1CRITICAL 9.8
- TI-2023-10198 An issue was discovered in the Multipart Request Parser in Django 3.2 before 3.2.18, 4.0… CVSS 3.1HIGH 7.5
- TI-2019-14306 Django before 1.11.27, 2.x before 2.2.9, and 3.x before 3.0.1 allows account takeover. CVSS 3.1CRITICAL 9.8
- TI-2019-10595 An issue was discovered in Django 1.11.x before 1.11.23, 2.1.x before 2.1.11, and 2.2.x… CVSS 3.0CRITICAL 9.8
- TI-2021-14006 Django 3.1.x before 3.1.13 and 3.2.x before 3.2.5 allows QuerySet.order_by SQL injection… CVSS 3.1CRITICAL 9.8
Sources
- CVE-2025-59681 · CVE Program
- CVE-2025-59681 · NVD
- FIRST EPSS
- GHSA-hpr9-3m2g-3j9p · GitHub Advisory Database · CC BY 4.0
- CVE-2025-59681 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences