Mistune has XSS via unescaped figclass/figwidth in Figure directive
Description
Published to the GitHub Advisory Database
May 8, 2026
Reviewed
May 8, 2026
Published by the National Vulnerability Database
May 26, 2026
Last updated
Jun 8, 2026
In
src/mistune/directives/image.py, therender_figure()function concatenatesfigclassandfigwidthoptions 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