CVE-2025-59681

High

Description

An issue was discovered in Django 4.2 before 4.2.25, 5.1 before 5.1.13, and 5.2 before 5.2.7. QuerySet.annotate(), QuerySet.alias(), QuerySet.aggregate(), and QuerySet.extra() are subject to SQL injection in column aliases, when using a suitably crafted dictionary, with dictionary expansion, as the **kwargs passed to these methods (on MySQL and MariaDB).

SeverityHigh
CVSS7.1
Exploit probability—
ProductDjango
PublishedOct 1, 2025
First seenOct 1, 2025
Weakness typeCWE-89SQL injection

How to fix

Update
  • djangoproject django4.2.25, 5.1.13, 5.2.7 or later
  • django4.2.25, 5.1.13, 5.2.7 or later

Affected products

ProductAffected versionsFixed in
djangoproject django4.2 ≤ v < 4.2.25, 5.1 ≤ v < 5.1.13, 5.2 ≤ v < 5.2.74.2.25, 5.1.13, 5.2.7
djangoPyPI4.2 ≤ v < 4.2.25, 5.1 ≤ v < 5.1.13, 5.2 ≤ v < 5.2.74.2.25, 5.1.13, 5.2.7

Check your version

Choose the product and enter the version you run to see whether it falls in the affected range.

In the Intelligence 360 plan

Attack Surface Management

See the assets tied to your domains, the technologies they run and known vulnerabilities in one list.