CVE-2025-64459
Django vulnerability analysis and mitigation

Overview

A critical SQL injection vulnerability (CVE-2025-64459) was discovered in Django affecting versions 5.1 before 5.1.14, 4.2 before 4.2.26, and 5.2 before 5.2.8. The vulnerability was identified in the methods QuerySet.filter(), QuerySet.exclude(), QuerySet.get(), and the class Q(), which are susceptible to SQL injection when using a crafted dictionary with dictionary expansion as the _connector argument. The issue was discovered and reported by cyberstan, with the disclosure date of November 5, 2025 (Django Security).

Technical details

The vulnerability exists in Django's Object-Relational Mapping (ORM) component, specifically in the handling of the _connector keyword argument in the django.db.models.queryutils.Q class constructor. When methods like QuerySet.filter(), QuerySet.exclude(), or QuerySet.get() are called with a dictionary using the ** expansion syntax, an attacker can control the connector value to inject malicious SQL fragments. The vulnerability has been assigned a CVSS v3.1 base score of 9.1 CRITICAL with the vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N (NVD, Miggo).

Impact

The vulnerability allows attackers to perform SQL injection attacks by manipulating the _connector parameter. For example, an attacker could inject SQL fragments such as 'OR 1=1 OR' through HTTP query parameters, potentially gaining unauthorized access to or modifying database contents. This could lead to data breach, data manipulation, or unauthorized access to the application's database (Security Blog).

Mitigation and workarounds

The vulnerability has been patched in Django versions 5.2.8, 5.1.14, and 4.2.26. The fix implements validation of the connector value, restricting it to only accept legitimate values ('AND', 'OR', 'XOR', or None). Users are strongly encouraged to upgrade to these patched versions immediately. The fix includes input validation that raises a ValueError if the connector value is not one of the allowed values (Django Security).

Additional resources


SourceThis report was generated using AI

Related Django vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2025-59681CRITICAL9.8
  • DjangoDjango
  • python311-Django
NoYesOct 01, 2025
CVE-2025-64459CRITICAL9.1
  • DjangoDjango
  • python311-Django
NoYesNov 05, 2025
CVE-2025-57833HIGH8.1
  • DjangoDjango
  • python-django
NoYesSep 03, 2025
CVE-2025-64458HIGH7.5
  • DjangoDjango
  • py3-django
NoYesNov 05, 2025
CVE-2025-59682MEDIUM6.5
  • DjangoDjango
  • python-django
NoYesOct 01, 2025

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management