PYPI · JULY 2026 · EARLY WARNING

Mistune Package Vulnerability: Predictable Heading IDs Risk

EARLY WARNING · UNCONFIRMED. This page describes a developing threat that 0Day surfaced from early signals and has not yet independently confirmed. Details may change. Always verify against the primary sources before acting.
GHSA-2HM2-HC3V-44H9Severity: HIGH

An early warning has been issued regarding a vulnerability in the mistune package where the toc plugin and TableOfContents directive generate predictable heading IDs. This could allow attackers to inject HTML with the same IDs, potentially disrupting navigation or redirecting CSS/JavaScript.

What happened

The mistune package, specifically its toc plugin and TableOfContents directive, appears to generate heading IDs based solely on the order of headings in the document. This predictable ID generation method may enable attackers to inject HTML content with matching IDs, leading to potential security risks such as disrupted navigation or CSS/JavaScript redirection.

Versions affected by this issue include those where the heading IDs are generated based solely on the order of headings. The vulnerability has been tracked under GHSA-2HM2-HC3V-44H9 and is under investigation. It is recommended to upgrade to a version of mistune that fixes the predictable ID generation or implement a custom heading ID generation method that includes a slug derived from the heading text.

For detailed version information and further assessment, please consult the primary sources provided. The severity of this issue is currently classified as HIGH, and the exact scope and impact are still being evaluated.

How 0Day mitigates this

MATCHED TO YOUR ACTUAL DEPENDENCY GRAPH0Day matches every incoming threat signal against your GitHub organization’s full dependency graph, including transitive dependencies. If mistune is anywhere in your dependency tree, the engineers who own the affected repositories get a push alert the moment it is flagged — no manual audit to remember to run.

Read how this differs from waiting on a scanner to catch a known advisory, or see the exact, read-only access 0Day needs to do this for an organization.

Join the 0Day waitlist →

← Back to all threats