CVE-2025-64459Djangoproject Django
SQL Injection in Django QuerySet and Q()
Critical 9.1 No auth needed
Follow: this CVE · Djangoproject · Djangoproject Django We alert you by email or Slack (account required).
- Priority
- 70
- CVSS 3.1
- 9.1
- EPSS
- —
- Auth required
- No
- Published
- Nov 5, 2025
- Updated
- Jun 17, 2026
- Category
- Application · Cross-platform
- Weakness (CWE)
- CWE-89
- SSVC (CISA)
- Exploitation: none · Automatable: yes · Technical impact: total
- Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N
What happens
Django 4.2, 5.1, and 5.2 are vulnerable to SQL injection in QuerySet.filter(), QuerySet.exclude(), QuerySet.get() methods and the Q() class when a specially crafted dictionary with dictionary expansion is used as the _connector argument. An unauthenticated attacker can execute arbitrary SQL queries against the database.
Show the original NVD text
An issue was discovered in 5.1 before 5.1.14, 4.2 before 4.2.26, and 5.2 before 5.2.8.
The methods `QuerySet.filter()`, `QuerySet.exclude()`, and `QuerySet.get()`, and the class `Q()`, are subject to SQL injection when using a suitably crafted dictionary, with dictionary expansion, as the `_connector` argument.
Earlier, unsupported Django series (such as 5.0.x, 4.1.x, and 3.2.x) were not evaluated and may also be affected.
Django would like to thank cyberstan for reporting this issue.
What to do
Patch available · fixed versions: 4.2.26, 5.1.14, 5.2.8
Update Django to version 4.2.26, 5.1.14, or 5.2.8 depending on your series.
- Apply the vendor's security update for Django.
- It can be exploited without authentication: if you cannot patch now, restrict Internet access to the affected service.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | How to upgrade |
|---|---|---|---|---|
| PyPI | django |
≥ 5.2a1 < 5.2.8 |
5.2.8 |
pip install "django>=5.2.8" |
| PyPI | django |
≥ 5.0a1 < 5.1.14 |
5.1.14 |
pip install "django>=5.1.14" |
| PyPI | django |
< 4.2.26 |
4.2.26 |
pip install "django>=4.2.26" |
| PyPI | django |
≥ 4.2 < 4.2.26 |
4.2.26 |
pip install "django>=4.2.26" |
| PyPI | django |
≥ 5.1 < 5.1.14 |
5.1.14 |
pip install "django>=5.1.14" |
| PyPI | django |
≥ 5.2 < 5.2.8 |
5.2.8 |
pip install "django>=5.2.8" |
Per OSV / GitHub Advisories (GHSA-frmv-pr5f-9mcr, PYSEC-2025-108). Check the version in your lockfile before upgrading.
Affected products (CPE)
| Vendor | Product | Versions |
|---|---|---|
| djangoproject | django | ≥ 4.2 < 4.2.26 |
| djangoproject | django | ≥ 5.1 < 5.1.14 |
| djangoproject | django | ≥ 5.2 < 5.2.8 |
On social media
1 person and 1 post on Bluesky in the last 30 days.
Most recent posts, without bots or automated feeds. The text belongs to its authors. Search on Bluesky
Official sources
References
Links published by the sources. Open them with care.
- docs.djangoproject.com Vendor Advisory
- groups.google.com Mailing List
- www.djangoproject.com Vendor Advisory
- shivasurya.me Exploit Third Party Advisory