GHSA-VWCW-R26R-22CC
Privilege escalation: delegated CMS administrator can take over a superuser account
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche 5.0.10 | django-cms · -5 d desde divulgación | |
| Divulgación | Publicada | GHSA-VWCW-R26R-22CC divulgada · CVSS 7.2 (GitHub) | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
When the CMS permission system is enabled (`CMS_PERMISSION = True`), a staff user who has been delegated user management rights can change the password of a superuser account through the "Users (page)" admin, and then log in as that superuser. This converts a scoped, delegated administrator into a full site administrator.
Details
django-cms builds a delegation hierarchy on top of Django's admin. `PageUserAdmin` restricts what a delegated administrator may see and do to the set of *subordinate* users returned by `cms.utils.permissions.get_subordinate_users()`.
That function had no notion of superusers being off-limits. At the top of the hierarchy it returned every user in the system:
# cms/utils/permissions.py (before the fix)
if user_level == ROOT_USER_LEVEL:
return get_user_model().objects.all() # includes superusers`ROOT_USER_LEVEL` is reached by any user holding a `GlobalPagePermission` with `can_change_permissions=True` — not just superusers (`get_user_permission_level()`, `cms/utils/permissions.py`).
`PageUserAdmin.get_queryset()` filters on that set, so superuser `PageUser` records appeared in the changelist and were resolvable by `get_object()`.
`PageUserAdmin` did guard the *edit form*: `get_readonly_fields()` adds `is_superuser` to the read-only fields for non-superusers, so a delegated administrator could not grant themselves the superuser flag. But Django's `UserAdmin.user_change_password()` is a separate endpoint (`<id>/password/`) whose only authorisation check is `has_change_permission(request, user)` — which returned `True`, because the superuser was considered a subordinate. The read-only field guard does not apply there.
The two protections were therefore inconsistent: the flag could not be granted, but the account holding it could simply be taken over.
Note the deeper issue is not limited to the password endpoint. Because superusers were in the subordinate queryset, a delegated administrator could also open the superuser's change form and alter its username or email address, opening a second route to takeover via the password reset flow.
Preconditions
All of the following must hold:
- `CMS_PERMISSION = True`.
- The attacker is an authenticated staff user holding the `cms.change_pageuser` model permission and `GlobalPagePermission(can_change_permissions=True)` (or an equivalent `PagePermission` at a level above the target).
- The victim superuser exists as a `PageUser` row. `PageUser` is a multi-table inheritance child of the user model, so accounts created with `createsuperuser` are *not* affected — only superusers created or registered through `/admin/cms/pageuser/`.
Condition 3 is what limits real-world exposure: many deployments never register a superuser as a `PageUser`. Deployments that provision all staff through the CMS user admin are the exposed population.
Proof of concept
With a superuser `PageUser` `victim` and an attacker as described above:
GET /admin/cms/pageuser/ -> 200, victim listed
GET /admin/cms/pageuser/<victim_pk>/change/ -> 200, "change password" link present
GET /admin/cms/pageuser/<victim_pk>/password/ -> 200
POST /admin/cms/pageuser/<victim_pk>/password/ -> 302, password changedThe attacker then logs in as the superuser. Verified against 5.1.0 with Django 6.0.
Impact
Complete compromise of the Django admin and every application mounted in it: read and write of all CMS content and all other registered models, user and permission administration, and anything else reachable by a superuser. Confidentiality, integrity and availability are all fully impacted.
The attacker must already hold a privileged staff account, so this is an escalation from *delegated administrator* to *full superuser*, not an unauthenticated compromise.
Patches
Two changes, defence in depth:
- `cms/utils/permissions.py` — `get_subordinate_users()` A superuser is never subordinate to a non-superuser. All three return paths now exclude `is_superuser=True` rows unless the requesting user is themselves a superuser. This closes the changelist, the change form, the delete view and the password endpoint in one place, because every one of them is queryset-scoped.
- `cms/admin/useradmin.py` — `PageUserAdmin` Object-level guards for the case where the queryset is widened again by a subclass or a custom user admin: `has_change_permission()` and `has_delete_permission()` refuse superuser targets for non-superuser requesters, and `user_change_password()` raises `PermissionDenied` before delegating to Django.
After the fix the password endpoint returns 404 to a delegated administrator — the superuser is no longer in the admin's queryset at all, so its existence is not disclosed.
Regression coverage was added in `cms/tests/test_page_user_admin.py` (`SuperuserProtectionTest`, 8 tests) covering the subordinate query, the changelist, the change view, the delete view, the password endpoint, the object-level guards, and
that a genuine superuser retains all of these abilities.
Workarounds
For deployments that cannot upgrade immediately, any one of:
- Ensure no superuser account exists as a `PageUser` record. Superusers created with `createsuperuser` are not exposed:
- Revoke the `cms.change_pageuser` permission from all non-superuser staff.
- Revoke `can_change_permissions` from non-superuser `GlobalPagePermission` records.
References
- Fix commit: `d32c2020f`
- `cms/utils/permissions.py` — `get_subordinate_users()`
- `cms/admin/useradmin.py` — `PageUserAdmin`
- Django `UserAdmin.user_change_password()` — `django/contrib/auth/admin.py`
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
pypidjango-cms |
Corregida | 5.0.10 | -5 d | 5.1.3 no afectada |
5.0.10Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/django-cms/django-cms/security/advisories/GHSA-vwcw-r26r-22ccLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
