Skip to content
NewA calmer, faster ZeroHour
Vulnerability3 · 2 reads

CVE-2026-87975

Authorization Bypass Allows Cross-QuerySet Row Deletion in Django Model Formsets

CVSS 4.0
5.3 medium
EPSS
—
Published
·
Modified
Analyze CVE-2026-87975 with Vani AIImpact, affected versions, exploitation status, mitigations and detection

Django's BaseModelFormSet.save_existing_objects() treated a populated primary key on a submitted form instance as proof that the object belonged to the formset's limiting queryset, which is not a safe assumption when the primary key itself is an editable form field. An authenticated attacker who is allowed to submit a model formset (e.g., an inline formset in the admin or app UI) can forge management-form data marking an out-of-queryset object for deletion, causing rows outside the intended queryset to be deleted without any permission check on the targeted object. The flaw requires the model's primary key to be a field accepted by the form — such as a OneToOneField parent link on an inline formset model, or a UUID/natural primary key — while models using the default AutoField primary key are not affected. Applications running Django 6.1 before 6.1.2, 6.0 before 6.0.9, or 5.2 before 5.2.18 are affected, and earlier unsupported series (5.1.x, 5.0.x, 4.2.x) were not evaluated and may also be vulnerable. There is no known public proof of concept and no indication of exploitation in the wild; the issue is not on the CISA KEV catalog.

What to do: Upgrade immediately to Django 6.1.2, 6.0.9, or 5.2.18 depending on your series; if you are on an unsupported series (4.2, 5.0, 5.1), move to a supported fixed release since no backport is provided. Audit any use of model formsets or inline formsets (including Django admin inlines) whose models use a OneToOneField parent link, UUID, or natural key as the primary key exposed in the form — models with the default AutoField primary key are not affected. Until patched, restrict which authenticated users can submit such formsets and review logs for management-form submissions marking unexpected objects for deletion.

ProductAffected
Django Software Foundation (Django) Django6.1 before 6.1.2
Django Software Foundation (Django) Django6.0 before 6.0.9
Django Software Foundation (Django) Django5.2 before 5.2.18
Django Software Foundation (Django) Django5.1.x, 5.0.x, and 4.2.x (unsupported; not evaluated, may also be affected)
Estimated exposure
largetens of thousands of Django applications plausibly affected (of roughly 1M+ sites built on Django, only a subset use inline formsets whose primary key is a… — Django is one of the most widely deployed Python web frameworks (estimates of 1M+ live sites and tens of millions of monthly PyPI downloads), but Django sites are not reliably fingerprintable by internet scans, and the vulnerable…

Order-of-magnitude estimate by the model from install counts, market share and public scan data it knows; verify before quoting.

Description · NVD

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.

Weakness
CWE-639
Vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

In the news

1 story