GHSA-7FQG-CHMV-C89G
Creating a page from a page type discloses cross-site and view-restricted page-type content
Texto original en inglés · Ver en español
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche 5.1.3 | django-cms · -1 d desde divulgación | |
| Divulgación | Publicada | GHSA-7FQG-CHMV-C89G divulgada · CVSS 3.1 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
With `CMS_PERMISSION=True`, the *Page type* field of the add-page form accepts any page type in the database, on any site, including ones the requesting user is not allowed to view. The chosen page type's placeholders, plugins and extensions are copied into the new page, and the copy is created without the view restrictions that protected the source. An authenticated delegated CMS editor who may add a page anywhere can therefore read the content of a page type belonging to another site or to a restricted branch.
This is the add-page counterpart of GHSA-6x92-6vx4-5fwr, which added the source read check to the *Duplicate* path only.
Details
`AddPageForm.source` is declared as `forms.ModelChoiceField(queryset=Page.objects.filter(is_page_type=True))`. The queryset spans every site and applies no permission filter.
`AddPageForm.__init__` narrows `source_field.choices` to the page types below the current site's page-type root, but a `ModelChoiceField` validates its value against the *queryset*, not against the choices. When fewer than two choices exist the widget is additionally swapped for a `HiddenInput`, which does not restrict the value either. `source` is therefore a client-controlled field whose accepted values are every `is_page_type=True` row in the database.
`AddPageForm` has `clean_parent_page` and `clean_cms_page` but no `clean_source`. `PageContentAdmin.has_add_permission` only establishes that the user may create *a* page under the parent taken from the query string; nothing establishes that the user may read `source`.
`AddPageForm.save` then calls `from_source(source)`, which invokes `Page.copy(..., permissions=False)`, followed by `extension_pool.copy_extensions` and a per-placeholder `copy_plugins` loop. Two consequences follow:
- the source's content is disclosed to the requesting user in a page they own; and
- because `permissions=False`, a view-restricted source yields an unrestricted copy, republishing that content to anyone who can reach the new page.
The sibling `DuplicatePageForm.clean_source` performs exactly the missing `user_can_view_page` check, and `DuplicatePageForm.from_source` performs exactly the missing restriction carry-over. `AddPageForm` had neither, and `CreateCMSPageForm` (the page wizard) inherits the unguarded field.
A related, lower-severity consequence: the choices built in `__init__` apply no permission filter either, so the add-page dropdown discloses the *titles* of the current site's page types to any staff user who may add a page.
Impact and prerequisites
The attack requires:
- `CMS_PERMISSION=True`;
- an authenticated staff user with the model and CMS permissions needed to add a page somewhere;
- at least one row with `is_page_type=True` in the database that is either on a different site or protected by a per-page view restriction.
The last prerequisite is the limiting one. Page types cannot be created through the interface in django CMS 4.x or 5.x: `AddPageTypeForm` is not referenced by any admin class, there is no admin URL or toolbar entry for creating one, `cms.api` offers no way to create one, and no test creates one. On a clean 4.x or 5.x installation the queryset is empty and the field is inert. Exploitation therefore requires a database that still carries page types migrated from django CMS 3.x, or created programmatically by project or third-party code.
Confidentiality only. Writes are unaffected: the new page is created in a location the user is already authorized to add to.
Reproduction summary
- On site A, give a staff editor the `add_page` model permission and an add/change CMS grant on one page.
- Create a page type (set `is_page_type=True` on a page) either on site B or restricted by a `can_view` `PagePermission` granted to a different user, and place a distinct text marker in one of its placeholders.
- Confirm `user_can_view_page(editor, page_type)` is `False`, or that the page type belongs to a site the editor has no rights on.
- As the editor, POST to `/admin/cms/pagecontent/add/?parent_page=<page the editor may add under>` with `source=<page-type id>`, plus `title`, `slug` and `parent_page`.
- On vulnerable code the response is a 302, the new page contains the marker copied from the page type, and the new page carries no view restriction.
A regular (non page-type) page submitted as `source` is correctly refused by the `is_page_type=True` queryset filter; only page types are reachable.
Fix behavior
`AddPageForm` now narrows `source_field.queryset`, and not only the widget's choices, to the descendants of the current site's page-type root — so a page type on another site, and the page-type root container itself, are refused during validation rather than merely omitted from the rendered dropdown.
`AddPageForm.clean_source` checks `user_can_view_page` on the submitted source and is inherited by `AddPageTypeForm`, `DuplicatePageForm` and the wizard's `CreateCMSPageForm`. The denial message is configurable per form through the new `source_permission_denied` attribute.
`AddPageForm.from_source` now calls `Page.apply_view_restrictions(source.get_view_restrictions())`, so a restricted page type yields an equally restricted page. `DuplicatePageForm` previously carried its own copies of both behaviours; they are now inherited from `AddPageForm` and the subclass only overrides the message.
Workarounds
Installations with no `is_page_type=True` rows are not affected and need no action. Otherwise, until a patched release is available, delete or unrestrict the leftover page types, or remove the add-page permission from untrusted delegated editors. Hiding the field in the UI is not sufficient: `source` is accepted on POST even when its widget is hidden.
Validation and scope
Reproduced on `5.2.0dev1` using the project test harness without djangocms-versioning, for both the restricted same-site page type and the cross-site page type, and covered by regression tests in `cms/tests/test_copy_permissions.py`. The affected source pattern was inspected in local tags 5.1.2 and 5.0.11; those releases were not independently runtime-tested in this review.
Reported by @fatihsugar, who also identified the incomplete-fix relationship to GHSA-6x92-6vx4-5fwr.
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.1.3 | -1 d | 5.1.3 no afectada |
5.1.3Arsenal 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-7fqg-chmv-c89gLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
