Mistune has XSS via unescaped figclass/figwidth in Figure directive
Date: 2026-05
Affected: pip/mistune
Attack vector: xss
Category: vulnerability-disclosure
Severity: Medium
CVE: CVE-2026-44896
CWE: CWE-79
CVSS: 6.1 (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N)

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.


Mitigations:

Architectural layers (MAESTRO):