CVE-2026-1287
Django vulnerability analysis and mitigation

Overview

CVE-2026-1287 is a SQL injection vulnerability in Django's FilteredRelation component that allows attackers to inject malicious SQL via crafted column aliases using control characters. It affects Django versions 6.0 before 6.0.2, 5.2 before 5.2.11, and 4.2 before 4.2.28; earlier unsupported series (5.0.x, 4.1.x, 3.2.x) may also be affected. The vulnerability was disclosed on February 3, 2026, and was reported by Solomon Kebede. It carries a CVSS v3.1 base score of 5.4 (Medium) per Red Hat, though GitHub's CVSS v4 assessment rates it 8.1 (High) (Red Hat Advisory, GitHub Advisory).

Technical details

The root cause is improper neutralization of special elements in SQL commands (CWE-89). The vulnerability exists in Django's FilteredRelation class, where column aliases are not properly sanitized against control characters. An attacker can craft a malicious dictionary and pass it via Python's **kwargs dictionary expansion to QuerySet methods including annotate(), aggregate(), extra(), values(), values_list(), and alias(), causing the injected control characters to break out of the intended column alias context and execute arbitrary SQL. Exploitation requires low privileges (an authenticated application user) and network access, with no user interaction needed (GitHub Advisory, Django Security Releases).

Impact

Successful exploitation can lead to unauthorized data access, data modification, or data deletion within the backend database, depending on the database user's permissions. Because the injection occurs through Django's ORM layer, any application endpoint that passes user-controlled data into the affected QuerySet methods with FilteredRelation is at risk. In worst-case scenarios with elevated database permissions, an attacker could achieve complete database compromise or potentially execute operating system commands via database-level features (GitHub Advisory, Red Hat Advisory).

Exploitability

As of the time of disclosure, there is no public proof-of-concept exploit and no evidence of active in-the-wild exploitation (Feedly). The EPSS score is approximately 0.013% (2nd percentile), indicating a low near-term exploitation probability. The vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. No specific threat actor attribution has been reported (GitHub Advisory).

Exploitation steps

  1. Identify target: Locate a Django application running an affected version (4.2 < 4.2.28, 5.2 < 5.2.11, or 6.0 < 6.0.2) that exposes endpoints accepting user-controlled input passed to QuerySet methods using FilteredRelation.
  2. Craft malicious dictionary: Construct a Python dictionary where a key contains control characters (e.g., newline \n, carriage return \r, or null byte \x00) embedded within a column alias string intended for use with FilteredRelation.
  3. Trigger dictionary expansion: Submit input to the application such that the crafted dictionary is expanded as **kwargs into one of the vulnerable QuerySet methods: annotate(), aggregate(), extra(), values(), values_list(), or alias().
  4. Inject SQL payload: The control characters in the column alias break out of the alias context in the generated SQL query, allowing injection of arbitrary SQL clauses (e.g., UNION SELECT, subqueries, or conditional statements).
  5. Extract or manipulate data: Use the injected SQL to exfiltrate sensitive data, modify records, or probe database structure, depending on the database user's privileges (GitHub Advisory, Django Security Releases).

Indicators of compromise

  • Logs: Unexpected SQL errors or unusual query structures in database logs containing control characters (newlines, carriage returns, null bytes) within column alias fields; Django application logs showing malformed ORM queries or database exceptions from annotate(), aggregate(), extra(), values(), values_list(), or alias() calls.
  • Network: Unusual HTTP requests to application endpoints with parameters containing URL-encoded control characters (%0a, %0d, %00) in fields that map to QuerySet keyword arguments.
  • Application Behavior: Unexpected query results, data leakage in API responses, or anomalous database read/write activity inconsistent with normal application usage patterns.

Mitigation and workarounds

Upgrade Django to the patched versions: 6.0.2 (for 6.0.x), 5.2.11 (for 5.2.x), or 4.2.28 (for 4.2.x). Users on unsupported versions (5.0.x, 4.1.x, 3.2.x) should migrate to a supported and patched release. As an interim measure, validate and sanitize all user-controlled input before it is used in QuerySet keyword arguments, particularly when FilteredRelation is involved. Red Hat has issued errata for affected products including Ansible Automation Platform and Red Hat Satellite (Django Security Releases, Red Hat Bugzilla).

Community reactions

The Django security team published a blog post on February 3, 2026 announcing the security releases, and followed up on February 4, 2026 with a post on recent trends from the security team (Django Security Releases, Django Blog). Security news outlets including GBHackers, CyberSecurityNews, SecurityOnline, and CyberPress covered the vulnerability, with some framing it alongside related Django issues as "critical" SQL injection and DoS risks. The disclosure was also discussed on the oss-security mailing list and picked up by Linux distribution security advisories for Ubuntu, Debian, Fedora, SUSE, and Mageia (oss-security, Ubuntu Advisory).

Additional resources

Linux Distribution fix status

Fix availability across major Linux distributions and their releases.

Debian

Fixed

bookworm

python-django: 3:3.2.25-0+deb12u2

Fixed

sid

python-django: 3:4.2.28-1

Fixed

trixie

python-django: 3:4.2.28-0+deb13u1

Fixed

Ubuntu

Fixed

bionic (esm-infra)

python-django: 1:1.11.11-1ubuntu1.21+esm14

Fixed

devel

python-django: 3:5.2.9-0ubuntu3

Fixed

focal (esm-infra)

python-django: 2:2.2.12-1ubuntu0.29+esm7

Fixed

jammy

python-django: 2:3.2.12-2ubuntu1.25

Fixed

noble

python-django: 3:4.2.11-1ubuntu1.14

Fixed

questing

python-django: 3:5.2.4-1ubuntu2.3

Fixed

resolute

python-django: 3:5.2.9-0ubuntu3

Fixed

trusty (esm-infra-legacy)

python-django: 1.6.11-0ubuntu1.3+esm10

Fixed

RHEL / CentOS

Unknown

Alpine

Fixed

edge

py3-django: 4.2.28-r0

Fixed

v3.23

py3-django: 4.2.28-r0

Fixed

SourceThis report was generated using AI

Related Django vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-15830MEDIUM6.9
  • Django logoDjango
  • py3-django
NoYesAug 04, 2026
CVE-2026-53877MEDIUM6.3
  • Django logoDjango
  • openstack-horizon-2026.1
NoYesJul 07, 2026
CVE-2026-53878MEDIUM5.3
  • Django logoDjango
  • python-django5
NoYesJul 07, 2026
CVE-2026-48588LOW2.3
  • Django logoDjango
  • authentik-2026.5
NoYesJul 07, 2026
CVE-2026-8404LOW2.3
  • Django logoDjango
  • python311-Django
NoYesJun 03, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management