# CVE-2025-57833: Django SQL injection in FilteredRelation column aliases

Source: https://junglewise.ai/threats/cve-2025-57833-django-sql-injection-in-filteredrelation-column-aliases  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2025-09-08. Updated: 2026-06-05  
License: CC BY 4.0 with a link back

CVE-2025-57833 · Severity: high · CVSS 7.1 · Published 2025-09-08

Django, a popular web framework for building Python applications, is vulnerable to a security flaw that could allow an attacker to execute unauthorized database commands. By providing specially crafted data to certain database query functions, an attacker could potentially access or modify sensitive information stored in the application's database. This issue primarily affects applications that allow user-controlled input to influence how database results are labeled or filtered.

Technologies: [Django (PyPI)](https://junglewise.ai/threats/technologies/django). Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2025-57833 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2025-57833 being exploited in the wild.

**How severe is CVE-2025-57833?** High severity, with a CVSS score of 7.1, published 8 September 2025.

**Which products and versions are affected?** Django (PyPI) ECOSYSTEM:introduced=0,fixed=4.2.24, ECOSYSTEM:introduced=4.2,fixed=4.2.24,introduced=5.1,fixed=5.1.12,introduced=5.2,fixed=5.2.6.

**Is there a fix for CVE-2025-57833?** Yes. Django (PyPI): upgrade to 4.2.24, 5.2.6 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2025-57833 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2025-57833?** Check whether you run Django (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- Django (PyPI): upgrade to 4.2.24, 5.2.6 or later

  ```sh
  pip install "Django>=5.2.6"
  ```


## Technical details

A SQL injection vulnerability exists in Django's FilteredRelation component. The root cause is improper neutralization of special elements in column aliases when using dictionary expansion (**kwargs) passed to QuerySet.annotate() or QuerySet.alias(). An attacker with low privileges can exploit this over the network by providing a suitably crafted dictionary to these methods, potentially leading to unauthorized data access or modification. The vulnerability is mitigated by high attack complexity, as it requires specific application logic that exposes these internal QuerySet methods to user-influenced dictionary keys. Patches are available in versions 4.2.24, 5.1.12, and 5.2.6.

## Affected products

- Django Software Foundation Django 4.2 before 4.2.24, 5.1 before 5.1.12, 5.2 before 5.2.6

## Identifiers

- CVE-2025-57833
- GHSA-6w2r-r2m5-xq5w
- PYSEC-2025-105

## Timeline

- 2025-09-03: advisory: Initial security release by Django project
- 2025-09-08: disclosed: GitHub Advisory published

## References

- [https://docs.djangoproject.com/en/dev/releases/security](https://docs.djangoproject.com/en/dev/releases/security)
- [https://groups.google.com/g/django-announce](https://groups.google.com/g/django-announce)
- [https://medium.com/@EyalSec/django-unauthenticated-0-click-rce-and-sql-injection-using-default-configuration-059964f3f898](https://medium.com/@EyalSec/django-unauthenticated-0-click-rce-and-sql-injection-using-default-configuration-059964f3f898)
- [https://www.djangoproject.com/weblog/2025/sep/03/security-releases](https://www.djangoproject.com/weblog/2025/sep/03/security-releases)
- [https://github.com/django/django/commit/102965ea93072fe3c39a30be437c683ec1106ef5](https://github.com/django/django/commit/102965ea93072fe3c39a30be437c683ec1106ef5)

## Related threats

- [Django GeoDjango unbounded recursion denial of service](https://junglewise.ai/threats/cve-2026-15830-django-geodjango-unbounded-recursion-denial-of-service)
- [Django GeoDjango spatial lookups file write and request forgery](https://junglewise.ai/threats/cve-2026-15307-django-geodjango-spatial-lookups-file-write-and-request-forgery)
- [PYSEC-2026-2449 - Django has a Race Condition vulnerability](https://junglewise.ai/threats/cve-2026-25674-django-has-a-race-condition-vulnerability)
- [PYSEC-2026-1296 - Django vulnerable to partial directory traversal via archives](https://junglewise.ai/threats/cve-2025-59682-django-vulnerable-to-partial-directory-traversal-via-archives)
- [Django DomainNameValidator header injection via newline characters](https://junglewise.ai/threats/cve-2026-53878-django-domainnamevalidator-header-injection-via-newline)
