Описание
Wagtail vulnerable to stored Cross-site Scripting attack via ModelAdmin views
Impact
A stored cross-site scripting (XSS) vulnerability exists on ModelAdmin views within the Wagtail admin interface. A user with a limited-permission editor account for the Wagtail admin could potentially craft pages and documents that, when viewed by a user with higher privileges, could perform actions with that user's credentials. The vulnerability is not exploitable by an ordinary site visitor without access to the Wagtail admin, and only affects sites with ModelAdmin enabled.
- For page, the vulnerability is in the "Choose a parent page" ModelAdmin view (
ChooseParentView), available when managing pages via ModelAdmin. - For documents, the vulnerability is in the ModelAdmin Inspect view (
InspectView) when displaying document fields.
Patches
Patched versions have been released as Wagtail 4.1.4 (for the LTS 4.1 branch) and Wagtail 4.2.2 (for the current 4.2 branch).
Workarounds
Site owners who are unable to upgrade to the new versions can disable or override the corresponding functionality.
ChooseParentView
For ChooseParentView:
- Disable ModelAdmin for all page models.
- Or provide a custom view via
choose_parent_view_class, with the custom view overriding theget_formmethod.
One of those steps need to be applied for every ModelAdmin class hooked into Wagtail where the model is a Wagtail Page or sub-class. Here is an example of implementing the custom ChooseParentView with patched HTML escaping:
InspectView
For InspectView:
- Remove
inspect_view_enabled=Trueor set it to False to disable the view. - Or use
inspect_view_fieldsorinspect_view_fields_excludeto prevent displaying document fields in the views. - Or provide a custom view via
inspect_view_class, with the custom view overriding theget_document_field_displaymethod.
One of those steps need to be applied for every ModelAdmin class hooked into Wagtail where inspect_view_enabled=True. Here is an example of implementing the custom InspectView with patched HTML escaping:
Ссылки
- https://github.com/wagtail/wagtail/security/advisories/GHSA-5286-f2rf-35c2
- https://nvd.nist.gov/vuln/detail/CVE-2023-28836
- https://github.com/wagtail/wagtail/commit/5be2b1ed55fd7259dfdf2c82e7701dba407b8b62
- https://github.com/wagtail/wagtail/commit/bc84bf9815610cfbf8db3b6050c7ddcbaa4b9713
- https://github.com/wagtail/wagtail/commit/eefc3381d37b476791610e5d30594fae443f33af
- https://github.com/wagtail/wagtail/commit/ff806ab173a504395fdfb3139eb0a29444ab4b91
- https://docs.wagtail.org/en/stable/reference/contrib/modeladmin/chooseparentview.html#customising-chooseparentview
- https://docs.wagtail.org/en/stable/reference/contrib/modeladmin/inspectview.html#enabling-customising-inspectview
- https://github.com/pypa/advisory-database/tree/main/vulns/wagtail/PYSEC-2023-55.yaml
- https://github.com/wagtail/wagtail/releases/tag/v4.1.4
- https://github.com/wagtail/wagtail/releases/tag/v4.2.2
Пакеты
wagtail
>= 1.5, < 4.1.4
4.1.4
wagtail
>= 4.2, < 4.2.2
4.2.2
Связанные уязвимости
Wagtail is an open source content management system built on Django. Starting in version 1.5 and prior to versions 4.1.4 and 4.2.2, a stored cross-site scripting (XSS) vulnerability exists on ModelAdmin views within the Wagtail admin interface. A user with a limited-permission editor account for the Wagtail admin could potentially craft pages and documents that, when viewed by a user with higher privileges, could perform actions with that user's credentials. The vulnerability is not exploitable by an ordinary site visitor without access to the Wagtail admin, and only affects sites with ModelAdmin enabled. For page, the vulnerability is in the "Choose a parent page" ModelAdmin view (`ChooseParentView`), available when managing pages via ModelAdmin. For documents, the vulnerability is in the ModelAdmin Inspect view (`InspectView`) when displaying document fields. Patched versions have been released as Wagtail 4.1.4 and Wagtail 4.2.2. Site owners who are unable to upgrade to the new versi