blog

Django has seven new security fixes, two rated high. Update your app this week

If your business runs a web app built with Django, it needs updating this week. Yesterday the Django team released 6.1.4, 6.0.11 and 5.2.20, which fix seven security issues, and two of them are rated high.

Nobody is reporting attacks yet. That's the best time to do it.

What happened

Django is one of the most widely used Python frameworks for building web apps. If someone built you a booking system, a customer portal or an internal tool in Python, there's a fair chance it's Django underneath. You won't see it from the outside, which is why I'd ask whoever built it.

The Django team published the fixes on 2 December in a security release post. Their advice is short: "We encourage all users of Django to upgrade as soon as possible."

The affected versions are 6.1, 6.0 and 5.2, which are all the series Django still supports.

The two that matter most

A file-write flaw in GeoDjango (CVE-2026-124827). This only affects apps that store map raster data using GeoDjango's RasterField on a PostGIS database. In those apps, an attacker could get the server to write a file to a place of their choosing. Django says that "depending on the raster driver, this could enable remote code execution". That means running their own code on your server.

The worrying part is that it was reachable by default through the Django admin, ordinary model forms and writable API serializers. Most business apps don't use raster fields at all. If yours is a mapping or property app, ask the question.

A possible SQL injection (CVE-2026-132092). This one is in the range and in database lookups. It needs fairly unusual code to trigger: percent signs in query aliases or key transforms, plus a couple of other conditions. Most apps won't be exposed, but I wouldn't want to bet on it without reading the code, and updating is quicker than reading the code.

The other five are rated moderate or low. One is a cross-site scripting risk in the truncatechars_html template filter. Another is a cache poisoning bug that matters if your app uses Django's page caching, which I'll come back to.

Does it affect you?

You're affected if your app runs Django 6.1, 6.0 or 5.2 below the fixed versions. That's anything older than 6.1.4, 6.0.11 or 5.2.20.

If you're still on Django 4.2 or older, there's a different problem. According to Django's download page, 4.2 stopped getting security fixes on 7 April this year. It isn't on the affected list, but that doesn't mean it's safe. It just means nobody is checking it any more.

What to do this week

1. Find out which version you're running. On the server, activate the app's virtual environment and run:

python -m django --version

If you don't know where the virtual environment is, the app's requirements.txt or pyproject.toml usually names the Django version it expects.

2. Update to the fixed version for your series. For example, on 5.2:

pip install "Django==5.2.20"

Then change the pinned version in requirements.txt to match, so the next deploy doesn't quietly put the old one back. Try it on a staging copy first if you have one. These are security releases within the same series, so they shouldn't break much, but I'd still rather find out on staging.

3. Restart the app. Python apps load Django once when they start. Until you restart Gunicorn, uWSGI or whatever runs the app, the old code is still the code that's running.

4. Clear the cache if you use page caching. Django's post says existing cached responses aren't cleared by the update, and advises clearing any that might be affected. If your app uses cache_page() or UpdateCacheMiddleware, my suggestion is to run python manage.py shell and then from django.core.cache import cache; cache.clear(). Be aware that clears everything in that cache, so the site may be a little slower for a few minutes.

5. If it's on 4.2 or older, plan the move. Getting from 4.2 to 5.2 is a proper upgrade, not a one-line change. It's worth doing before the next high-rated fix lands, not after.

The bigger point

This is Django's second security release in a month, after another batch on 3 November. The time between a fix being published and someone working out how to attack it keeps shrinking, too. Dev Partners wrote about how AI can now turn a published patch into an attack.

The hard part usually isn't the update. It's knowing the app is Django in the first place, and finding someone who knows where it lives. A lot of these apps were built by a developer or agency who has since moved on. If that's you, Dev Partners wrote a good piece on what to do if your software supplier disappears, and the team there take on existing software and keep it patched.

And if you're not sure what's actually running on your server, finding out is the first thing my health check does.