GHSA-5g9x-qwh5-33x4: djangocms-versioning: Authorization Bypass Through User-Controlled Key and Missing Authorization
- Source:
- OSV.dev
- Published:
- Fetched:
- Updated:
- Affects:
- djangocms-versioning
https://osv.dev/vulnerability/GHSA-5g9x-qwh5-33x4 ↗
djangocms-versioning: Authorization Bypass Through User-Controlled Key and Missing Authorization ## Summary The `discard` and `edit_redirect` version transitions did not enforce a per-object change-permission check, while the sibling transitions (`archive`, `publish`, `unpublish`, `revert`) all did. As a result a low-privileged staff user could **discard (delete) any draft version — and thereby the underlying content object — of content they have no change permission on**, and could create an editable draft off any published version, by supplying a version primary key they should not have access to (an insecure direct object reference). ## Details Version state transitions are guarded by `Conditions` objects declared on `djangocms_versioning.models.Version`. Every transition that mutates content carries the `user_can_change` condition, which delegates to the *content* object's own permission check (`Version.has_change_permission` → `content.has_change_permission` / `has_placeholder_change_permission`, with a final fallback to the Django `change_ ` permission). Two conditions were missing that check: ```python # Before (vulnerable) check_discard = Conditions([ in_state([constants.DRAFT], not_draft_error), is_not_locked(lock_error_message), ]) check_edit_redirect = Conditions([ in_state([constants.DRAFT, constants.PUBLISHED], _("Version is not in draft or published state")), draft_is_not_locked(lock_draft_error_message), ]) ``` The corresponding admin views authorize **only** through these conditions: * `VersionAdmin.discard_view` / `VersionAdmin.edit_redirect_view` fetch the target with the stock `ModelAdmin.get_object`, which is backed by the **unfiltered** default queryset — no per-user or per-grouper scoping. * The views are registered with `admin_site.admin_view`, which enforces only `is_staff`. * `discard_view` deletes the version directly via `version.delete()` and never consults `VersionAdmin.has_delete_permission` (which otherwise delegates to the content admin and honors `ALLOW_DELETING_VERSIONS`). Because the only per-object gate for these two operations was the `Conditions` list, and that list omitted `user_can_change`, any staff user could invoke the operation on any version by its primary key. The changelist action buttons are disabled in the UI via `check_discard.as_bool` / `check_edit_redirect.as_bool`, but that is a client-side affordance only and does not protect the directly reachable admin URLs. ## Impact * **Type:** Broken access control / missing authorization (IDOR). * **Who is affected:** Multi-editor deployments where staff users hold differentiated per-object permissions. * Under `CMS_PERMISSION = True`, authorization for these two operations was effectively reduced to `is_staff`, so any staff user could discard or edit-redirect any version. * Under the default `CMS_PERMISSION = False`, it degrades to the global `change_ ` permission (e.g. `cms.change_page`) — weaker than the intended per-object check, but not absent. * **Consequence:** Unauthorized deletion Affected: PyPI:djangocms-versioning Fixed in: 2.6.1 References: https://github.com/django-cms/djangocms-versioning/security/advisories/GHSA-5g9x-qwh5-33x4 https://github.com/django-cms/djangocms-versioning/pull/573 https://github.com/django-cms/djangocms-versioning/commit/d8c570daa5f7805e8be51f15545fe77b24c44daf https://github.com/django-cms/djangocms-versioning https://github.com/django-cms/djangocms-versioning/releases/tag/2.6.1