Intel

AIKIDO-2026-205310

django is vulnerable to Insecure Direct Object Reference

CVE-2026-87975Published Oct 16, 2026
October 16, 2026

45

CVE Score

Medium

Insecure Direct Object Reference

Are you affected? Scan for Free

TL;DR

Django's BaseModelFormSet.save_existing_objects() in django/forms/models.py decided whether a submitted form's instance belonged to the formset's limiting queryset solely by checking whether its primary key was set (obj._is_pk_set()). When a model uses a non-AutoField primary key that is also a form field (e.g. a OneToOneField/parent-link used as PK, or a natural/UUID PK), an attacker-controlled form submission for an object outside the limiting queryset can populate that PK, causing the formset to treat it as an existing in-queryset row. An authenticated user permitted to submit such a formset could forge management-form data marking that out-of-queryset object for deletion, deleting rows they have no permission over, or create an instance through an edit-only formset. The fix adds a check for obj._state.adding so that unsaved/out-of-queryset instances are skipped even when their primary key field is populated from submitted data.

How do I fix this?

Upgrade the django library to the patch version.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and you use model formsets whose primary key is set from submitted fields, such as a OneToOneField or parent link, or a natural or UUID primary key.

Package

Versions

5.2 - 5.2.17

Fixed in 5.2.18

6.0 - 6.0.8

Fixed in 6.0.9

6.1 - 6.1.1

Fixed in 6.1.2

Background info

django is vulnerable to Insecure Direct Object Reference in versions 6.1 - 6.1.1, 6.0 - 6.0.8 and 5.2 - 5.2.17.

Get secure today,
quickly and for free.

Secure your code, cloud, and runtime in one central system. Connect a repo to discover what the reasoning agents find in your codebase.

No credit card required | Scan results in 32 seconds.

Trusted by 150k+ orgs
  • Revolut
  • n8n
  • Lovable
  • Deel
  • Prove
  • Omnea