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 critical 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 QuerySet API, specifically in the methods filter(), exclude(), get(), and the Q() class. These components accept a dictionary argument for the _connector parameter, which, when crafted maliciously and expanded, allows an attacker to inject arbitrary SQL code. This flaw enables attackers to manipulate database queries directly, potentially exposing sensitive data or altering database contents without authentication or user interaction. The vulnerability affects core query construction logic, making it broadly impactful across Django applications that rely on these methods for database operations. Although earlier unsupported Django versions (such as 5.0.x, 4.1.x, and 3.2.x) were not formally evaluated, they may also be vulnerable. The issue was responsibly disclosed by a security researcher named cyberstan. Despite no known active exploitation in the wild, the vulnerability's CVSS v3.1 score of 9.1 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N) reflects its critical severity, highlighting the ease of remote exploitation and the high impact on confidentiality and integrity of data. No official patches are linked in the provided data, but affected organizations should monitor Django security advisories for updates and apply them promptly.
Potential Impact
The impact of CVE-2025-64459 is severe for organizations worldwide that utilize affected Django versions in their web applications. Successful exploitation allows remote attackers to perform SQL injection attacks without any authentication or user interaction, leading to unauthorized access to sensitive data such as user credentials, personal information, or proprietary business data. Attackers can also manipulate or corrupt database records, undermining data integrity and potentially causing significant operational disruptions. Although availability impact is low, the breach of confidentiality and integrity can result in regulatory non-compliance, reputational damage, financial losses, and further exploitation through lateral movement or privilege escalation. Given Django's widespread use in web development, especially in enterprise, government, and technology sectors, this vulnerability poses a critical risk to a broad range of industries globally. Organizations with public-facing Django applications are particularly vulnerable to automated exploitation attempts once public exploits emerge.
Mitigation Recommendations
To mitigate CVE-2025-64459, organizations should immediately upgrade Django to the fixed versions: 5.1.14 or later, 4.2.26 or later, and 5.2.8 or later as soon as official patches are released. Until patches are applied, developers should avoid using dictionary expansion with the _connector argument in QuerySet methods filter(), exclude(), get(), and the Q() class. Code audits should be conducted to identify and refactor any usage patterns that could trigger this vulnerability. Employing Web Application Firewalls (WAFs) with rules targeting SQL injection patterns may provide temporary protection. Additionally, database permissions should be minimized to restrict the Django application's database user to only necessary operations, limiting potential damage. Monitoring database query logs for unusual or malformed queries can help detect exploitation attempts. Finally, organizations should maintain an incident response plan to address potential breaches resulting from this vulnerability.
Affected Countries
United States, United Kingdom, Germany, France, Canada, Australia, India, Japan, Netherlands, Brazil, South Korea, Singapore
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
Machine-generated threat intelligence
Technical Analysis
CVE-2025-64459 is a critical 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 QuerySet API, specifically in the methods filter(), exclude(), get(), and the Q() class. These components accept a dictionary argument for the _connector parameter, which, when crafted maliciously and expanded, allows an attacker to inject arbitrary SQL code. This flaw enables attackers to manipulate database queries directly, potentially exposing sensitive data or altering database contents without authentication or user interaction. The vulnerability affects core query construction logic, making it broadly impactful across Django applications that rely on these methods for database operations. Although earlier unsupported Django versions (such as 5.0.x, 4.1.x, and 3.2.x) were not formally evaluated, they may also be vulnerable. The issue was responsibly disclosed by a security researcher named cyberstan. Despite no known active exploitation in the wild, the vulnerability's CVSS v3.1 score of 9.1 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N) reflects its critical severity, highlighting the ease of remote exploitation and the high impact on confidentiality and integrity of data. No official patches are linked in the provided data, but affected organizations should monitor Django security advisories for updates and apply them promptly.
Potential Impact
The impact of CVE-2025-64459 is severe for organizations worldwide that utilize affected Django versions in their web applications. Successful exploitation allows remote attackers to perform SQL injection attacks without any authentication or user interaction, leading to unauthorized access to sensitive data such as user credentials, personal information, or proprietary business data. Attackers can also manipulate or corrupt database records, undermining data integrity and potentially causing significant operational disruptions. Although availability impact is low, the breach of confidentiality and integrity can result in regulatory non-compliance, reputational damage, financial losses, and further exploitation through lateral movement or privilege escalation. Given Django's widespread use in web development, especially in enterprise, government, and technology sectors, this vulnerability poses a critical risk to a broad range of industries globally. Organizations with public-facing Django applications are particularly vulnerable to automated exploitation attempts once public exploits emerge.
Mitigation Recommendations
To mitigate CVE-2025-64459, organizations should immediately upgrade Django to the fixed versions: 5.1.14 or later, 4.2.26 or later, and 5.2.8 or later as soon as official patches are released. Until patches are applied, developers should avoid using dictionary expansion with the _connector argument in QuerySet methods filter(), exclude(), get(), and the Q() class. Code audits should be conducted to identify and refactor any usage patterns that could trigger this vulnerability. Employing Web Application Firewalls (WAFs) with rules targeting SQL injection patterns may provide temporary protection. Additionally, database permissions should be minimized to restrict the Django application's database user to only necessary operations, limiting potential damage. Monitoring database query logs for unusual or malformed queries can help detect exploitation attempts. Finally, organizations should maintain an incident response plan to address potential breaches resulting from this vulnerability.
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: 2/27/2026, 4:07:21 AM
Last updated: 3/25/2026, 7:35:48 AM
Views: 819
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.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.