Executive brief
Mistune is a Python library used to convert Markdown text into HTML. A security flaw in its math plugin allows malicious users to bypass safety filters and inject harmful scripts into web pages. This could lead to unauthorized actions being performed in a user's browser, such as stealing session cookies or redirecting users to malicious sites.
Technical details
A Cross-Site Scripting (XSS) vulnerability exists in the Mistune math plugin due to improper neutralization of input during HTML generation. The 'render_inline_math' and 'render_block_math' functions in 'src/mistune/plugins/math.py' concatenate raw user-supplied text directly into the HTML output without calling sanitization helpers or checking the renderer's '_escape' flag. This allows an attacker to bypass the 'escape=True' security configuration by wrapping malicious HTML/JavaScript inside math delimiters ($...$ or $...$). The vulnerability is fixed in version 3.2.1 by ensuring math content is properly escaped.
Affected products
- lepture mistune < 3.2.1
Timeline
- 2026-05-03: patched: Version 3.2.1 released with fixes for math escaping.
- 2026-05-06: advisory: GitHub Security Advisory GHSA-8g87-j6q8-g93x published.
- 2026-05-26: disclosed: CVE-2026-44708 published to the NVD.