Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
🐍 PyPI

GHSA-5286-f2rf-35c2

MEDIUM

Wagtail vulnerable to stored Cross-site Scripting attack via ModelAdmin views

Also known asCVE-2023-28836PYSEC-2023-55
Published
Apr 3, 2023
Updated
Nov 19, 2024
Affected
2 pkgs
Patched
2 / 2
Exploits
None indexed

EPSS Exploitation Probability

via FIRST.org ↗
0.8%probability of exploitation in next 30 days
Lower Risk51th percentile-0.32%
0.25%0.70%1.15%1.60%0.8%0.8%Dec 25Apr 26Jun 26

EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.

Blast Radius

2 pkgs affected
🐍wagtail🐍wagtail

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.

Description

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 the get_form method.

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:

from django import forms
from django.utils.translation import gettext as _
from wagtail.contrib.modeladmin.views import ChooseParentView
from wagtail.contrib.modeladmin.forms import ParentChooserForm


class PatchedPageChoiceField(forms.ModelChoiceField):
    """PageChoiceField with plain-text breadcrumbs to patch stored XSS."""
    def label_from_instance(self, obj):
        bits = []
        for ancestor in (
            obj.get_ancestors(inclusive=True).exclude(depth=1).specific(defer=True)
        ):
            bits.append(ancestor.get_admin_display_title())
        return ' | '.join(bits)


class PatchedParentChooserForm(ParentChooserForm):
    """ParentChooserForm with custom parent_page to patch stored XSS."""
    parent_page = PatchedPageChoiceField(
        label=_("Parent page"),
        required=True,
        empty_label=None,
        queryset=Page.objects.none(),
        widget=forms.RadioSelect(),
    )


class PatchedChooseParentView(ChooseParentView):
    """ChooseParentView with custom get_form patch stored XSS."""
    def get_form(self, request):
        parents = self.permission_helper.get_valid_parent_pages(request.user)
        return PatchedParentChooserForm(parents, request.POST or None)

InspectView

For InspectView:

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:

from django.template.defaultfilters import filesizeformat
from django.utils.html import format_html
from wagtail.contrib.modeladmin.views import InspectView


class PatchedInspectView(InspectView):
    """InspectView with override to patch stored XSS vulnerability."""
    def get_document_field_display(self, field_name, field):
        """Render a link to a document"""
        document = getattr(self.instance, field_name)
        if document:
            return format_html(
                '<a href="{}">{} <span class="meta">({}, {})</span></a>',
                document.url,
                document.title,
                document.file_extension.upper(),
                filesizeformat(document.file.size),
            )
        return self.model_admin.get_empty_value_display(field_name)

Affected Packages

2 total 2 fixed
EcosystemPackageVulnerable rangeFix
🐍PyPIwagtail1.5&&< 4.1.44.1.4
🐍PyPIwagtail4.2&&< 4.2.24.2.2

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for wagtail. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.

  2. Fix

    Update wagtail to 4.1.4 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-5286-f2rf-35c2 is resolved across your whole dependency graph.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

  4. How O3 protects you

    O3 pinpoints whether GHSA-5286-f2rf-35c2 is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.

Tailored to GHSA-5286-f2rf-35c2. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

### 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`](https
O3 Security · Impact-Aware SCA

Is GHSA-5286-f2rf-35c2 in your dependencies?

O3 detects GHSA-5286-f2rf-35c2 across PyPI dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.