🛡️ CVE-2026-49851 — mistune

🟠 CVSS 8.0 — High ✅ No Known Exploit CWE-1333 NVD
8.0
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

Mistune: Potential DoS via quadratic-time parsing in parse_link_text

Summary

Mistune is vulnerable to a CPU exhaustion DoS due to superlinear (approximately O(n²)) behavior in parse_link_text. A relatively small input consisting of repeated [ characters causes significant parsing slowdown.

Affected component

mistune/inline_parser.py → parse_link_text

Description

When parsing Markdown containing many consecutive [ characters, parse_link_text repeatedly scans the input using a regex search inside a loop. Each iteration re-scans a large portion of the remaining string, resulting in quadratic-time behavior.

An attacker-controlled Markdown input can therefore trigger excessive CPU usage with a very small payload.

Root cause

The vulnerability stems from a two-loop interaction:

  • The outer loop in InlineParser.parse() (inline_parser.py) advances

only 1 character at a time when parse_link() returns None

  • Each failed attempt calls parse_link_text() which performs an O(n)

scan to the end of the string looking for a closing ]

  • With n consecutive [ characters, this results in O(n) × O(n) = O(n²)

total work

PoC

Run below python script

```

import mistune

import time

md = mistune.create_markdown()

s = "[" * 6400

t = time.perf_counter()

md(s)

print(time.perf_counter() - t)

```

<img width="2028" height="1277" alt="image" src="https://github.com/user-attachments/assets/15d5bc0b-35f8-4a15-85e0-cbc314a45b06" />

Benmark poc

Run below code for benchmark

```

import mistune

import time

md = mistune.create_markdown()

sizes = [100,200,400,800,1600,3200,6400]

for n in sizes:

s = "[" * n

t0 = time.perf_counter()

md(s)

dt = time.perf_counter() - t0

print(f"{n:6d} {dt:.6f}")

```

<img width="2503" height="1341" alt="image" src="https://github.com/user-attachments/assets/f09a7bbb-6927-4ba2-afb1-444dd913b84e" />

Observed behaviour

```

python3 benchmark.py

100 0.001609

200 0.003207

400 0.012906

800 0.050220

1600 0.197307

3200 0.801172

6400 3.190393

```

Execution time grows superlinearly, consistent with O(n²) complex

Impact

This can be used as a denial-of-service attack in any application that parses user-supplied Markdown using Mistune, including:

  • Web applications (comments, posts, content rendering)
  • API services processing Markdown
  • Documentation rendering systems
  • A small (~6 KB) payload can block CPU for multiple seconds.

Suggested fix

Return the furthest scanned position from parse_link_text even on failure, so the outer loop can skip ahead instead of advancing 1 character at a time

Security Classification

CWE-400: Uncontrolled Resource Consumption

Denial of Service (CPU exhaustion)

How this vulnerability can be exploited

This issue can be reached over the network, attack complexity is low, an attacker needs no privileges on the target. No user interaction is required. The scope is unchanged, so the impact stays within the vulnerable component. Rated impact: confidentiality none, integrity none, availability high.

Weakness class

CVE-2026-49851 is classified as CWE-1333: Inefficient Regular Expression Complexity. A regular expression backtracks catastrophically on crafted input, consuming CPU out of proportion to input size.

Affected software

CVE-2026-49851 is recorded against 2 packages.

  • mistune (fixed in 3.3.0)
  • unknown

Timeline and source

Published on 9 July 2026 and last revised on 23 July 2026. No public exploit is currently recorded for this entry. Record sourced from NVD.

References

github.com (Web)
nvd.nist.gov (Advisory)
access.redhat.com (Web)
bugzilla.redhat.com (Web)
github.com (Package)
security.access.redhat.com (Web)

Details

Severity HIGH
CVSS Score 8.0
CVSS Vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
CWE CWE-1333
Public Exploit ✅ No
Source NVD
Published 2026-07-09
Updated 2026-08-12
Modified 2026-07-23
Fix URL N/A

Affected Packages

Software From version Fixed in
mistune 3.3.0
unknown

Similar Threats

Site Security Check

Is mistune part of your stack?

CVE-2026-49851 is rated CVSS 8.0 High. BotEraser scans your installation against known CVE records and tells you whether this vulnerability applies to the versions you actually run.

Scan My Site Free →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.

Browse related advisories

All advisoriesCVECVE 2026