An issue was discovered in Django 6.1 before 6.1.4, 6.0 before 6.0.11, and 5.2 before 5.2.20.
The `range` and `in` lookups are subject to SQL injection in a query involving aliases or key transforms containing percent signs.
Earlier, unsupported Django series (such as 5.1.x, 5.0.x, and 4.2.x) were not evaluated and may also be affected.
Django would like to thank Cristian Panaro for reporting this issue.
In plain language
Written by AI from the record
A serious flaw in the Django web framework lets attackers manipulate database queries under certain conditions, but there's no sign yet of attackers actively exploiting it, so you should patch soon but not panic.
SQL injection in Django's `range` and `in` lookups occurs when queries use aliases or key transforms containing percent signs, allowing unauthenticated attackers to manipulate backend SQL without user interaction.
If you're affected
Customer data exposure
Database tampering or deletion
Unauthorized data access
Application compromise
What is it
Django is a popular toolkit many websites and business apps are built on, including the part that talks to the database. This flaw is like a hidden backdoor in how the toolkit builds certain database search queries — if a search uses a specific pattern with percent signs in it, an attacker could sneak in commands that read, change, or destroy data instead of just searching it.
Who is affected
This matters to you if your website, internal tool, or customer-facing app was built using the Django framework, specifically versions 6.1 (before 6.1.4), 6.0 (before 6.0.11), or 5.2 (before 5.2.20). Older unsupported Django versions (5.1, 5.0, 4.2) haven't been checked and may also be vulnerable. Ask whoever built or maintains your software which Django version is in use.
How urgent is it
There is no evidence of attackers exploiting this yet, and no public exploit code exists, but the flaw is severe and a vendor patch is already available. Treat this as a priority to fix in the near term rather than an emergency to drop everything for right now.
What to do — in detail
Confirm exposure by identifying all Django deployments and their version numbers, then audit code for range or in lookups applied to field aliases or key transforms involving percent signs (%) — this is the specific trigger pattern. Upgrade to the fixed version matching your branch: 6.1.4 (from 6.1.x), 6.0.11 (from 6.0.x), or 5.2.20 (from 5.2.x); these are patch-level releases with no expected breaking changes. If running an older unsupported series (5.1.x, 5.0.x, 4.2.x), these have not been evaluated by the vendor — plan an upgrade to a supported, patched series as soon as possible. As a temporary mitigation if immediate patching isn't possible, review and restrict any user-controllable input that reaches range/in lookup aliases or key transforms. No KEV listing or CISA due date applies currently; monitor for the appearance of public exploit code or KEV addition, which would elevate urgency.
Technical context
CVSS 9.8 (Critical), AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H — network-exploitable, no privileges or user interaction required, full impact on confidentiality, integrity, and availability. Weakness: CWE-89 (SQL Injection), triggered via Django's range/in ORM lookups when combined with aliases or key transforms containing percent signs. Not listed in CISA KEV; no public exploit code known; press attention is limited to patch-release coverage, not exploitation reports. Exploit maturity is currently theoretical/PoC-absent, warranting proactive patching ahead of any weaponization.
This is a general assessment based on public vulnerability data. It does not account for your specific infrastructure — when in doubt, consult a security specialist.