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.
`.QuerySet.order_by()` is subject to SQL injection in column aliases containing periods when the same alias is, using a suitably crafted dictionary, with dictionary expansion, used in `FilteredRelation`.
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.
Published: 2026-02-03
Score: 5.4 Medium
EPSS: < 1% Very Low
KEV: No
Impact: SQL Injection (potential arbitrary database manipulation)
Action: Patch Immediately
AI Analysis

Impact

An issue was discovered in Django 6.0 before 6.0.2, 5.2 before 5.2.11, and 4.2 before 4.2.28 where using QuerySet.order_by with column aliases containing periods can lead to SQL injection when the same alias is also used with dictionary expansion in a FilteredRelation. The flaw allows an attacker to insert arbitrary SQL statements into a query, potentially enabling unauthorized reading, alteration, or deletion of database data. The weakness falls under SQL injection (CWE‑89).

Affected Systems

The vulnerability affects Django 6.0, 5.2, and 4.2 series up to their respective non‑patched versions (<6.0.2, <5.2.11, <4.2.28). Earlier unsupported series such as 5.0.x, 4.1.x, and 3.2.x are also potentially affected. The impact applies to any application that constructs order_by clauses with user‑controlled column aliases that contain periods.

Risk and Exploitability

The CVSS score is 5.4, indicating medium severity. EPSS is less than 1%, implying a very low probability of exploitation in the wild. The vulnerability is not listed in CISA's KEV catalog. Attackers would need the ability to influence the column alias names supplied to QuerySet.order_by and FilteredRelation; if such input is exposed to users, it is likely exploitable. No public exploit has been documented, but the low EPSS suggests limited activity.

Generated by OpenCVE AI on April 18, 2026 at 00:21 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade Django to version 6.0.2 or later.
  • Upgrade Django to version 5.2.11 or later.
  • Upgrade Django to version 4.2.28 or later.
  • If using an older or unsupported Django series, migrate to a supported release series.

Generated by OpenCVE AI on April 18, 2026 at 00:21 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Debian DLA Debian DLA DLA-4484-1 python-django security update
Debian DSA Debian DSA DSA-6150-1 python-django security update
Github GHSA Github GHSA GHSA-6426-9fv3-65x8 Django has an SQL Injection issue
Ubuntu USN Ubuntu USN USN-8009-1 Django vulnerabilities
History

Wed, 04 Feb 2026 17:45:00 +0000

Type Values Removed Values Added
CPEs cpe:2.3:a:djangoproject:django:*:*:*:*:*:*:*:*

Wed, 04 Feb 2026 12:15:00 +0000

Type Values Removed Values Added
First Time appeared Djangoproject
Djangoproject django
Vendors & Products Djangoproject
Djangoproject django

Wed, 04 Feb 2026 00:15:00 +0000

Type Values Removed Values Added
References
Metrics threat_severity

None

threat_severity

Important


Tue, 03 Feb 2026 17:15:00 +0000

Type Values Removed Values Added
Metrics cvssV3_1

{'score': 5.4, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N'}

ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Tue, 03 Feb 2026 15:00:00 +0000

Type Values Removed Values Added
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. `.QuerySet.order_by()` is subject to SQL injection in column aliases containing periods when the same alias is, using a suitably crafted dictionary, with dictionary expansion, used in `FilteredRelation`. 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.
Title Potential SQL injection via QuerySet.order_by and FilteredRelation
Weaknesses CWE-89
References

Subscriptions

Djangoproject Django
cve-icon MITRE

Status: PUBLISHED

Assigner: DSF

Published:

Updated: 2026-02-03T16:56:37.936Z

Reserved: 2026-01-21T20:45:05.988Z

Link: CVE-2026-1312

cve-icon Vulnrichment

Updated: 2026-02-03T16:56:34.640Z

cve-icon NVD

Status : Analyzed

Published: 2026-02-03T15:16:13.833

Modified: 2026-02-04T17:35:02.120

Link: CVE-2026-1312

cve-icon Redhat

Severity : Important

Publid Date: 2026-02-03T14:36:23Z

Links: CVE-2026-1312 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-04-18T00:30:25Z

Weaknesses