lepture/mistune · Security
Mistune has XSS via unescaped figclass/figwidth in Figure directive
- GHSA ID
- GHSA-58cw-g322-p94v
- CVE ID
- CVE-2026-44896
- Severity
- medium
- Published
- Updated
- CVSS
- 6.1 · CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
- CVSS v3
- 6.1 · CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
- CVSS v4
- 5.3 · CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
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.
CWEs
- CWE-79 · Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
References
- https://github.com/lepture/mistune/security/advisories/GHSA-58cw-g322-p94v ↗
- https://nvd.nist.gov/vuln/detail/CVE-2026-44896 ↗
- https://github.com/lepture/mistune/commit/a3cb6e5655308797e8be021d6c7b5bab13cbace2 ↗
- https://github.com/pypa/advisory-database/tree/main/vulns/mistune/PYSEC-2026-168.yaml ↗
- https://github.com/advisories/GHSA-58cw-g322-p94v ↗