GitHub advisory · PyPI
djangocms-versioning: Authorization Bypass Through User-Controlled Key and Missing Authorization
Description
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).
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_<model> permission).
Two conditions were missing that check:
# 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.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…
Manual fix · PyPI
pip install --upgrade "djangocms-versioning>=2.6.1"Sources