News Digital & Internet News

Django Patches Critical Django4Shell Flaw That Allows Remote Code Execution

A software engineer coding on dual monitors in a modern office
Table of Contents

Django Patches Critical Django4Shell Flaw That Allows Remote Code Execution

Django released security fixes on Wednesday for a critical flaw dubbed Django4Shell that lets attackers run code on web servers.

The flaw sits in GeoDjango, a mapping tool used by government, farm and science sites, and it can be reached through ordinary web forms. Sites should update at once, since the fix is simple and the risk is high.

What Django4Shell is

Django4Shell is tracked as CVE-2026-124827. It is a flaw in GeoDjango, the part of Django that handles maps and location data. The flaw was found by Mohamed K. Fathy, head of cyber security at Robusta Technology Group, who gave it the Django4Shell name. Django rates the flaw 8.8 out of 10 for severity.

The flaw is the third try at fixing the same weak spot. An earlier flaw, CVE-2026-15307, was fixed in August 2026. That flaw let attackers write files to a server through GeoDjango’s map lookup tools. A second fix, for CVE-2026-87890, tried to close the gap but left a new hole: attackers could trick a server into making requests to internal systems, a trick known as server-side request forgery. Django4Shell is the hole that fix missed.

Remote code execution means an attacker can run their own code on a victim’s server. That is one of the worst outcomes for a web flaw, because it can give the attacker full control of the site and its data.

How the attack works

The flaw lives in the way Django handles a field called RasterField, which stores map raster data. Raster data is grid-based map data, such as satellite images or height maps. When a site lets users send raster data through a form, Django turns that data into a file using a library called GDAL, which reads map and image data.

The problem is that the safety checks did not cover the RasterField assignment path. If an attacker sends a crafted JSON raster body with a user-controlled name and a non-default driver, GDAL can be made to write a file to a place the attacker chooses. Fathy put it plainly: “The attacker controls the target path, file content, and filename via a crafted JSON raster body.”

That control lets an attacker overwrite a site’s source code, drop a web shell into a public folder, or corrupt config files. A web shell is a hidden page that lets an attacker control a server through a browser. One key trick is to write a file called sitecustomize.py into the worker’s current folder. Python runs that file by itself when it starts, so the attacker’s code runs the next time the server reloads, a worker starts, a scheduled job runs, or a new process starts, all with the web server’s rights.

A programmer working on code across multiple screens in a modern office setting
A programmer works on code across multiple screens in a modern office.

Attackers can also drop .pth files into the site-packages folder, read secrets and settings, steal or change data, and move deeper into the network. All of this can happen without any database call or any model ever being saved. The attack needs only staff-level access to the site, Fathy said, which is a lower bar than admin rights.

Three of the four conditions the attack needs are met by default on most sites. Many sites use GeoDjango with a RasterField model, and many expose that field through a form or the admin area. The GDAL driver the attack needs ships in nearly every standard GDAL build. The only condition that varies is whether the target folder can be written to, and the worker’s folder usually can be.

What Django fixed in this release

Django released versions 6.1.4, 6.0.11 and 5.2.20 on Wednesday to fix seven security flaws, including Django4Shell. The Hacker News reported that the new releases also fix a SQL injection flaw in range and “in” lookups, tracked as CVE-2026-132092 and rated 9.8 out of 10 by security firm Upwind.

The same releases fix a cross-site scripting flaw in the truncatechars_html template filter, tracked as CVE-2026-115868, and a cache poisoning flaw caused by dot segments in request paths, tracked as CVE-2026-125673. Cross-site scripting lets an attacker run scripts in a victim’s browser, while cache poisoning tricks a server into serving the wrong page to visitors.

For Django4Shell itself, the fix makes RasterField non-editable by default. It also raises an error when a dict or JSON string asks for a non-default driver. Django warns that server-side request forgery is still possible if untrusted input reaches RasterField, so site owners must check that input before it is used.

Django has not reported any attacks using the flaw, and the flaw is not listed in the US CISA catalog of known exploited flaws. That catalog, in its version dated November 30, does not include CVE-2026-124827. Even so, the ease of the attack means sites should not wait.

What site owners should do now

Site owners should update to Django 6.1.4, 6.0.11 or 5.2.20 at once. The update is a patch release, which means it should not break existing code. Sites on older versions that are no longer supported, including 5.1, 5.0 and 4.2, were not checked and may also be at risk, so those sites should move to a supported version.

After updating, owners should check where RasterField is used. Any form or API that takes raster data from users needs a review. Untrusted input should never reach RasterField without checks. The case is a reminder to check the code your site depends on, as our guide to software supply chain security explains.

The Django security advisory lists all seven flaws and the fixed versions. Site owners who run GeoDjango in production should treat this update as urgent, since the flaw is public, the attack is simple, and the fix is ready.

Frequently Asked Questions

What is Django4Shell?

A critical flaw in Django’s GeoDjango mapping tool, tracked as CVE-2026-124827. It lets an attacker write files to a server through a crafted raster data field, which can lead to remote code execution. Django rates it 8.8 out of 10.

Which Django versions are affected?

Django 5.2 before 5.2.20, 6.0 before 6.0.11 and 6.1 before 6.1.4. Older unsupported versions, including 5.1, 5.0 and 4.2, were not checked and may also be affected.

How does the attack work?

An attacker with staff-level access sends a crafted raster definition to a form or API that uses RasterField. The GDAL library then writes a file, such as sitecustomize.py, to a place Python loads at start-up, so the attacker’s code runs with the server’s rights.

What should site owners do?

Update to Django 6.1.4, 6.0.11 or 5.2.20 at once. The fix makes RasterField non-editable by default. Site owners should also check that untrusted input never reaches RasterField.

Sources

Caleb Cox
Digital & Internet News Correspondent

Caleb Cox

Caleb Cox covers digital and internet news for Time of Explorer — the platforms, trends and stories of the online world. He has followed the internet industry for seven years, from social platforms to the infrastructure underneath them.

View Full Author Profile →
Keep Reading

Related Stories

More in News →