CVE-2026-1287: Django SQL Injection Vulnerability in Column Aliases

django Updated 05 Feb 2026

Summary

05/02/2026
Yes i
Medium
Not published

CVE-2026-1287: Potential SQL injection in column aliases via control characters. Affects django across 3 version ranges.

>= 4.2.0, < 4.2.28 >= 5.2.0, < 5.2.11 >= 6.0.0, < 6.0.2

Fixed in 4.2.28, 5.2.11 or 6.0.2, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2026-1287 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. It provides a robust set of features for building web applications, including an ORM (Object-Relational Mapping) system that allows developers to interact with databases using Python code instead of SQL. However, certain versions of Django are vulnerable to SQL injection attacks through control characters in column aliases, which can lead to unauthorized data access or manipulation.

Vulnerability Detail

An issue was discovered in Django versions 6.0 before 6.0.2, 5.2 before 5.2.11, and 4.2 before 4.2.28. The vulnerability arises from the FilteredRelation feature, which is susceptible to SQL injection when using control characters in column aliases. This can occur when a malicious user crafts a dictionary with control characters and passes it as **kwargs to methods like annotate(), aggregate(), extra(), values(), values_list(), and alias(). The potential ramifications include unauthorized access to sensitive data or the ability to execute arbitrary SQL commands.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • >= 4.2.0, < 4.2.28 4.2.28
  • >= 5.2.0, < 5.2.11 5.2.11
  • >= 6.0.0, < 6.0.2 6.0.2

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

As a temporary workaround, avoid using control characters in column aliases when constructing queries with the affected methods. Additionally, consider validating and sanitizing input data before it is passed to these methods to mitigate the risk of SQL injection.

Conclusion

The CVE-2026-1287 vulnerability in Django poses a significant risk of SQL injection through control characters in column aliases. It is crucial for developers using affected versions to upgrade to the latest patched versions to ensure the security of their applications. Implementing workarounds and validating inputs can help mitigate risks until an upgrade is feasible.

See every vulnerability recorded for django →

Share this vulnerability

FAQ

CVE-2026-1287 is a vulnerability in Django that allows for potential SQL injection through control characters in column aliases.

Django versions 6.0 before 6.0.2, 5.2 before 5.2.11, and 4.2 before 4.2.28 are affected by this vulnerability.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without requiring any signup.

If an immediate upgrade is not possible, implement input validation and avoid using control characters in column aliases as a temporary workaround.

The vulnerability was reported by Solomon Kebede, who identified the potential for SQL injection in the affected versions of Django.

Related vulnerabilities

Recent vulnerabilities recorded for django.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • >= 4.2.0, < 4.2.28 4.2.28
  • >= 5.2.0, < 5.2.11 5.2.11
  • >= 6.0.0, < 6.0.2 6.0.2

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback