Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

CVE-2026-1287: CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') in djangoproject Django

0
Medium
VulnerabilityCVE-2026-1287cvecve-2026-1287cwe-89
Published: Tue Feb 03 2026 (02/03/2026, 14:36:03 UTC)
Source: CVE Database V5
Vendor/Project: djangoproject
Product: 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

AILast updated: 02/26/2026, 19:03:19 UTC

Technical Analysis

CVE-2026-1287 is a SQL injection vulnerability identified in the Django web framework affecting versions 6.0 before 6.0.2, 5.2 before 5.2.11, and 4.2 before 4.2.28. The vulnerability stems from improper neutralization of special elements used in SQL commands, specifically within the FilteredRelation feature. FilteredRelation allows complex query annotations by passing dictionaries expanded as keyword arguments (**kwargs) to QuerySet methods such as annotate(), aggregate(), extra(), values(), values_list(), and alias(). When these dictionaries contain control characters in column aliases, they can manipulate the underlying SQL query structure, enabling injection of arbitrary SQL code. This flaw is categorized under CWE-89 (Improper Neutralization of Special Elements used in an SQL Command). Exploitation requires the attacker to have low privileges (PR:L) but no user interaction (UI:N) and can be performed remotely (AV:N). The impact includes potential unauthorized disclosure and modification of data (confidentiality and integrity impacts), but no direct availability impact. Earlier unsupported Django versions (5.0.x, 4.1.x, 3.2.x) may also be vulnerable but were not formally evaluated. No public exploits have been reported yet. The vulnerability was responsibly disclosed by Solomon Kebede and is assigned a CVSS v3.1 base score of 5.4 (medium severity).

Potential Impact

This vulnerability allows attackers with limited privileges to inject malicious SQL code through crafted dictionary expansions in Django QuerySet methods, potentially leading to unauthorized data access or modification. The confidentiality and integrity of backend databases can be compromised, exposing sensitive information or allowing data tampering. Since Django is widely used for web applications, especially in enterprise and public-facing services, exploitation could affect numerous organizations globally. Although no availability impact is noted, the breach of data confidentiality and integrity can result in regulatory penalties, reputational damage, and operational disruptions. Attackers could leverage this flaw to escalate privileges or pivot to other parts of the network if combined with other vulnerabilities. The ease of exploitation and the common usage of affected Django versions increase the risk profile for organizations that have not applied patches or mitigations.

Mitigation Recommendations

1. Upgrade Django to the latest patched versions: 6.0.2 or later, 5.2.11 or later, and 4.2.28 or later. 2. Avoid using dynamic dictionary expansions (**kwargs) with untrusted input in QuerySet methods like annotate(), aggregate(), extra(), values(), values_list(), and alias(). 3. Implement strict input validation and sanitization on any user-supplied data that could influence query parameters or aliases. 4. Employ database-level security controls such as least privilege access for database users to limit damage from potential injection. 5. Use Django’s ORM features as intended and avoid raw SQL queries or unsafe query constructions. 6. Monitor application logs for unusual query patterns or errors that may indicate attempted exploitation. 7. Conduct security code reviews focusing on query construction and parameter handling. 8. Consider deploying Web Application Firewalls (WAFs) with rules to detect and block SQL injection attempts targeting Django applications. 9. Educate developers on secure coding practices related to ORM usage and SQL injection risks.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

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/26/2026, 7:03:19 PM

Last updated: 3/20/2026, 8:34:55 PM

Views: 70

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

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.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses