CVE-2026-124827

Arbitrary File Write
Affects
Django
in
Django
No items found.
Versions
<6.1.4, <6.0.11, <5.2.20

Patch Available.

Exclamation circle icon
Patch Available

This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.

Overview

Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. It provides built-in components for handling common web development tasks such as authentication, database interaction, and request routing. Its GeoDjango module (django.contrib.gis) adds geographic data support, including raster fields on PostGIS databases.

‍

A server-side file-write vulnerability (CVE-2026-124827), also referred to in press coverage as "Django4Shell", has been identified in Django. Assigning a raster data definition to a RasterField with a user-controlled name and a non-default driver can make GDAL create a file at an attacker-controlled location. Depending on the raster driver, this could enable remote code execution.

‍

This weakness is classified as CWE-73: External Control of File Name or Path.

‍

Details

Module Info

  • Product: Django
  • Affected packages: django (django.contrib.gis.db.models.RasterField)
  • Affected versions: <6.1.4, <6.0.11, <5.2.20
  • GitHub repository: https://github.com/django/django
  • Published packages: https://pypi.org/project/Django/
  • Package manager: pip
  • Fixed in (Django upstream releases):
    • Django 6.1.4
    • Django 6.0.11
    • Django 5.2.20

‍

Vulnerability Info

This High-severity vulnerability is found in the contrib.gis (GeoDjango) package of Django 6.1 before 6.1.4, 6.0 before 6.0.11, and 5.2 before 5.2.20. RasterField is only implemented on PostGIS.

‍

Django rates this issue High. The CNA record, assigned by the Django Software Foundation, gives it a CVSS v3.1 base score of 8.8 (High) with the vector CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.

‍

Assigning a raster data definition, either a dictionary or a JSON string, to a RasterField is intended to describe the raster to create. If the definition carries a user-controlled name and selects a non-default GDAL driver, GDAL can write a file to an attacker-controlled location on the server. Depending on the raster driver, this could enable remote code execution.

‍

Because RasterField falls back to the CharField form field, the issue is reachable by default on models that have a RasterField registered in the Django admin, or that are used through ModelForms or writable model serializers. Geometry fields are not affected.

‍

Earlier, unsupported Django series (such as 5.1.x, 5.0.x, and 4.2.x) were not evaluated by the Django project and may also be affected.

‍

Mitigation

Users of the affected components should apply one of the following mitigations:

  • Upgrade to a patched version of Django: 6.1.4, 6.0.11, or 5.2.20.
  • Do not assign untrusted input to a RasterField as a raster data definition. Validate any such input first, and do not expose RasterField through the admin, ModelForms, or writable serializers to users you do not trust.
  • Leverage a commercial support partner like HeroDevs (NES for Django) for post-EOL security support.

‍

The upstream fix makes RasterField non-editable by default, so it is excluded from ModelForms unless explicitly included. Assigning a dictionary or JSON string that uses a non-default driver now raises a GDALException. To use another driver, wrap the definition in a GDALRaster, which marks it as trusted.

‍

Server-side request forgery (SSRF) is still possible if untrusted input is assigned to a RasterField, so validate that input before use.

‍

Django versions that have reached End-of-Life do not receive upstream security updates. For more information see here.

‍

Credits

  • Mohammed Fathy (finder)

‍

Vulnerability Details
Severity
Level
CVSS Assessment
Low
>=0 <4
Medium
>=4 <6
High
>=6 <8
Critical
>=8 <10
High
ID
CVE-2026-124827
PROJECT Affected
Django
Versions Affected
<6.1.4, <6.0.11, <5.2.20
NES Versions Affected
Published date
December 2, 2026
≈ Fix date
Category
Arbitrary File Write
Vex Document
Download VEXHow do I use it?
Sign up for the latest vulnerability alerts fixed in
NES for Django
Rss feed icon
Subscribe via RSS
or

By submitting the form I acknowledge receipt of our Privacy Policy.

Thanks for signing up for our Newsletter! We look forward to connecting with you.
Oops! Something went wrong while submitting the form.