Django SQLi via order_by alias before 6.0.2/5.2.11/4.2.28
CVE-2026-1312 Published on February 3, 2026
Potential SQL injection via QuerySet.order_by and FilteredRelation
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.
Vulnerability Analysis
CVE-2026-1312 is exploitable with network access, and requires small amount of user privileges. This vulnerability is consided to have a high level of attack complexity. The potential impact of an exploit of this vulnerability is considered to be very high.
Timeline
Initial report received.
Vulnerability confirmed. 14 days later.
Security release issued. 8 days later.
Weakness Type
What is a SQL Injection Vulnerability?
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
CVE-2026-1312 has been classified to as a SQL Injection vulnerability or weakness.
Products Associated with CVE-2026-1312
You can be notified by email with stack.watch whenever vulnerabilities like CVE-2026-1312 are published in these products:
Affected Versions
djangoproject Django:- Version 6.0 and below 6.0.2 is affected.
- Version 6.0.2 is unaffected.
- Version 5.2 and below 5.2.11 is affected.
- Version 5.2.11 is unaffected.
- Version 4.2 and below 4.2.28 is affected.
- Version 4.2.28 is unaffected.
- Version 0:4.2.28-1.el8ap and below * is unaffected.
- Version 0:4.2.28-1.el9ap and below * is unaffected.
- Version 0:4.2.28-1.el9ap and below * is unaffected.
- Version 0:4.2.28-0.1.el8pc and below * is unaffected.
- Version 0:4.2.28-0.1.el9pc and below * is unaffected.
- Version 0:3.14.0.14-1.el9sat and below * is unaffected.
- Version 0:0.1.23-0.3.el9pc and below * is unaffected.
- Version 0:1.2.0-0.1.el9pc and below * is unaffected.
- Version 0:4.2.28-0.1.el9pc and below * is unaffected.
- Version 0:2.22.3-1.el9pc and below * is unaffected.
- Version 0:3.27.10-2.el9pc and below * is unaffected.
- Version 0:1.5.1-1.el9sat and below * is unaffected.
- Version 0:0.4.3-1.el9sat and below * is unaffected.
- Version 0:4.16.0.14-1.el9sat and below * is unaffected.
- Version 0:0.13.0-1.el9sat and below * is unaffected.
- Version 0:6.17.7-1.el9sat and below * is unaffected.
- Version 0:0.0.3-4.el9sat and below * is unaffected.
- Version 0:4.2.30-1.el9pc and below * is unaffected.
- Version 1772214630 and below * is unaffected.
- Version 1772552788 and below * is unaffected.
- Version 1770913597 and below * is unaffected.
- Version 1773451075 and below * is unaffected.
Exploit Probability
EPSS (Exploit Prediction Scoring System) scores estimate the probability that a vulnerability will be exploited in the wild within the next 30 days. The percentile shows you how this score compares to all other vulnerabilities.