Inefficient Algorithmic Complexity Affecting mistune package, versions [,3.3.4)


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.54% (47th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-PYTHON-MISTUNE-22606120
  • published19 Nov 2026
  • disclosed17 Nov 2026
  • creditzx (Jace), manus-use

Introduced: 17 Nov 2026

NewCVE-2026-97699  (opens in a new tab)
CWE-407  (opens in a new tab)

How to fix?

Upgrade mistune to version 3.3.4 or higher.

Overview

Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity via precedence_scan in src/mistune/inline_parser.py during inline image parsing. The two linearization guards, no_link_before high-water mark (line 141) and _label_contains_link short-circuit (line 171), are both gated behind not is_image, so they are skipped entirely for ![ openers. Each outer image opener therefore calls sc.search over the full remaining image body, producing O(N²) CPU work for an input of the form "![" * N + "x" + "]" * N. Because the failing scans never produce an image token, max_image_depth is never decremented and provides no protection. An unauthenticated attacker can submit such a payload to any endpoint that renders untrusted Markdown, pinning a worker at 100% CPU utilization.

PoC

import mistune
md = mistune.create_markdown()   # default, no plugins
md("![" * 16000 + "x" + "]" * 16000)

Note: The PoC uses the default mistune.create_markdown() renderer with no plugins and no stated operating system or runtime version.

CVSS Base Scores

version 4.0
version 3.1