# 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

- Severity: Medium 4.3 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.13%, higher than 2% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-07-08T16:13:21.999Z
- Modified: 2026-10-25T17:10:00.197Z
- Also known as: GHSA-2hm2-hc3v-44h9, PYSEC-2026-2218
- Weaknesses: CWE-345, CWE-1284
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial
- Assigned by: GitHub_M

## 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.

(As written by CVE List.)

## Affected

- lepture mistune: < 3.3.0
- mistune (PyPI): before 3.3.0
- mistune_project mistune: before 3.3.0

## Every score

- GitHub_M: CVSS:3.1 4.3 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N`
- GitHub: CVSS:3.1 4.3 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N`
- PyPA Advisory Database: CVSS:3.1 4.3 Medium `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> (exploit, evidence, third-party-advisory, web)
- <https://github.com/lepture/mistune/commit/c4093c4742ed0d10d9332fb8edb455869b7b581b> (fix, patch, web)
- <https://github.com/lepture/mistune/releases/tag/v3.3.0> (advisory, release-notes, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2026-59930> (advisory)
- <https://github.com/lepture/mistune> (package)
- <https://github.com/pypa/advisory-database/tree/main/vulns/mistune/PYSEC-2026-2218.yaml> (web)

## Sources

- CVE List: [CVE-2026-59930](https://www.cve.org/CVERecord?id=CVE-2026-59930), CVE Terms of Use, modified 2026-07-09
- GitHub Advisory Database: [GHSA-2hm2-hc3v-44h9](https://github.com/advisories/GHSA-2hm2-hc3v-44h9), CC-BY-4.0, modified 2026-07-20
- NVD: [CVE-2026-59930](https://nvd.nist.gov/vuln/detail/CVE-2026-59930), Public domain, modified 2026-10-25
- PyPA Advisory Database: [PYSEC-2026-2218](https://osv.dev/vulnerability/PYSEC-2026-2218), CC-BY-4.0, modified 2026-07-13

---

Page: https://cve.day/CVE-2026-59930 · Whole record: https://cve.day/CVE-2026-59930.json · Rebuilt by cve.day 2026-11-25T22:59:27.407Z
