On November 5, 2025, the Django security team disclosed and patched a critical SQL injection vulnerability, CVE-2025-64459. The flaw has a CVSS v3.1 score of 9.1, reflecting its severity and ease of exploitation. It exists within the framework's Object-Relational Mapping (ORM) component and can be triggered when a dictionary with dictionary expansion is used as a _connector argument in specific QuerySet methods. An unauthenticated attacker could exploit this to execute arbitrary SQL commands, leading to a complete compromise of the application's data confidentiality and integrity. Patches have been released in Django versions 5.2.8, 5.1.14, and 4.2.26. All organizations using affected Django versions are urged to upgrade immediately.
The vulnerability CVE-2025-64459 is a classic SQL injection flaw but with a novel entry point through the Django ORM's internal mechanisms. The flaw resides in how the QuerySet.filter(), QuerySet.exclude(), and QuerySet.get() methods handle dictionary expansion (**kwargs) when used with a specific internal parameter.
An attacker can exploit this by crafting a dictionary where a key is _connector and passing it to one of the vulnerable methods using dictionary expansion. For example:
MyModel.objects.filter(**{"_connector": "' OR 1=1 --"})
Normally, the _connector argument is used internally to specify logical operators (AND/OR). However, the vulnerability arises because the framework failed to properly sanitize this parameter when it was supplied through user-controlled dictionary expansion, allowing raw SQL to be injected directly into the WHERE clause of the database query.
A second, less severe denial-of-service vulnerability, CVE-2025-64458, was also patched in the same release, affecting applications on Windows.
The vulnerability affects the following supported and pre-release versions of Django:
Older, unsupported versions of Django are also likely to be affected.
There are no public reports of in-the-wild exploitation at the time of disclosure. However, the low complexity of the attack and the public availability of technical details mean that exploits are likely to be developed and used quickly. Proactive patching is essential.
Successful exploitation of CVE-2025-64459 can have severe consequences, including:
| Type | Value | Description | Context | Confidence |
|---|---|---|---|---|
| url_pattern | _connector= in query parameters |
A URL query string containing the _connector parameter could be an indicator of an exploitation attempt. |
Monitor web server access logs and WAF logs for this specific parameter name. | high |
| log_source | Database Query Logs |
SQL queries containing logical inconsistencies like ... WHERE (' OR 1=1 -- ...) |
Enable and monitor database query logs for malformed or suspicious SQL statements. | high |
| other | Application errors related to malformed SQL queries | Unsuccessful exploit attempts may trigger database errors that are logged by the Django application. | Monitor application error logs for DatabaseError or similar exceptions. |
medium |
_connector as a query parameter, as this is not a standard use case.filter(), exclude(), or get() methods. DAST tools can be used to actively probe running applications for the vulnerability.QuerySet filters based on user input to ensure it does not allow for the injection of the _connector key.QuerySet methods. Ensure that keys like _connector are explicitly stripped out before being passed to the ORM. This is a form of D3-ACH: Application Configuration Hardening.The most effective mitigation is to upgrade the Django framework to a patched version (4.2.26+, 5.1.14+, or 5.2.8+).
Mapped D3FEND Techniques:
Implement a Web Application Firewall (WAF) to detect and block common SQL injection patterns in web requests.
Mapped D3FEND Techniques:
As a temporary workaround, sanitize user-controlled input to strip out potentially malicious keys like '_connector' before passing them to the Django ORM.
Mapped D3FEND Techniques:
The definitive countermeasure for CVE-2025-64459 is to apply the security patches released by the Django project. This is not a vulnerability that can be reliably mitigated with configuration changes alone. Development teams must immediately identify all applications using vulnerable versions of Django (4.2.x, 5.1.x, 5.2.x) and prioritize their upgrade. The upgrade path is straightforward: pip install --upgrade django==<patched_version>. For example, an application on Django 4.2.25 must be upgraded to 4.2.26. After upgrading, teams must run their full test suite to ensure no regressions were introduced. Given the critical 9.1 CVSS score and the public disclosure of the vulnerability, this should be treated as an emergency patch, bypassing normal development cycles to close the security hole as quickly as possible.
In addition to patching, Application Hardening can provide a defense-in-depth posture against SQL injection flaws like CVE-2025-64459. A key component of this is deploying a Web Application Firewall (WAF) in front of all Django applications. The WAF should be configured with a robust, up-to-date ruleset for detecting SQL injection attacks. Specifically for this CVE, a custom WAF rule should be created to inspect all incoming HTTP requests (GET and POST) and block any that contain the string _connector= in the query parameters or request body. Since this is an internal ORM parameter that should never be exposed to or controlled by an end-user, this rule would have a very low false-positive rate and would effectively block exploitation attempts, even before the application itself is patched. This provides a crucial layer of protection while the patching process is underway.

Cybersecurity professional with over 10 years of specialized experience in security operations, threat intelligence, incident response, and security automation. Expertise spans SOAR/XSOAR orchestration, threat intelligence platforms, SIEM/UEBA analytics, and building cyber fusion centers. Background includes technical enablement, solution architecture for enterprise and government clients, and implementing security automation workflows across IR, TIP, and SOC use cases.
Help others stay informed about cybersecurity threats