Mistune has XSS via unescaped figclass/figwidth in Figure directive
GHSA-58cw-g322-p94v · CVE-2026-44896 · PYSEC-2026-168
Published · Modified
AI SAST
Find this class of vulnerability in your own code
Corgea's AI-native static analysis detects vulnerabilities like this one across your repositories, ranks them by exploitability, and returns review-ready fixes.
Description
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.
References
- WEB https://github.com/lepture/mistune/security/advisories/GHSA-58cw-g322-p94v
- ADVISORY https://nvd.nist.gov/vuln/detail/CVE-2026-44896
- WEB https://github.com/lepture/mistune/commit/a3cb6e5655308797e8be021d6c7b5bab13cbace2
- PACKAGE https://github.com/lepture/mistune
- WEB https://github.com/pypa/advisory-database/tree/main/vulns/mistune/PYSEC-2026-168.yaml
Ready to move
Start Securing
Free, no credit card | First findings in minutes