Vulnerabilities in pkg:pypi/mistune
PACKAGECVE-2026-76098 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-674: Uncontrolled Recursion) affecting Mistune libraries in the PyPI ecosystem. The issue involves denial of service — recursionerror via excessive emphasis markers in markdown. Remediation is available by upgrading affected packages to version 3.3.3.
pkg:pypi/mistune
Vulnerability advisories affecting package pkg:pypi/mistune. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-6m44-fpc8-c3rq | CVE-2026-76098 | HIGH | Mistune: Denial of Service — RecursionError via Excessive Emphasis Markers in Markdown |
| GHSA-qfrw-5rxm-mhh2 | CVE-2026-59929 | MODERATE | Mistune renderers/html.safe_url: HARMFUL_PROTOCOLS list misses legacy and chained schemes that historically chain to `javascript:` execution |
| GHSA-2hm2-hc3v-44h9 | CVE-2026-59930 | MODERATE | Mistune toc / TableOfContents directive: heading IDs use predictable `toc_N` numbering with no slugification, allowing collision with attacker-controlled `id="toc_N"` content |
| GHSA-r4rv-85jg-w4mf | CVE-2026-59924 | MODERATE | Mistune: Arbitrary File Read via Include directive path traversal |
| GHSA-c8j7-8cv4-2xmq | CVE-2026-59922 | HIGH | Mistune plugins/formatting: quadratic-time parsing on long runs of `~~x~~`, `==x==`, and `^^x^^` markers (strikethrough / mark / insert) |
| GHSA-g97x-gvcm-x72h | CVE-2026-59926 | MODERATE | Mistune: XSS via unescaped class option in Admonition directive |
| GHSA-8c25-4j27-2rv3 | CVE-2026-59923 | MODERATE | Mistune: XSS via percent-encoded javascript URI bypass in safe_url() |
| GHSA-4j32-57v6-6g45 | CVE-2026-59925 | HIGH | Mistune inline_parser: quadratic-time parsing on long runs of `**x**` and `***x***` emphasis pairs |
| GHSA-8mpj-m6qm-5qr8 | CVE-2026-59927 | MODERATE | Mistune directives/include: mutual `.. include::` recursion crashes the renderer with `RecursionError`, denial of service via two attacker-controlled markdown files |
| GHSA-ffq3-xpv3-j92q | CVE-2026-59928 | HIGH | Mistune block_parser: quadratic-time parsing on long lists of repeated reference-link definitions |
| GHSA-qcq2-496w-v96p | CVE-2026-49851 | HIGH | Mistune: Potential DoS via quadratic-time parsing in parse_link_text |
| GHSA-58cw-g322-p94v | CVE-2026-44896 | MODERATE | Mistune has XSS via unescaped figclass/figwidth in Figure directive |
| GHSA-ccfx-mfmx-2fx9 | CVE-2026-44899 | MODERATE | Mistune Image Directive CSS Injection Vulnerability |
| GHSA-6269-cqxg-mhhv | CVE-2026-44898 | MODERATE | Mistune TOC Anchor Injection XSS |
| GHSA-v87v-83h2-53w7 | CVE-2026-44897 | MODERATE | Mistune Heading ID Attribute has Injection XSS |
| GHSA-8g87-j6q8-g93x | CVE-2026-44708 | MODERATE | Mistune Math Plugin has an XSS Escape Bypass |
| GHSA-hjph-f4mc-wx4c | - | HIGH | Duplicate Advisory: Mistune has a ReDoS in LINK_TITLE_RE that allows denial of service via crafted Markdown input |
| GHSA-8mp2-v27r-99xp | CVE-2026-33079 | HIGH | Mistune has a ReDoS in LINK_TITLE_RE that allows denial of service via crafted Markdown input |
| GHSA-fw3v-x4f2-v673 | CVE-2022-34749 | HIGH | Mistune vulnerable to catastrophic backtracking |
| GHSA-98gj-wwxm-cj3h | CVE-2017-16876 | MODERATE | mistune Cross-site scripting (XSS) vulnerability |
| GHSA-hpv5-v8g5-c864 | CVE-2017-15612 | MODERATE | Cross-site Scripting in Mistune |
CVE-2026-76098 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2026-76098
To remediate this vulnerability, upgrade all affected Mistune dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install mistune>=3.3.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show mistune
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2026-76098, inspect your installed packages using pip:
pip show mistune
Analyze the terminal output to locate any version of Mistune in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.3.3), your application is affected.
Note: The pip show mistune command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-674: Uncontrolled Recursion, where the product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack. In Mistune, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-76098 Affected Mistune Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
mistune
|
PyPI |
≥ 3.3.0
< 3.3.3
|
3.3.3
|
References
Frequently Asked Questions
What is CVE-2026-76098?
Which Mistune versions are affected?
What version fixes CVE-2026-76098?
Is mistune affected?
What is the CVSS score of CVE-2026-76098?
What CWE is associated with CVE-2026-76098?
How can I check PyPI dependencies for CVE-2026-76098?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-6m44-fpc8-c3rq",
"modified" : "2026-09-02T15:14:55Z",
"published" : "2026-09-02T15:14:55Z",
"aliases" : [ "CVE-2026-76098" ],
"summary" : "Mistune: Denial of Service — RecursionError via Excessive Emphasis Markers in Markdown",
"details" : "## Summary\nMistune v3.3.2 is vulnerable to a Denial of Service (DoS) attack via uncontrolled recursion in the HTML rendering of deeply-nested emphasis tokens. By submitting Markdown containing approximately 1,000 consecutive asterisk characters, an attacker causes the Python process to crash with RecursionError.\n\n## Details\nThe InlineParser's _process_emphasis_delimiters() creates deeply nested <strong> tokens from consecutive emphasis markers (every 2 asterisks add one nesting level). With 1,000 consecutive asterisks, approximately 500 levels of nesting are produced. The HTMLRenderer.render_token() method (src/mistune/renderers/html.py:40-57) renders these tokens recursively: when a token has children, line 48 calls self.render_tokens(token['children'], state), entering child rendering. Each nesting level produces ~2 stack frames, so 500 levels ≈ 1,000 frames, exceeding Python's default recursion limit (sys.getrecursionlimit() = 1000). The emphasis() and strong() methods (lines 80-84) wrap recursively rendered child content in <em> and <strong> tags, perpetuating the recursion. This vulnerability affects all mistune APIs including markdown() and html().\n\nCore vulnerable code path:\n\n```python\n# src/mistune/renderers/html.py:40-57\ndef render_token(self, token: Dict[str, Any], state: BlockState) -> str:\n func = self._get_method(token[\"type\"])\n attrs = token.get(\"attrs\")\n if \"raw\" in token:\n text = token[\"raw\"]\n elif \"children\" in token:\n text = self.render_tokens(token[\"children\"], state)\n else:\n if attrs:\n return func(**attrs)\n else:\n return func()\n if attrs:\n return func(text, **attrs)\n else:\n return func(text)\n```\n\nThe recursive call to render_tokens() on line 48 processes nested child tokens. With 500 levels of nested emphasis/strong tokens, this recursion exceeds Python's default recursion limit of 1000, causing a RecursionError.\n\n```python\n# src/mistune/renderers/html.py:80-84\ndef emphasis(self, text: str) -> str:\n return \"<em>\" + text + \"</em>\"\n\ndef strong(self, text: str) -> str:\n return \"<strong>\" + text + \"</strong>\"\n```\n\nThe emphasis() and strong() methods wrap their text content (which is itself the recursively-rendered output of nested child tokens) in HTML tags, creating the chain of recursion: each call to strong() includes rendered children that themselves call strong(), etc.\n\n## POC\n\n``` wiki\nfrom mistune import html\n\npayload = '*' * 1000\ntry:\n result = html(payload)\n print('No crash - recursion handled')\nexcept RecursionError as e:\n print(f'[VULN] RecursionError: {e} - Process would crash!')\nexcept Exception as e:\n print(f'Error: {type(e).__name__}: {e}')\n```\n\n<img width=\"1139\" height=\"664\" alt=\"1\" src=\"https://github.com/user-attachments/assets/d2095b9f-0a6a-4bef-8013-cbc6946cf8f1\" />\n\n\n\n## Impact\nCVSS 3.1: 7.5 (High) — AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H. An attacker can crash any server process using mistune with approximately 2KB of Markdown input. In web applications, this can be triggered through user-generated content such as forum posts or comments, causing denial of service for all concurrent users sharing the same Python process. Both mistune.markdown() and mistune.html() are affected.\n\n## Remediation\n1. Add a maximum nesting depth limit in the emphasis parsing stage, similar to BlockParser's max_nested_level mechanism (currently at DEFAULT_MAX_NESTED_LEVEL = 20). When the limit is exceeded, treat excess emphasis markers as literal text. 2. Alternatively, refactor HTMLRenderer to use an explicit stack-based iterative approach instead of recursive calls for rendering nested tokens. 3. As a defense-in-depth measure, document the recursion risk and recommend that applications deploying mistune set a higher recursion limit or implement request-level timeouts.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "mistune"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.3.0"
}, {
"fixed" : "3.3.3"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/lepture/mistune/security/advisories/GHSA-6m44-fpc8-c3rq"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-76098"
}, {
"type" : "WEB",
"url" : "https://github.com/lepture/mistune/commit/0938fb781d0aded99de801b340ec1f8debeae5b2"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/lepture/mistune"
}, {
"type" : "WEB",
"url" : "https://github.com/lepture/mistune/releases/tag/v3.3.3"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-674" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-09-02T15:14:55Z",
"nvd_published_at" : "2026-08-24T20:17:19Z"
}
}