mitre / mitre/secure-coding-case-studies

Case-Study proposal: Django Filtered Relation, "SQL-Injection - CVE-2025-57833"

Open
#19 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
11
Forks
45
PR merge metrics
No merged PRs in 30d

Description

I'd like to propose a case study on CVE-2025-57833, a SQL injection vulnerability in Django's FilteredRelation feature discovered in September 2025. This vulnerability received a HIGH severity rating of 8.1 from NIST and affects Django versions 4.2 (before 4.2.24), 5.1 (before 5.1.12), and 5.2 (before 5.2.6). This vulnerability arises when FilteredRelation fails to validate column aliases during dictionary expansion via **kwargs passed to QuerySet.annotate() or QuerySet.alias(). An attacker can exploit this by crafting a malicious dictionary that injects arbitrary SQL code.

I think this topic matters because it shows that SQL injection can still sneak into even a well-built, security-minded framework like Django. In this case, The issue isn’t tainted values but dynamic parameters, especially **kwargs—shaping identifiers at API boundaries where ORM safety is assumed. Validate anything that can influence identifiers and design APIs that default to safe, constant names; add static checks to flag dynamic SQL and fuzz/property tests around query builders. In code reviews, explicitly trace untrusted input into SQL structure so these slip-ups are caught long before production.

References:
1). https://docs.djangoproject.com/en/dev/releases/security/
2).https://groups.google.com/g/django-announce
3).https://www.djangoproject.com/weblog/2025/oct/01/security-releases/
4).https://www.djangoproject.com/weblog/2025/sep/03/security-releases/

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository files, tests, or entry points are identified. Start by reviewing the linked Django security advisories and confirm the repository's expected case-study format before drafting. Done should be a case study covering CVE-2025-57833 and its secure-coding lessons, but the issue does not define acceptance criteria.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
documentation, security
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.