Skip to main content
CVE-2025-59681VulnerabilityPublished Updated

CVE-2025-59681: djangoproject Django · SQL Injection

Affects djangoproject DjangoSource CVE Database V5

0

Not known to be exploited · CVSS 7.1 High.

Data as of 25 Oct 2026, 19:02 UTC

CVSS 3.1 base score
7.1High
How severe the flaw is on the 0–10 CVSS scale.
EPSS
0.6% chance of exploitation in 30 days – higher than 50% of CVEsExploit Prediction Scoring System: the likelihood attackers will use this flaw soon.
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:N

Exploitation evidence

  1. Disclosed: evidence found.

    CVE published 1 Oct 2025

  2. Detectable: no evidence on record.

    No public nuclei template indexed

  3. Weaponised: no evidence on record.

    No public exploit code indexed in Metasploit or Exploit-DB

  4. Exploited in the wild: no evidence on record.

    Not in CISA KEV and no source reports exploitation

  5. Observed by OffSeq Mirage: no evidence on record.

    No attack traffic recorded by OffSeq Mirage sensors

A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 2026-10-25.

What to do

Affected software

ProductAffectedFixed in
djangoproject DjangoAffected
  • =4.2
  • =5.1
  • =5.2
Fixed in–

AI-suggested

European organizations should immediately audit their Django applications to identify usage of QuerySet methods annotate(), alias(), aggregate(), and extra() where dictionary expansion (**kwargs) is used, especially on MySQL or MariaDB backends. The primary mitigation is to upgrade Django to versions 4.2.25 or later, 5.1.13 or later, and 5.2.7 or later once patches are available. Until upgrades can be applied, developers should avoid passing untrusted input via dictionary expansion to these QuerySet methods or implement strict input validation and sanitization. Employing Web Application Firewalls (WAFs) with custom rules to detect suspicious SQL patterns may provide temporary protection. Additionally, monitoring database query logs for anomalous queries can help detect exploitation attempts. Organizations should also review database user permissions to follow the principle of least privilege, limiting the potential impact of any injection. Regular security testing, including code reviews and penetration testing focused on ORM usage, is recommended to prevent similar vulnerabilities.

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).

References

Community reviews

Loading reviews…