
oss-sec mailing list archives
Django CVE-2025-59681 and CVE-2025-59682
From: Jacob Walls <jwalls () djangoproject com>
Date: Wed, 1 Oct 2025 10:51:07 -0400
* Announce link: https://www.djangoproject.com/weblog/2025/oct/01/security-releases/ * Announce content: In accordance with `our security release policy <https://docs.djangoproject.com/en/dev/internals/security/>`_, the Django team is issuing releases for `Django 5.2.7 <https://docs.djangoproject.com/en/dev/releases/5.2.7/>`_, `Django 5.1.13 <https://docs.djangoproject.com/en/dev/releases/5.1.13/>`_, and `Django 4.2.25 <https://docs.djangoproject.com/en/dev/releases/4.2.25/>`_. These releases address the security issues detailed below. We encourage all users of Django to upgrade as soon as possible. CVE-2025-59681: Potential SQL injection in ``QuerySet.annotate()``, ``alias()``, ``aggregate()``, and ``extra()`` on MySQL and MariaDB ====================================================================================================================================== ``QuerySet.annotate()``, ``QuerySet.alias()``, ``QuerySet.aggregate()``, and ``QuerySet.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. Thanks to sw0rd1ight for the report. This issue has severity "high" according to the Django security policy. CVE-2025-59682: Potential partial directory-traversal via ``archive.extract()`` =============================================================================== The ``django.utils.archive.extract()`` function, used by ``startapp --template`` and ``startproject --template``, allowed partial directory-traversal via an archive with file paths sharing a common prefix with the target directory. Thanks to stackered for the report. This issue has severity "low" according to the Django security policy. Affected supported versions =========================== * Django main * Django 6.0 (currently at alpha status) * Django 5.2 * Django 5.1 * Django 4.2 Resolution ========== Patches to resolve the issue have been applied to Django's main, 6.0 (currently at alpha status), 5.2, 5.1, and 4.2 branches. The patches may be obtained from the following changesets. CVE-2025-59681: Potential SQL injection in QuerySet.annotate(), alias(), aggregate(), and extra() on MySQL and MariaDB ---------------------------------------------------------------------------------------------------------------------- * On the `main branch < https://github.com/django/django/commit/41b43c74bda19753c757036673ea9db74acf494a
`__
* On the `6.0 branch < https://github.com/django/django/commit/4ceaaee7e04b416fc465e838a6ef43ca0ccffafe
`__
* On the `5.2 branch < https://github.com/django/django/commit/52fbae0a4dbbe5faa59827f8f05694a0065cc135
`__
* On the `5.1 branch < https://github.com/django/django/commit/01d2d770e22bffe53c7f1e611e2bbca94cb8a2e7
`__
* On the `4.2 branch < https://github.com/django/django/commit/38d9ef8c7b5cb6ef51b933e51a20e0e0063f33d5
`__
CVE-2025-59682: Potential partial directory-traversal via archive.extract() --------------------------------------------------------------------------- * On the `main branch < https://github.com/django/django/commit/924a0c092e65fa2d0953fd1855d2dc8786d94de2
`__
* On the `6.0 branch < https://github.com/django/django/commit/af067f56c1dd467df4abd0ddd409a700da1f03ba
`__
* On the `5.2 branch < https://github.com/django/django/commit/ed8fc39d77465eddbde1191a054ae965f6a8a584
`__
* On the `5.1 branch < https://github.com/django/django/commit/74fa85c688a87224637155902bcd738bb9e65e11
`__
* On the `4.2 branch < https://github.com/django/django/commit/9504bbaa392c9fe37eee9291f5b4c29eb6037619
`__
The following releases have been issued ======================================= * Django 5.2.7 (`download Django 5.2.7 <https://www.djangoproject.com/download/5.2.7/tarball/>`_ | `5.2.7 checksums <https://www.djangoproject.com/download/5.2.7/checksum/>`_) * Django 5.1.13 (`download Django 5.1.13 <https://www.djangoproject.com/download/5.1.13/tarball/>`_ | `5.1.13 checksums <https://www.djangoproject.com/download/5.1.13/checksum/>`_) * Django 4.2.25 (`download Django 4.2.25 <https://www.djangoproject.com/download/4.2.25/tarball/>`_ | `4.2.25 checksums <https://www.djangoproject.com/download/4.2.25/checksum/>`_) The PGP key ID used for this release is Jacob Walls: `131403F4D16D8DC7 < https://github.com/jacobtylerwalls.gpg>`_ General notes regarding security reporting ========================================== As always, we ask that potential security issues be reported via private email to ``security () djangoproject com``, and not via Django's Trac instance, nor via the Django Forum. Please see `our security policies <https://www.djangoproject.com/security/>`_ for further information. * Machine-readable CVE data for CVE-2025-59681: { "affected": [ { "collectionURL": "https://github.com/django/django/", "defaultStatus": "affected", "packageName": "django", "versions": [ { "lessThan": "5.2.7", "status": "affected", "version": "5.2.0", "versionType": "semver" }, { "lessThan": "5.2.*", "status": "unaffected", "version": "5.2.7", "versionType": "semver" }, { "lessThan": "5.1.13", "status": "affected", "version": "5.1.0", "versionType": "semver" }, { "lessThan": "5.1.*", "status": "unaffected", "version": "5.1.13", "versionType": "semver" }, { "lessThan": "4.2.25", "status": "affected", "version": "4.2.0", "versionType": "semver" }, { "lessThan": "4.2.*", "status": "unaffected", "version": "4.2.25", "versionType": "semver" } ] } ], "credits": [ { "lang": "en", "type": "reporter", "value": "Django would like to thank sw0rd1ight for reporting this issue." } ], "datePublic": "10/01/2025", "descriptions": [ { "lang": "en", "value": "QuerySet.annotate(), QuerySet.alias(), QuerySet.aggregate(), and QuerySet.extra() methods are 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." } ], "metrics": [ { "other": { "content": { "namespace": " https://docs.djangoproject.com/en/dev/internals/security/#security-issue-severity-levels ", "value": "high" }, "type": "Django severity rating" } } ], "references": [ { "name": "Django security releases issued: 5.2.7, 5.1.13, and 4.2.25", "tags": [ "vendor-advisory" ], "url": " https://www.djangoproject.com/weblog/2025/oct/01/security-releases/" } ], "timeline": [ { "lang": "en", "time": "2025-10-01T14:00:00+00:00", "value": "Made public." } ], "title": "Potential SQL injection in QuerySet.annotate(), alias(), aggregate(), and extra() on MySQL and MariaDB" } * Machine-readable CVE data for CVE-2025-59682: { "affected": [ { "collectionURL": "https://github.com/django/django/", "defaultStatus": "affected", "packageName": "django", "versions": [ { "lessThan": "5.2.7", "status": "affected", "version": "5.2.0", "versionType": "semver" }, { "lessThan": "5.2.*", "status": "unaffected", "version": "5.2.7", "versionType": "semver" }, { "lessThan": "5.1.13", "status": "affected", "version": "5.1.0", "versionType": "semver" }, { "lessThan": "5.1.*", "status": "unaffected", "version": "5.1.13", "versionType": "semver" }, { "lessThan": "4.2.25", "status": "affected", "version": "4.2.0", "versionType": "semver" }, { "lessThan": "4.2.*", "status": "unaffected", "version": "4.2.25", "versionType": "semver" } ] } ], "credits": [ { "lang": "en", "type": "reporter", "value": "Django would like to thank stackered for reporting this issue." } ], "datePublic": "10/01/2025", "descriptions": [ { "lang": "en", "value": "The django.utils.archive.extract() function, used by \"startapp --template\" and \"startproject --template\", allows partial directory-traversal via an archive with file paths sharing a common prefix with the target directory." } ], "metrics": [ { "other": { "content": { "namespace": " https://docs.djangoproject.com/en/dev/internals/security/#security-issue-severity-levels ", "value": "low" }, "type": "Django severity rating" } } ], "references": [ { "name": "Django security releases issued: 5.2.7, 5.1.13, and 4.2.25", "tags": [ "vendor-advisory" ], "url": " https://www.djangoproject.com/weblog/2025/oct/01/security-releases/" } ], "timeline": [ { "lang": "en", "time": "2025-10-01T14:00:00+00:00", "value": "Made public." } ], "title": "Potential partial directory-traversal via archive.extract()" }
Current thread:
- Django CVE-2025-59681 and CVE-2025-59682 Jacob Walls (Oct 01)