Mistuneで細工されたMarkdownによりサービス停止に陥る脆弱性
Summary
Mistuneの3.3.4より前のバージョンには、空のリンクラベルを使ったMarkdownを処理すると計算量が急増し、処理が長時間止まる脆弱性(CVE-2026-97698)があります。信頼できないMarkdownを描画する環境では、サービス停止につながるおそれがあります。対策として、修正版の3.3.4以降へ更新してください。
AI summary
Produced by SecPulse using an external AI model; it may contain mistakes. Check the original description and references below before acting on it.
Mistuneの3.3.4より前のバージョンには、空のリンクラベルを使ったMarkdownを処理すると計算量が急増し、処理が長時間止まる脆弱性(CVE-2026-97698)があります。信頼できないMarkdownを描画する環境では、サービス停止につながるおそれがあります。対策として、修正版の3.3.4以降へ更新してください。
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| lepturemistune | — | Not listed |
| PyPImistune |
< 3.3.4→ 3.3.4 |
3.3.4 |
| pipmistune |
< 3.3.4→ 3.3.4 |
3.3.4 |
Fix status by distribution
Records published by each distribution for this CVE. Fixed versions differ by release; check each link.
- Debian DEBIAN-CVE-2026-97698 mistune Fix available
- Ubuntu UBUNTU-CVE-2026-97698 mistune No fixed version in this record
Original description The description as published by the source.
Resolution
Fixed in Mistune 3.3.4. Upgrade to 3.3.4 or later.
- Affected versions:
< 3.3.4 - First patched version:
3.3.4 - Fix: https://github.com/lepture/mistune/compare/v3.3.3...v3.3.4
The reported payload was reproduced against the 3.3.3 release tag and verified to scale approximately linearly against the 3.3.4 release tag.
Original report
The following report describes the issue before the fix.
Summary
parse_link_href in mistune performs an unbounded parenthesis-balancing scan that runs to end-of-document on each unmatched (. Because the empty label [] bypasses the no_close_bracket_before high-water-mark guard, a single small document of the form "[](" * N causes O(N) openers to each drive an O(N) scan, producing O(N²) CPU on the default mistune.html() renderer with no plugins.
Root Cause
parse_link matches the empty label [] (parse_link_label("[](",1) returns ('', 2)), so it reaches the ( branch and calls parse_link_href. That function's scan loop (helpers.py:143-159) advances past characters and increments level on each (, never finding an unescaped ) at level==0, so it runs to EOF and returns None. The cursor then advances only ~2 chars to the next [](. The no_close_bracket_before high-water mark that keeps the balanced-bracket link path linear is never entered because the empty label matches before that branch; _mark_no_link_before only advances past the 2-char label, not the href region.
Impa…
Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory
References
- advisory github.com
- package github.com
- web github.com
- web github.com
- web github.com
- web nvd.nist.gov
- web github.com