CVE-2026-59926: Mistune: XSS via unescaped class option in Admonition directive
In src/mistune/directives/admonition.py, the renderadmonition() 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.
Other sources
Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.2.1, renderadmonition() in src/mistune/directives/admonition.py concatenates the Admonition directive :class: option into the HTML class attribute without escaping, allowing attribute injection and cross-site scripting even when HTMLRenderer escape mode is enabled. This issue is fixed in version 3.2.1.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/mistuneto a version that resolves this vulnerability.Fixed in 3.3.0 - Upgrade
Upgrade
mistuneto a version that resolves this vulnerability.Fixed in 3.2.1
Event History
Frequently Asked Questions
What is the severity of CVE-2026-59926?
CVE-2026-59926 has a medium severity rating of 5.3 based on the CVSS scoring system.
How do I fix CVE-2026-59926?
To fix CVE-2026-59926, upgrade to Mistune version 3.2.1 or later where the vulnerability has been addressed.
What type of vulnerability is CVE-2026-59926?
CVE-2026-59926 is an XSS (Cross-Site Scripting) vulnerability due to unescaped class option handling.
What can happen if CVE-2026-59926 is exploited?
Exploitation of CVE-2026-59926 can lead to attribute injection and cross-site scripting attacks, compromising user data.
Which software is affected by CVE-2026-59926?
CVE-2026-59926 affects the Mistune Markdown parser prior to version 3.2.1.