Medium

Mistune has XSS via unescaped figclass/figwidth in Figure directive

  • Disclosed: 08.05.2026
  • Updated: 11.10.2026 15:17

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.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Python (PyPI) mistune < 3.2.1 3.2.1

References

CVSS score 6.1/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weakness (CWE)
CWE-79
Platform
Python (PyPI)
Package
mistune
Disclosed
08.05.2026
Updated
11.10.2026 15:17

Sources and licenses

OSV / GitHub Advisory Database - PYSEC-2026-168 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - GHSA-58cw-g322-p94v - CC BY 4.0

Vulnerability history: mistune

All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (20) in the archive
Total entries
20
First → latest
10.2017 09.2026
Without a fix
1
Exploited in attacks
0

Severity breakdown

  • High 7
  • Medium 13

Disclosures per year

  1. 2017: 2
  2. 2018: 0
  3. 2019: 0
  4. 2020: 0
  5. 2021: 0
  6. 2022: 1
  7. 2023: 0
  8. 2024: 0
  9. 2025: 0
  10. 2026: 17
Severity:
  1. Mistune has XSS via unescaped figclass/figwidth in Figure directive this entry
    Medium · 6.1 CVE-2026-44896 < 3.2.1 3.2.1
  2. High · 8.6 CVE-2022-34749 >= 2.0.0a1, < 2.0.3 2.0.3

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.