If your team writes Django and assumes the ORM takes SQL injection off the table, this release is worth ten minutes of your time. The Django SQL injection fixed on 2 December 2026 is reachable through __range and __in, with no raw SQL anywhere in sight. The team shipped security releases 6.1.4, 6.0.11 and 5.2.20 covering seven CVEs, two of them rated high.
So the job today isn't just pip install -U and move on. The fix carries a small breaking change that can fail your existing code, and one of the other issues needs a cache flush afterwards.
What's in the release
Seven CVEs, ordered by severity as the Django team published them:
CVE-2026-132092(high) SQL injection inrangeandinlookupsCVE-2026-124827(high) server-side file write via GeoDjango'sRasterField, which can escalate to RCE depending on the raster driverCVE-2026-115868(moderate) XSS intruncatechars_htmlandTruncator.chars()withhtml=TrueCVE-2026-125673(low) cache poisoning throughbuild_absolute_uri()mishandling.and..path segmentsCVE-2026-119642(low) admin changelist data leak via thepkalias on aOneToOneFieldprimary keyCVE-2026-127929(low) admin changelist data leak via reverse relations, a regression introduced in Django 5.0.3CVE-2026-132809(low) heap buffer overflow inOGRGeometry.wkbfor geometries larger than 4GB
Affected branches are main, 6.1, 6.0 and 5.2. If you're still on 5.1 or older there is no patch for you: the supported versions table now lists only 5.2 LTS, 6.0 and 6.1.
The Django SQL injection you can reach through the ORM
This is the interesting one, because it breaks the comfortable assumption that the ORM has SQL injection covered end to end. The 6.1.4 release notes spell out the conditions: the query has to involve an alias or key transform containing a percent sign, and then
__rangeis exploitable when more than two right-hand-side values are passed, which was already incorrect usage, except Django never complained about it before__inis exploitable when a bilateral transform is involved
The shape that shows up in real codebases is code that forwards a list straight from the query string into a filter:
# values come from ?d=... and go into __range as-is
dates = request.GET.getlist("d")
Order.objects.filter(created_at__range=dates)With three or more values, that used to run quietly. Now range requires exactly two right-hand-side values, which makes it the single backwards-incompatible change in this release. If you are passing more, you'll get an error the moment you upgrade, and honestly that's better than it silently working.
The other half to clean up is aliases and key transforms with a % in the name:
# an alias with a percent sign in it is exactly what the release note describes
Report.objects.annotate(**{"growth_%": F("growth")}).filter(...)Percent signs in column aliases and key transforms have been deprecated since Django 6.0 and are scheduled for removal in Django 2028. If your code still has them, pay that debt now rather than waiting for it to break on you later.
RasterField can write files on your server
CVE-2026-124827 is narrower but nastier. It needs GeoDjango's RasterField, which only exists on PostGIS, so if your project doesn't touch raster data you can skip it. Plain geometry fields were not affected.
The problem: assigning a raster data definition with a user-controlled name and a non-default driver could make GDAL write a file to a location the attacker picks, and the advisory says that depending on the driver this could enable remote code execution. The reason it was easy to reach is that RasterField falls back to the CharField form field, so it was exposed by default in the admin, in ModelForms and in writable model serializers.
The fix works on two levels. RasterField now defaults editable to False, so it drops out of ModelForms unless you include it explicitly, and assigning a dict or JSON string that specifies a non-default driver raises GDALException. If you genuinely need another driver, wrap the definition in GDALRaster to mark the value as trusted.
Which version to move to, and what to check afterwards
Upgrade to 6.1.4, 6.0.11 or 5.2.20, matching the branch you're on. On 5.1 or older, the realistic plan is to land on 5.2 LTS first and climb from there.
# pin the minor, take the patch
pip install -U "Django>=6.1.4,<6.2"
python -m django --version
# while you're here, sweep the rest of the dependency tree
pip install pip-audit && pip-auditFive things worth walking through once the upgrade is in:
- Grep for
__rangeeverywhere and look for calls passing more than two values, or taking a list straight off the request. - Grep for
%inannotate()alias names and inJSONFieldkey transforms, and rename them. - If you use
cache_page()orUpdateCacheMiddleware, clear the cache after upgrading. Existing poisoned entries are not invalidated for you. - If you have a
RasterFieldin the admin or aModelForm, verify the form still does what you expect, because the field no longer appears on its own. - Review staff accounts that only have view permission in the admin. The two remaining data-leak CVEs let that group enumerate values from the changelist, and multi-table inheritance models were affected by default.
How urgent is it? My take: the two high-severity issues should hit staging today and production on your next deploy, not next sprint. The preconditions are not exotic and the patch is small. The moderate and low ones ride along in the same upgrade; there's no reason to split them out.
The lesson worth keeping
The ORM protects the part it controls, which is the values it passes as parameters. What it does not protect is the names: column names, alias names, field names you assemble as strings yourself, plus anywhere you step out to extra(), RawSQL() or .raw(). Those are the spots that deserve extra attention in code review.
The practical rule: input from users may only ever be a value, never a name inside the query. When users genuinely need to pick a column or a sort order, map their input through an allow-list of constants in your code. It's the same shift the front-end tooling world is making with dev servers, which we wrote about in Vite 8.4's allow-list mode: stop guessing what's dangerous and state what's permitted instead.
The other half is making advisories come to you instead of you going to look for them, whether that's the Django mailing list, Dependabot or pip-audit in CI. Finding out about a SQL injection a week late is very different from finding out on day one. We made the same point about framework-level flaws in our write-up of the React Server Components RCE.
If your team is stuck on an old Django version and upgrades keep slipping, or you want dependency and advisory tracking handled properly, let's talk.
Talk to our team



