Debian · Mistune · CVE-2026-44898
**Name of the Vulnerable Software and Affected Versions**
Mistune versions prior to 3.2.1
**Description**
The `render toc ul()` function builds a table-of-contents tree from a list of tuples. The `id` value, used for the `href` attribute, and the `text` value, used as the link label, are inserted into `<a>` tags using a plain Python format string without HTML escaping. When heading IDs are derived from user-supplied text, an attacker can craft a heading that breaks out of the `href` attribute context to inject arbitrary HTML tags, such as `<script>` blocks, directly into the rendered table of contents. This occurs specifically within the `render toc ul()` function located in `src/mistune/toc.py`.
**Recommendations**
Update to version 3.2.1.
As a temporary workaround, restrict the use of custom `heading id` callbacks that return raw user-supplied text as the ID.