Skip to content

XSS via unescaped figclass/figwidth in Figure directive

Moderate
lepture published GHSA-58cw-g322-p94v May 6, 2026

Package

pip mistune (pip)

Affected versions

<= 3.2.0

Patched versions

None

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.

Severity

Moderate

CVE ID

CVE-2026-44896

Weaknesses

Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. Learn more on MITRE.

Credits