CVE-2026-87975Privilege abuse in model formsets with editable primary keys
An issue was discovered in Django 6.1 before 6.1.2, 6.0 before 6.0.9, and 5.2 before 5.2.18. `django.forms.models.BaseModelFormSet.save_existing_objects()` used the presence of a primary key on a submitted form's instance as evidence that the instance belonged to the formset's limiting queryset. An object outside that queryset is represented by a newly constructed instance whose primary key can still be populated from submitted data when the model's primary key is a field accepted by the form, such as a `OneToOneField` or parent link used as the primary key of an inline formset's model, or a natural or UUID primary key included in the form's fields. This allows an authenticated user permitted to submit such a formset to delete rows outside the limiting queryset, without any permission on the targeted object, via forged management-form data marking an out-of-queryset object for deletion. Models using the default AutoField primary key are not affected. Earlier, unsupported Django series (such as 5.1.x, 5.0.x, and 4.2.x) were not evaluated and may also be affected. Django would like to thank Seonggwon Yoon for reporting this issue.
What to do
Fixed builds are available from Alpine, Debian: see the table below for the fixed version per release.
Debian, Ubuntu have not shipped a fix for every release yet.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 26.10 | python-django | Fix pending | UBUNTU-CVE-2026-87975 | |
| Ubuntu 26.04 | python-django | Under investigation | UBUNTU-CVE-2026-87975 | |
| Ubuntu 24.04 | python-django | Under investigation | UBUNTU-CVE-2026-87975 | |
| Ubuntu 22.04 | python-django | Under investigation | UBUNTU-CVE-2026-87975 | |
| Ubuntu 20.04 | python-django | Fix pending | UBUNTU-CVE-2026-87975 | |
| Ubuntu 18.04 | python-django | Fix pending | UBUNTU-CVE-2026-87975 | |
| Ubuntu 16.04 | python-django | Fix pending | UBUNTU-CVE-2026-87975 | |
| Ubuntu 14.04 | python-django | Fix pending | UBUNTU-CVE-2026-87975 | |
| Debian 14 | python-django | Fixed | 3:5.2.18-1 | DEBIAN-CVE-2026-87975 |
| Debian 13 | python-django | Fix pending | DEBIAN-CVE-2026-87975 | |
| Debian 12 | python-django | Fixed | 3:3.2.25-0+deb12u6 | DEBIAN-CVE-2026-87975 |
| Alpine Linux 3.24 | py3-django | Fixed | 5.2.18-r0 | ALPINE-CVE-2026-87975 |
What the vendor says
As published in the CVE record by DSF, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- djangoproject Django: affected: 6.1 to before 6.1.2, 6.1.2 not affected, 6.0 to before 6.0.9, 6.0.9 not affected, 5.2 to before 5.2.18, 5.2.18 not affected; fixed in
6.1.2,6.0.9,5.2.18
Vendor advisories:
- https://docs.djangoproject.com/en/dev/releases/security/ (vendor-advisory)
- https://github.com/django/django/commit/83cbd21be57483e6b3eb6e4688a561c841aff75e (patch)
- https://github.com/django/django/commit/cce6c57ed30ea83725f9d6abb2fe5ee932bab107 (patch)
- https://github.com/django/django/commit/b83ab92bc5474558b083a840ea4628b3261b2cfe (patch)
- https://github.com/django/django/commit/ff27883ca055aa9ab23015b50674a5b10dfe5a41 (patch)
- https://www.djangoproject.com/weblog/2026/oct/06/security-releases/ (vendor-advisory)
References
- https://docs.djangoproject.com/en/dev/releases/security/
- https://groups.google.com/g/django-announce
- https://github.com/django/django/commit/83cbd21be57483e6b3eb6e4688a561c841aff75e
- https://github.com/django/django/commit/cce6c57ed30ea83725f9d6abb2fe5ee932bab107
- https://github.com/django/django/commit/b83ab92bc5474558b083a840ea4628b3261b2cfe
- https://github.com/django/django/commit/ff27883ca055aa9ab23015b50674a5b10dfe5a41
- https://www.djangoproject.com/weblog/2026/oct/06/security-releases/
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.