CVE-2026-44896: Mistune has XSS via unescaped figclass/figwidth in Figure directive
In src/mistune/directives/image.py, the renderfigure() function concatenates figclass and figwidth options directly into HTML attributes without escaping (lines 152-168). This allows attribute injection and XSS even when HTMLRenderer(escape=True) is used, because these values bypass the inline renderer. Other attributes in the same file (src, alt, style) are properly escaped; figclass/figwidth were missed.
Published May 8, 2026 · Updated Jun 8, 2026
Affected packages
mistune
- Ecosystem
- PyPI
- Affected
- <= 3.2.0
- Fixed in
- 3.2.1
- Check
pip show mistune
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
In src/mistune/directives/image.py, the render_figure() function concatenates figclass and figwidth options directly into HTML attributes without escaping (lines 152-168).
This allows attribute injection and XSS even when HTMLRenderer(escape=True) is used, because these values bypass the inline renderer.
Other attributes in the same file (src, alt, style) are properly escaped; figclass/figwidth were missed.
Credited to sergeykochanov.
References
- https://github.com/lepture/mistune/security/advisories/GHSA-58cw-g322-p94v
- https://nvd.nist.gov/vuln/detail/CVE-2026-44896
- https://github.com/lepture/mistune/commit/a3cb6e5655308797e8be021d6c7b5bab13cbace2
- https://github.com/pypa/advisory-database/tree/main/vulns/mistune/PYSEC-2026-168.yaml
- https://github.com/advisories/GHSA-58cw-g322-p94v
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More PyPI vulnerabilities
All PyPI entriesCVE-2026-97698
Mistune: Quadratic-time DoS in parse_link_href via unbounded parenthesis scan on empty-label links
high7.5Nov 19, 2026CVE-2026-97699
Mistune: Quadratic-time DoS in inline image parsing (precedence_scan) bypasses not-is-image guards
high7.5Nov 19, 2026CVE-2026-115355
Mistune: Path Traversal and XSS in Include directive
highOct 23, 2026CVE-2026-76098
Mistune: Denial of Service — RecursionError via Excessive Emphasis Markers in Markdown
high7.5Sep 2, 2026CVE-2026-59922
Mistune plugins/formatting: quadratic-time parsing on long runs of `~~x~~`, `==x==`, and `^^x^^` markers (strikethrough / mark / insert)
high7.5Jul 20, 2026CVE-2026-59923
Mistune: XSS via percent-encoded javascript URI bypass in safe_url()
medium6.1Jul 20, 2026
