django is vulnerable to Insecure Direct Object Reference
45
CVE Score
Medium
Insecure Direct Object Reference
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.
Upgrade the django library to the patch version.
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.
5.2 - 5.2.17
Fixed in 5.2.186.0 - 6.0.8
Fixed in 6.0.96.1 - 6.1.1
Fixed in 6.1.2django 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.
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.
I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant
ISO 42001Compliant© All Intel data is openly available and commercially licensed.