CVE-2025-13372: SQL Injection in Django FilteredRelation Column Aliases
- Vendor
- Djangoproject
CVE-2025-13372 is an SQL injection vulnerability in Django's FilteredRelation support when used with PostgreSQL. Django versions 5.2 before 5.2.9, 5.1 before 5.1.15, and 4.2 before 4.2.27 permit injection through column aliases when a suitably crafted dictionary is expanded as **kwargs and passed to QuerySet.annotate() or QuerySet.alias(). Unsupported Django branches, including 5.0.x, 4.1.x, and 3.2.x, were not evaluated and may also be affected.
Impact, mitigation & remediation
What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.
Impact
What an attacker gets, and what they’ve been doing with it.
Successful exploitation enables SQL injection in affected Django applications using PostgreSQL. Depending on the application context and database privileges, this can permit unauthorized query manipulation, exposure of database data, modification of records, or other database-level effects.
Mitigation
If you can’t patch tonight, do this now.
No workaround is provided. Before upgrading, avoid expanding untrusted or user-controlled dictionaries as **kwargs into QuerySet.annotate() or QuerySet.alias() where FilteredRelation and PostgreSQL are used. Review code paths that dynamically construct column aliases.
Remediation
Patch, then assume compromise.
Upgrade Django to a fixed release: 5.2.9 or later for the 5.2 series, 5.1.15 or later for the 5.1 series, or 4.2.27 or later for the 4.2 series. Earlier unsupported Django series were not evaluated and may also be affected; migrate them to a supported, fixed release.
Exploits
2 exploits validated by Mallory's analysis.
Affected products & vendors
Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.
References
Frequently asked questions
- Is CVE-2025-13372 exploited in the wild?
- As of Oct 2, 2026, Mallory has no reports of CVE-2025-13372 being exploited in the wild. It is not listed in CISA KEV.
- Is there a public exploit for CVE-2025-13372?
- Yes. Mallory tracks 2 public exploits or proofs of concept for CVE-2025-13372, the earliest disclosed Dec 3, 2025.
- Is there a patch for CVE-2025-13372?
- Upgrade Django to a fixed release: 5.2.9 or later for the 5.2 series, 5.1.15 or later for the 5.1 series, or 4.2.27 or later for the 4.2 series. Earlier unsupported Django series were not evaluated and may also be affected; migrate them to a supported, fixed release.
- What products are affected by CVE-2025-13372?
- Djangoproject Django.
- How severe is CVE-2025-13372?
- CVE-2025-13372 has a CVSS v3.1 score of 4.3 (Medium) and an EPSS score of 0.55% (40th percentile) as of Oct 2, 2026.
Recent activity
10 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.