Vulnerability · Published Jul 8, 2026 · Assigned by GitHub_M
CVE-2026-59930Mistune toc / TableOfContents directive: heading IDs use predictable `toc_N` numbering with no slugification, allowing collision with attacker-controlled `id="toc_N"` content
Medium 4.3
In plain English
A medium-severity insufficient verification of data authenticity in mistune from lepture. Proof-of-concept exploit code is public. The chance it is exploited in the next 30 days is estimated at 0.2% (higher than 9% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official description
Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.3.0, the toc plugin and TableOfContents directive generate heading IDs as predictable toc_N values without slugifying the heading text, allowing attacker-controlled id="toc_N" content to collide with generated anchors and redirect same-page navigation, CSS selectors, or JavaScript handlers. This issue is fixed in version 3.3.0.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:12 | mistune | no fix listed | DEBIAN-CVE-2026-59930 |
| Debian:13 | mistune | no fix listed | DEBIAN-CVE-2026-59930 |
| Debian:14 | mistune | no fix listed | DEBIAN-CVE-2026-59930 |
| PyPI | mistune | 3.3.0 | GHSA-2hm2-hc3v-44h9 |
| PyPI | mistune | 3.3.0 | PYSEC-2026-2218 |
| Ubuntu:22.04:LTS | mistune | no fix listed | UBUNTU-CVE-2026-59930 |
| Ubuntu:24.04:LTS | mistune | no fix listed | UBUNTU-CVE-2026-59930 |
| Ubuntu:25.10 | mistune | no fix listed | UBUNTU-CVE-2026-59930 |
| Ubuntu:26.04:LTS | mistune | no fix listed | UBUNTU-CVE-2026-59930 |
| Ubuntu:26.10 | mistune | no fix listed | UBUNTU-CVE-2026-59930 |
Affected products (as reported)
Weakness: CWE-345, CWE-1284 · Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N
References
- https://github.com/lepture/mistune/security/advisories/GHSA-2hm2-hc3v-44h9 x_refsource_CONFIRM
- https://github.com/lepture/mistune/commit/c4093c4742ed0d10d9332fb8edb455869b7b581b x_refsource_MISC
- https://github.com/lepture/mistune/releases/tag/v3.3.0 x_refsource_MISC