GitHub Advisoryadvisory · PyPI

GHSA-58cw-g322-p94v Mistune has XSS via unescaped figclass/figwidth in Figure directive

MEDIUM Published 2026-05-08 Modified 2026-06-08 Official page ↗
Aliases
CVE-2026-44896
Ecosystem
PyPI
Packages
mistune
Severity
Moderate
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weaknesses
CWE-79
Reviewed
2026-05-08

Affected packages

• PyPI mistune: < 3.2.1 → fixed in 3.2.1

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.

Related

Alias · CVE (1)

  • CVE-2026-44896 Mistune is a Python Markdown parser with renderers and plugins. vulnerability

Weakness · CWE (1)

  • CWE-79 Improper Neutralization of Input During Web Page Generation weakness

References