CVE-2025-64459: CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') in djangoproject Django
An issue was discovered in 5.1 before 5.1.14, 4.2 before 4.2.26, and 5.2 before 5.2.8. The methods `QuerySet.filter()`, `QuerySet.exclude()`, and `QuerySet.get()`, and the class `Q()`, are subject to SQL injection when using a suitably crafted dictionary, with dictionary expansion, as the `_connector` argument. Earlier, unsupported Django series (such as 5.0.x, 4.1.x, and 3.2.x) were not evaluated and may also be affected. Django would like to thank cyberstan for reporting this issue.
AI Analysis
Technical Summary
CVE-2025-64459 is a severe SQL injection vulnerability identified in the Django web framework versions 5.1 (prior to 5.1.14), 4.2 (prior to 4.2.26), and 5.2 (prior to 5.2.8). The vulnerability stems from improper neutralization of special elements used in SQL commands (CWE-89) within the ORM layer of Django. Specifically, the QuerySet methods filter(), exclude(), and get(), as well as the Q() class, are vulnerable when a specially crafted dictionary is passed using dictionary expansion as the _connector argument. This allows an attacker to inject arbitrary SQL code into queries constructed by these methods, bypassing Django’s usual ORM protections. The flaw affects the integrity and confidentiality of the database by potentially allowing unauthorized reading or modification of data. Exploitation requires no authentication or user interaction and can be performed remotely, increasing the risk profile. Although no exploits have been observed in the wild yet, the high CVSS score of 9.1 (critical) reflects the ease of exploitation and the severity of impact. The vulnerability affects supported Django versions 5.1, 4.2, and 5.2, and earlier unsupported versions may also be vulnerable. The Django project has acknowledged the issue and released patches in versions 5.1.14, 4.2.26, and 5.2.8 to remediate the vulnerability.
Potential Impact
For European organizations, this vulnerability poses a critical risk to web applications built on affected Django versions. Successful exploitation can lead to unauthorized data disclosure, data tampering, and potential compromise of backend databases, severely impacting confidentiality and integrity. Organizations handling sensitive personal data, financial information, or critical infrastructure data are particularly vulnerable, with potential regulatory and reputational consequences under GDPR and other data protection laws. The vulnerability’s remote exploitability without authentication means attackers can target exposed web services directly, increasing the attack surface. This can lead to data breaches, loss of customer trust, and significant remediation costs. Additionally, the integrity impact could allow attackers to manipulate data, potentially disrupting business operations or enabling further attacks. Although availability is not directly impacted, the downstream effects of data compromise could indirectly affect service continuity.
Mitigation Recommendations
European organizations should immediately upgrade Django installations to the patched versions: 5.1.14, 4.2.26, or 5.2.8 or later. If immediate upgrading is not feasible, organizations should audit their use of QuerySet.filter(), exclude(), get(), and Q() class invocations, especially those using dictionary expansion with the _connector argument, and avoid passing untrusted input in these contexts. Implement strict input validation and sanitization on all user-supplied data used in query construction. Employ Web Application Firewalls (WAFs) with custom rules to detect and block suspicious SQL injection patterns targeting Django ORM queries. Conduct thorough code reviews and penetration testing focusing on ORM usage to identify potential injection points. Monitor application logs for anomalous query patterns indicative of injection attempts. Finally, maintain an incident response plan to quickly address any detected exploitation attempts.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Italy, Spain, Poland, Belgium
CVE-2025-64459: CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') in djangoproject Django
Description
An issue was discovered in 5.1 before 5.1.14, 4.2 before 4.2.26, and 5.2 before 5.2.8. The methods `QuerySet.filter()`, `QuerySet.exclude()`, and `QuerySet.get()`, and the class `Q()`, are subject to SQL injection when using a suitably crafted dictionary, with dictionary expansion, as the `_connector` argument. Earlier, unsupported Django series (such as 5.0.x, 4.1.x, and 3.2.x) were not evaluated and may also be affected. Django would like to thank cyberstan for reporting this issue.
AI-Powered Analysis
Technical Analysis
CVE-2025-64459 is a severe SQL injection vulnerability identified in the Django web framework versions 5.1 (prior to 5.1.14), 4.2 (prior to 4.2.26), and 5.2 (prior to 5.2.8). The vulnerability stems from improper neutralization of special elements used in SQL commands (CWE-89) within the ORM layer of Django. Specifically, the QuerySet methods filter(), exclude(), and get(), as well as the Q() class, are vulnerable when a specially crafted dictionary is passed using dictionary expansion as the _connector argument. This allows an attacker to inject arbitrary SQL code into queries constructed by these methods, bypassing Django’s usual ORM protections. The flaw affects the integrity and confidentiality of the database by potentially allowing unauthorized reading or modification of data. Exploitation requires no authentication or user interaction and can be performed remotely, increasing the risk profile. Although no exploits have been observed in the wild yet, the high CVSS score of 9.1 (critical) reflects the ease of exploitation and the severity of impact. The vulnerability affects supported Django versions 5.1, 4.2, and 5.2, and earlier unsupported versions may also be vulnerable. The Django project has acknowledged the issue and released patches in versions 5.1.14, 4.2.26, and 5.2.8 to remediate the vulnerability.
Potential Impact
For European organizations, this vulnerability poses a critical risk to web applications built on affected Django versions. Successful exploitation can lead to unauthorized data disclosure, data tampering, and potential compromise of backend databases, severely impacting confidentiality and integrity. Organizations handling sensitive personal data, financial information, or critical infrastructure data are particularly vulnerable, with potential regulatory and reputational consequences under GDPR and other data protection laws. The vulnerability’s remote exploitability without authentication means attackers can target exposed web services directly, increasing the attack surface. This can lead to data breaches, loss of customer trust, and significant remediation costs. Additionally, the integrity impact could allow attackers to manipulate data, potentially disrupting business operations or enabling further attacks. Although availability is not directly impacted, the downstream effects of data compromise could indirectly affect service continuity.
Mitigation Recommendations
European organizations should immediately upgrade Django installations to the patched versions: 5.1.14, 4.2.26, or 5.2.8 or later. If immediate upgrading is not feasible, organizations should audit their use of QuerySet.filter(), exclude(), get(), and Q() class invocations, especially those using dictionary expansion with the _connector argument, and avoid passing untrusted input in these contexts. Implement strict input validation and sanitization on all user-supplied data used in query construction. Employ Web Application Firewalls (WAFs) with custom rules to detect and block suspicious SQL injection patterns targeting Django ORM queries. Conduct thorough code reviews and penetration testing focusing on ORM usage to identify potential injection points. Monitor application logs for anomalous query patterns indicative of injection attempts. Finally, maintain an incident response plan to quickly address any detected exploitation attempts.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- DSF
- Date Reserved
- 2025-11-04T14:35:57.527Z
- Cvss Version
- null
- State
- PUBLISHED
Threat ID: 690b6b8d39a16b4c6e53b82e
Added to database: 11/5/2025, 3:21:49 PM
Last enriched: 11/12/2025, 4:01:38 PM
Last updated: 12/20/2025, 10:00:11 PM
Views: 679
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Related Threats
CVE-2025-34290: CWE-250 Execution with Unnecessary Privileges in Versa Networks SASE Client for Windows
HighCVE-2025-7782: CWE-862 Missing Authorization in WP JobHunt
HighCVE-2025-7733: CWE-639 Authorization Bypass Through User-Controlled Key in WP JobHunt
MediumCVE-2025-14298: CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in damian-gora FiboSearch – Ajax Search for WooCommerce
MediumCVE-2025-12492: CWE-200 Exposure of Sensitive Information to an Unauthorized Actor in ultimatemember Ultimate Member – User Profile, Registration, Login, Member Directory, Content Restriction & Membership Plugin
MediumActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.