GitHub Advisoryadvisory · PyPI
GHSA-g97x-gvcm-x72h Mistune: XSS via unescaped class option in Admonition directive
MEDIUM
Official page ↗
- Aliases
- CVE-2026-59926
- Ecosystem
- PyPI
- Packages
- mistune
- Severity
- Moderate
- CVSS vector
- CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N
- Weaknesses
- CWE-79
- Reviewed
- 2026-07-20
Affected packages
• PyPI mistune: < 3.3.0 → fixed in 3.3.0
Description
In `src/mistune/directives/admonition.py`, the `render_admonition()` function concatenates the `:class:` option directly into the HTML class attribute without escaping (lines 63-68).
This allows attribute injection and XSS even when `HTMLRenderer(escape=True)` is used.
The directive name parameter is safe (validated against whitelist), but the class option comes from raw user input.
Related
Alias · CVE (1)
- CVE-2026-59926 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
- https://github.com/lepture/mistune/security/advisories/GHSA-g97x-gvcm-x72h web
- https://nvd.nist.gov/vuln/detail/CVE-2026-59926 advisory
- https://github.com/lepture/mistune/commit/a3cb6e5655308797e8be021d6c7b5bab13cbace2 web
- https://github.com/lepture/mistune package
- https://github.com/lepture/mistune/releases/tag/v3.2.1 web
- https://github.com/pypa/advisory-database/tree/main/vulns/mistune/PYSEC-2026-2214.yaml web