Django4shell Vulnerability Affects GeoDjango Applications
A high-severity vulnerability, CVE-2026-124827, impacts Django applications using GeoDjango and RasterFields. Snyk recommends updating to patched versions to prevent remote code execution.
PythonKey points
- A vulnerability known as Django4shell, with the identifier CVE-2026-124827, was disclosed by Mohammed Fathy from Robusta Technology Group. It was resolved in Django versions 6.1.4, 6.0.11, and 5.2.20, which were released on December 2, 2026.
- The vulnerability enables an authenticated user to initiate a file write operation to a location they control, possibly resulting in remote code execution.
- This vulnerability is associated with a known technique used in other attacks, such as the LiteLLM supply chain compromise, which exploited similar Python startup files.
A vulnerability known as Django4shell, with the identifier CVE-2026-124827, was disclosed by Mohammed Fathy from Robusta Technology Group. It was resolved in Django versions 6.1.4, 6.0.11, and 5.2.20, which were released on December 2, 2026. This flaw impacts applications that use GeoDjango with models containing a RasterField. It enables an authenticated user to initiate a file write operation to a location they control, possibly resulting in remote code execution. Snyk has rated this flaw as High severity, with a CVSS 4.0 score of 8.7. The vulnerability requires access at the staff level and there is currently no confirmed exploitation. The issue arises from a defect in the RasterField, which accepts raster data in Python dictionaries or JSON strings and passes the name parameter to GDAL without restrictions. GDAL uses this name parameter to determine the file path, and if a file-writing driver like EHdr is used, it can write the file to the specified location, allowing the attacker to control where and what is written. The file write occurs during form validation, before any database interaction, meaning the attack can take place without calling model.save() or interacting with the database. Applications that were fixed in August remain at risk because the earlier patches only addressed certain paths, leaving the model field itself unprotected. The vulnerability exists in versions before 5.2.20, 6.0.11, and 6.1.4, including versions like 5.2.17 and 6.0.8, which resolved earlier issues. An application is vulnerable if it runs Django before the patched versions, activates GeoDjango, uses a RasterField, and has a GDAL build that includes a file-writing driver. The RasterField can be accessed through the Django Admin, a ModelForm, or a writable serializer, which exposes it by default because it defaults to a CharField. An attacker with access to a staff or admin account can submit a malicious form containing a raster definition with a file-writing driver and a path outside the media directory. This allows the attacker to create a file in a location that Python automatically executes, such as a sitecustomize.py or .pth file in site-packages, leading to code execution with web server privileges. The attack can lead to code execution, the creation of web shells, or the modification of application files, enabling an attacker to access sensitive information, alter data, or move laterally within the network. This vulnerability is associated with a known technique used in other attacks, such as the LiteLLM supply chain compromise, which exploited similar Python startup files. The December 2 release also resolved six other vulnerabilities, including a Critical severity SQL injection issue (CVE-2026-132092) that affects a wider range of applications. The SQL injection vulnerability has a CVSS 4.0 score of 9.3 and does not require any user privileges, making it a top priority for all Django users. Users are advised to update to 5.2.20, 6.0.11, or 6.1.4 or later, rebuild container images, and redeploy to ensure the changes are implemented. It is essential to confirm the current version in all environments, including container images built from cached layers, to ensure the update is applied. Organizations should assess their exposure by identifying applications using GeoDjango with RasterFields and checking if these fields are accessible through forms or serializers. It is recommended to prioritize applications where untrusted users could submit data to these forms and internet-facing admin interfaces. After updating, test raster forms to ensure the RasterField is not editable by default and that using non-default GDAL drivers triggers exceptions. Clear caches following the update, as the same release also fixed a cache poisoning issue (CVE-2026-125673). If an immediate update is not feasible, access to the Django Admin and forms that expose RasterFields should be limited to trusted users only. Indicators of a successful attack may include entries in request logs showing path traversal or driver parameters in POST requests, or the presence of unexpected startup files in the file system. If evidence of a successful file write is found, the system should be treated as compromised, and credentials should be changed, with a rebuild from a known-good image. Snyk scans can detect all seven advisories, and users can filter results by CVE ID to identify affected projects. The Zero Day report in the Snyk app provides details on projects affected by the Django4shell vulnerability, including the fixed versions.
What to do
- Users are advised to update to 5.2.20, 6.0.11, or 6.1.4 or later, rebuild container images, and redeploy to ensure the changes are implemented.
- It is essential to confirm the current version in all environments, including container images built from cached layers, to ensure the update is applied.
- After updating, test raster forms to ensure the RasterField is not editable by default and that using non-default GDAL drivers triggers exceptions.
- Clear caches following the update, as the same release also fixed a cache poisoning issue (CVE-2026-125673).
Original report
“Django4shell (CVE 2026 124827) Why GeoDjango Apps Patched In August Still Need An Update”
Django4shell lets authenticated users exploit GeoDjango RasterField forms to write files and potentially execute code. GeoDjango apps patched for earlier raster flaws still need the December update.
- GHSA-cffv-grgg-g429 / CVE-2026-14535 — Fickling MLAllowlist analysis can miss non-allowlisted imports
- NASA Trick Simulation Environment Allows Remote Code Execution
- CVE-2026-142134: Identifier Lacks Verified Product, Scoring, Fix or Exploitation Evidence in Review Pack
- CVE-2026-141547 — pdm-project pdm
- CVE-2026-142491 — eole-nlp eole