Mistune: XSS via unescaped class option in Admonition directive
In src/mistune/directives/admonition.py, the render_admonition() function concatenates the :class: option directly into the HTML class attribute without escaping (lines 63-68).
This allows attribute injection and XSS even when HTMLRenderer(escape=True) is used.
The directive name parameter is safe (validated against whitelist), but the class option comes from raw user input.
Affected software
Click a technology to see all vulnerabilities affecting it.
| Platform | Package | Vulnerable versions | Fixed in |
|---|---|---|---|
| Python (PyPI) | mistune | < 3.3.0 | 3.3.0 |
References
- https://github.com/lepture/mistune/releases/tag/v3.2.1
- https://github.com/lepture/mistune/security/advisories/GHSA-g97x-gvcm-x72h
- https://github.com/lepture/mistune/commit/a3cb6e5655308797e8be021d6c7b5bab13cbace2
- https://nvd.nist.gov/vuln/detail/CVE-2026-59926
- https://github.com/lepture/mistune
- https://github.com/pypa/advisory-database/tree/main/vulns/mistune/PYSEC-2026-2214.yaml
- CVSS vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N- Weakness (CWE)
CWE-79- Platform
- Python (PyPI)
- Package
mistune- Disclosed
- 08.07.2026
- Updated
- 11.10.2026 14:18
Sources and licenses
OSV / GitHub Advisory Database - PYSEC-2026-2214 - PyPA Advisory Database; CC BY 4.0
OSV / GitHub Advisory Database - GHSA-g97x-gvcm-x72h - CC BY 4.0
Vulnerability history: mistune
All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.
- Total entries
- 20
- First → latest
- 10.2017 09.2026
- Without a fix
- 1
- Exploited in attacks
- 0
Severity breakdown
- High 7
- Medium 13
Disclosures per year
- 2017: 2
- 2018: 0
- 2019: 0
- 2020: 0
- 2021: 0
- 2022: 1
- 2023: 0
- 2024: 0
- 2025: 0
- 2026: 17
-
Mistune: XSS via unescaped class option in Admonition directive this entry
Know which vulnerabilities affect your application
With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.