CVE-2025-59681: Django CVE-2025-59681 and CVE-2025-59682

Published Sep 30, 2025
·
Updated

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

Other sources

QuerySet.annotate(), QuerySet.alias(), QuerySet.aggregate(), andQuerySet.extra() methods were subject to SQL injection in column aliases, using a suitably crafted dictionary, with dictionary expansion, as the kwargs passed to these methods on MySQL and MariaDB.

— Red Hat

Affected Software

14 affected componentsFixes available
Django Django<4.2.25
Django Django<5.1.13
Django Django<5.2.7
pip/django>=5.2<5.2.7
5.2.7
pip/django>=5.1<5.1.13
5.1.13
pip/django>=4.2<4.2.25
4.2.25
djangoproject Django>=4.2<4.2.25
djangoproject Django>=5.1<5.1.13
djangoproject Django>=5.2<5.2.7
alpine/py3-django<4.2.25-r0
4.2.25-r0
alpine/py3-django<4.2.25-r0
4.2.25-r0
alpine/py3-django<4.2.25-r0
4.2.25-r0
debian/python-django
3:3.2.25-0+deb12u33:3.2.25-0+deb12u63:4.2.28-0+deb13u23:4.2.28-0+deb13u13:5.2.17-23:5.2.19-1
IBM SevOne Network Performance Management<=7.0.0 - 8.2.2

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/django to a version that resolves this vulnerability.

    Fixed in 5.2.7
  2. Upgrade

    Upgrade pip/django to a version that resolves this vulnerability.

    Fixed in 5.1.13
  3. Upgrade

    Upgrade pip/django to a version that resolves this vulnerability.

    Fixed in 4.2.25
  4. Upgrade

    Upgrade alpine/py3-django to a version that resolves this vulnerability.

    Fixed in 4.2.25-r0
  5. Upgrade

    Upgrade debian/python-django to a version that resolves this vulnerability.

    Fixed in 3:3.2.25-0+deb12u3Fixed in 3:3.2.25-0+deb12u6Fixed in 3:4.2.28-0+deb13u2Fixed in 3:4.2.28-0+deb13u1Fixed in 3:5.2.17-2Fixed in 3:5.2.19-1

Event History

Sep 30, 2025
Data Sourced
via Red Hat·01:17 PM
DescriptionSeverityAffected Software
Oct 1, 2025
CVE Published
via MITRE·12:00 AM
Data Sourced
via MITRE·12:00 AM
DescriptionSeverityWeakness
Data Sourced
via NVD·07:15 PM
DescriptionSeverityWeaknessAffected Software
Data Sourced
via OSV·07:15 PM
DescriptionSeverityAffected Software
Advisory Published
via GitHub·09:31 PM
Data Sourced
via GitHub·09:31 PM
DescriptionSeverityWeaknessAffected Software
Sep 26, 2026
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Peer vulnerabilities

Found alongside the following vulnerabilities.

Frequently Asked Questions

1

What is the severity of CVE-2025-59681?

CVE-2025-59681 is classified as a high severity vulnerability due to its potential for SQL injection attacks.

2

How do I fix CVE-2025-59681?

To fix CVE-2025-59681, upgrade Django to versions 4.2.25, 5.1.13, or 5.2.7 or later.

3

What products are affected by CVE-2025-59681?

CVE-2025-59681 affects Django versions before 4.2.25, 5.1.13, and 5.2.7.

4

What kind of attack can be executed through CVE-2025-59681?

CVE-2025-59681 can allow an attacker to perform SQL injection through improperly handled column aliases.

5

How can I prevent CVE-2025-59681 in my application?

To prevent CVE-2025-59681, ensure that your Django application is running a patched version and avoid using unsafe user inputs in database queries.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203