CVE-2026-59930 Mistune 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 Published Updated

Predictable heading IDs in Mistune allow attackers to collide anchors, potentially redirecting navigation or bypassing security checks.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2026-59930?

CVE-2026-59930 is a medium-severity vulnerability in lepture mistune, published on 8 Jul 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

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.

Weakness: CWE-345, CWE-1284

Which versions are affected by CVE-2026-59930?

3 open source packages ship an affected version, including mistune. It affects 1 product.

PackageAffectedFixed in
mistune PyPIAll versions3.3.0
mistune PyPIAll versions3.3.0
mistune PyPIAll versions3.3.0

Products include Mistune Project Mistune.

How do I fix CVE-2026-59930?

Upgrade mistune to 3.3.0 or later.

Is CVE-2026-59930 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-59930 exists.

Sources

Also known as AZL-92223, DEBIAN-CVE-2026-59930, ECHO-1288-ebec-bb75, GHSA-2hm2-hc3v-44h9, PYSEC-2026-2218, UBUNTU-CVE-2026-59930.

Is CVE-2026-59930 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free