CVE-2021-32681: Wagtail Cross-Site Scripting Vulnerability
MODERATECVE-2021-32681 is a MODERATE (CVSS 5.4) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Wagtail libraries in the PyPI ecosystem. The issue involves cross-site scripting in wagtail. Remediation is available by upgrading affected packages to version 2.11.8, 2.12.5, 2.13.2.
CVE-2021-32681 at a Glance
Security Impact
CVSS: 5.4
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N).
How to Fix CVE-2021-32681
To remediate this vulnerability, upgrade all affected Wagtail dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install wagtail>=2.11.8
pip install wagtail>=2.12.5
pip install wagtail>=2.13.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show wagtail
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2021-32681, inspect your installed packages using pip:
pip show wagtail
Analyze the terminal output to locate any version of Wagtail in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.11.8), your application is affected.
Note: The pip show wagtail command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Wagtail, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2021-32681 Affected Wagtail Versions
3 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
wagtail
|
PyPI |
< 2.11.8
|
2.11.8
|
|
wagtail
|
PyPI |
≥ 2.12
< 2.12.5
|
2.12.5
|
|
wagtail
|
PyPI |
≥ 2.13
< 2.13.2
|
2.13.2
|
References
Frequently Asked Questions
What is CVE-2021-32681?
Which Wagtail versions are affected?
What version fixes CVE-2021-32681?
Is wagtail affected?
What is the CVSS score of CVE-2021-32681?
What CWE is associated with CVE-2021-32681?
How can I check PyPI dependencies for CVE-2021-32681?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-xfrw-hxr5-ghqf",
"modified" : "2026-06-09T13:02:48Z",
"published" : "2021-06-17T20:10:42Z",
"aliases" : [ "CVE-2021-32681" ],
"summary" : "Cross-site Scripting in wagtail",
"details" : "### Impact\nWhen the `{% include_block %}` template tag is used to output the value of a plain-text StreamField block (`CharBlock`, `TextBlock` or a similar user-defined block derived from `FieldBlock`), and that block does not specify a template for rendering, the tag output is not properly escaped as HTML. This could allow users to insert arbitrary HTML or scripting. This vulnerability is only exploitable by users with the ability to author StreamField content (i.e. users with 'editor' access to the Wagtail admin).\n\n### Patches\nPatched versions have been released as Wagtail 2.11.8 (for the LTS 2.11 branch), Wagtail 2.12.5, and Wagtail 2.13.2 (for the current 2.13 branch).\n\nSite implementors who wish to retain the existing behaviour of allowing editors to insert HTML content in these blocks (and are willing to accept the risk of untrusted editors inserting arbitrary code) may disable the escaping by surrounding the relevant `{% include_block %}` tag in `{% autoescape off %}...{% endautoescape %}`.\n\n### Workarounds\nSite implementors who are unable to upgrade to a current supported version should audit their use of `{% include_block %}` to ensure it is not used to output `CharBlock` / `TextBlock` values with no associated template. Note that this only applies where `{% include_block %}` is used directly on that block (uses of `include_block` on a block _containing_ a CharBlock / TextBlock, such as a StructBlock, are unaffected). In these cases, the tag can be replaced with Django's `{{ ... }}` syntax - e.g. `{% include_block my_title_block %}` becomes `{{ my_title_block }}`.\n\n### Acknowledgements\nMany thanks to Karen Tracey for reporting this issue.\n\n### For more information\nIf you have any questions or comments about this advisory:\n\n* Visit Wagtail's [support channels](https://docs.wagtail.io/en/stable/support.html)\n* Email us at security@wagtail.io (if you wish to send encrypted email, the public key ID is `0x6ba1e1a86e0f8ce8`)",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "wagtail"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.11.8"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "wagtail"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.12"
}, {
"fixed" : "2.12.5"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "wagtail"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.13"
}, {
"fixed" : "2.13.2"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/wagtail/wagtail/security/advisories/GHSA-xfrw-hxr5-ghqf"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-32681"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/wagtail/PYSEC-2021-103.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/wagtail/wagtail"
}, {
"type" : "WEB",
"url" : "https://github.com/wagtail/wagtail/releases/tag/v2.11.8"
}, {
"type" : "WEB",
"url" : "https://github.com/wagtail/wagtail/releases/tag/v2.12.5"
}, {
"type" : "WEB",
"url" : "https://github.com/wagtail/wagtail/releases/tag/v2.13.2"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-06-17T18:56:56Z",
"nvd_published_at" : "2021-06-17T17:15:00Z"
}
}