Junglewise Threat Intelligence

CVE-2026-44896: lepture Mistune XSS in Figure directive image attributes

CVE-2026-44896 · Severity: medium · CVSS 6.1 · Published 2026-05-26

Technologies: mistune (PyPI). Vendors: PyPI.

Executive brief

Mistune is a popular Python library used to convert Markdown text into HTML. A security flaw in how it handles image figures allows an attacker to inject malicious scripts into web pages. If a user views a page containing specially crafted Markdown, the attacker could potentially steal session information or perform actions on the user's behalf.

Technical details

A cross-site scripting (XSS) vulnerability exists in Mistune's `render_figure()` function within `src/mistune/directives/image.py`. The function fails to escape the `figclass` and `figwidth` options before concatenating them into HTML attributes, leading to attribute injection. This bypasses the standard `HTMLRenderer(escape=True)` setting because these specific directive values are handled outside the primary inline renderer. An attacker can exploit this by providing a malicious Markdown figure directive that includes JavaScript or other malicious HTML attributes. The issue is fixed in version 3.2.1.

Affected products

  • lepture mistune <= 3.2.0

Timeline

  • 2026-05-06: disclosed
  • 2026-05-08: advisory: GitHub Advisory published
  • 2026-05-26: advisory: NVD published

References

Related threats