CVE-2026-44898
Cross-Site Scripting in Mistune Markdown Parser
Publication date: 2026-05-26
Last updated on: 2026-05-26
Assigner: GitHub, Inc.
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| lepture | mistune | to 3.2.1 (inc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-79 | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
This vulnerability exists in Mistune, a Python Markdown parser, specifically in versions prior to 3.2.1. The function render_toc_ul() builds a table-of-contents (TOC) as an unordered list from tuples containing heading level, id, and text. Both the id and text values are inserted into anchor (<a>) tags using plain Python string formatting without any HTML escaping.
When heading IDs are generated from user-supplied heading text, an attacker can craft a heading that breaks out of the href attribute context in the anchor tag. This allows the injection of arbitrary HTML, including malicious <script> tags, directly into the rendered TOC, leading to cross-site scripting (XSS) attacks.
This issue was fixed in Mistune version 3.2.1 by applying proper escaping or sanitization.
How can this vulnerability impact me? :
This vulnerability can lead to cross-site scripting (XSS) attacks if an attacker is able to supply malicious heading text that gets rendered in the table of contents. Exploiting this, an attacker could execute arbitrary JavaScript in the context of users viewing the rendered Markdown content.
The impact includes potential theft of user credentials, session hijacking, defacement of content, or other malicious actions performed via injected scripts.
According to the CVSS score (6.1), the vulnerability is of medium severity with network attack vector, low attack complexity, no privileges required, but requires user interaction.
What immediate steps should I take to mitigate this vulnerability?
To mitigate this vulnerability, upgrade Mistune to version 3.2.1 or later, where the issue with unescaped HTML in render_toc_ul() is fixed.