NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · PyPI

CVE-2025-59681: Django vulnerable to SQL injection in column aliases

highCVSS 3.1 7.1GHSA-hpr9-3m2g-3j9p

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

Published Oct 1, 2025 · Updated Jun 5, 2026

Affected packages

django

Ecosystem
PyPI
Affected
>= 4.2, < 4.2.25
Fixed in
4.2.25
Check
pip show django

django

Ecosystem
PyPI
Affected
>= 5.1, < 5.1.13
Fixed in
5.1.13
Check
pip show django

django

Ecosystem
PyPI
Affected
>= 5.2, < 5.2.7
Fixed in
5.2.7
Check
pip show django

Advisory details

From the GitHub Advisory Database (CC BY 4.0).

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

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology

More PyPI vulnerabilities

All PyPI entries