CVE-2026-1287: CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') in djangoproject Django
An issue was discovered in 6.0 before 6.0.2, 5.2 before 5.2.11, and 4.2 before 4.2.28. `FilteredRelation` is subject to SQL injection in column aliases via control characters, using a suitably crafted dictionary, with dictionary expansion, as the `**kwargs` passed to `QuerySet` methods `annotate()`, `aggregate()`, `extra()`, `values()`, `values_list()`, and `alias()`. 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 Solomon Kebede for reporting this issue.
AI Analysis
Technical Summary
CVE-2026-1287 is a SQL injection vulnerability identified in Django, a widely used Python web framework, specifically affecting versions 4.2 prior to 4.2.28, 5.2 prior to 5.2.11, and 6.0 prior to 6.0.2. The issue stems from the FilteredRelation feature, which is used to create filtered joins in Django ORM queries. The vulnerability occurs when column aliases are constructed using control characters embedded in dictionary keys passed as **kwargs to QuerySet methods such as annotate(), aggregate(), extra(), values(), values_list(), and alias(). This improper neutralization of special elements (CWE-89) allows an attacker to inject arbitrary SQL commands by manipulating these dictionary keys, which are expanded into SQL column aliases without sufficient sanitization. This can lead to unauthorized data access, data modification, or denial of service through crafted queries. Although earlier unsupported Django versions (5.0.x, 4.1.x, 3.2.x) were not evaluated, they may also be vulnerable. The vulnerability was responsibly disclosed by Solomon Kebede and no public exploits are known at this time. The lack of a CVSS score necessitates an independent severity assessment based on the potential impact and exploitability.
Potential Impact
For European organizations, this vulnerability poses a significant risk due to Django's widespread use in web applications, including e-commerce, government portals, and enterprise systems. Exploitation could lead to unauthorized data disclosure, data corruption, or complete compromise of backend databases, impacting confidentiality, integrity, and availability. This could result in regulatory non-compliance under GDPR, financial losses, reputational damage, and operational disruptions. Attackers could exploit this vulnerability remotely without authentication or user interaction, increasing the threat surface. Organizations relying on vulnerable Django versions must consider the risk of targeted attacks, especially in sectors handling sensitive personal or financial data. The impact is amplified in environments where dynamic query generation is common and input validation is insufficient.
Mitigation Recommendations
The primary mitigation is to upgrade Django installations to versions 4.2.28, 5.2.11, or 6.0.2 or later, where the vulnerability is patched. Organizations should audit their codebases for usage of FilteredRelation and related QuerySet methods with dynamic dictionary expansions and refactor to avoid passing untrusted input as dictionary keys. Implement strict input validation and sanitization on any user-controllable data used in query construction. Employ database-level protections such as least privilege access controls and query logging to detect suspicious activity. Conduct thorough security testing, including static code analysis and dynamic testing focused on ORM query generation. Additionally, monitor security advisories for any emerging exploits and apply patches promptly. For legacy systems where immediate upgrade is not feasible, consider isolating vulnerable applications and restricting access to trusted users only.
Affected Countries
Germany, United Kingdom, France, Netherlands, Sweden, Italy, Spain
CVE-2026-1287: CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') in djangoproject Django
Description
An issue was discovered in 6.0 before 6.0.2, 5.2 before 5.2.11, and 4.2 before 4.2.28. `FilteredRelation` is subject to SQL injection in column aliases via control characters, using a suitably crafted dictionary, with dictionary expansion, as the `**kwargs` passed to `QuerySet` methods `annotate()`, `aggregate()`, `extra()`, `values()`, `values_list()`, and `alias()`. 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 Solomon Kebede for reporting this issue.
AI-Powered Analysis
Technical Analysis
CVE-2026-1287 is a SQL injection vulnerability identified in Django, a widely used Python web framework, specifically affecting versions 4.2 prior to 4.2.28, 5.2 prior to 5.2.11, and 6.0 prior to 6.0.2. The issue stems from the FilteredRelation feature, which is used to create filtered joins in Django ORM queries. The vulnerability occurs when column aliases are constructed using control characters embedded in dictionary keys passed as **kwargs to QuerySet methods such as annotate(), aggregate(), extra(), values(), values_list(), and alias(). This improper neutralization of special elements (CWE-89) allows an attacker to inject arbitrary SQL commands by manipulating these dictionary keys, which are expanded into SQL column aliases without sufficient sanitization. This can lead to unauthorized data access, data modification, or denial of service through crafted queries. Although earlier unsupported Django versions (5.0.x, 4.1.x, 3.2.x) were not evaluated, they may also be vulnerable. The vulnerability was responsibly disclosed by Solomon Kebede and no public exploits are known at this time. The lack of a CVSS score necessitates an independent severity assessment based on the potential impact and exploitability.
Potential Impact
For European organizations, this vulnerability poses a significant risk due to Django's widespread use in web applications, including e-commerce, government portals, and enterprise systems. Exploitation could lead to unauthorized data disclosure, data corruption, or complete compromise of backend databases, impacting confidentiality, integrity, and availability. This could result in regulatory non-compliance under GDPR, financial losses, reputational damage, and operational disruptions. Attackers could exploit this vulnerability remotely without authentication or user interaction, increasing the threat surface. Organizations relying on vulnerable Django versions must consider the risk of targeted attacks, especially in sectors handling sensitive personal or financial data. The impact is amplified in environments where dynamic query generation is common and input validation is insufficient.
Mitigation Recommendations
The primary mitigation is to upgrade Django installations to versions 4.2.28, 5.2.11, or 6.0.2 or later, where the vulnerability is patched. Organizations should audit their codebases for usage of FilteredRelation and related QuerySet methods with dynamic dictionary expansions and refactor to avoid passing untrusted input as dictionary keys. Implement strict input validation and sanitization on any user-controllable data used in query construction. Employ database-level protections such as least privilege access controls and query logging to detect suspicious activity. Conduct thorough security testing, including static code analysis and dynamic testing focused on ORM query generation. Additionally, monitor security advisories for any emerging exploits and apply patches promptly. For legacy systems where immediate upgrade is not feasible, consider isolating vulnerable applications and restricting access to trusted users only.
Affected Countries
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- DSF
- Date Reserved
- 2026-01-21T14:04:43.515Z
- Cvss Version
- null
- State
- PUBLISHED
Threat ID: 69820d79f9fa50a62fcd604a
Added to database: 2/3/2026, 3:00:09 PM
Last enriched: 2/3/2026, 3:15:08 PM
Last updated: 2/3/2026, 5:24:56 PM
Views: 4
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-2026-1568: CWE-347 Improper Verification of Cryptographic Signature in Rapid7 Vulnerability Management
CriticalCVE-2025-67857: Insertion of Sensitive Information Into Sent Data
MediumCVE-2025-67856
MediumCVE-2025-67855: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
MediumCVE-2025-67853: Improper Restriction of Excessive Authentication Attempts
HighActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.