HIGHCVSS 7.5Vulnerability

CVE-2026-111758

### Summary A link reference definition whose label or title is never closed is O(n²) in markdown-it 15.0.2 with default options. Continuation lines are pulled lazily with str += lineContent in src/rules_block/reference.ts, and the subsequent charCodeAt and slice calls flatten the V8 cons-string, copying everything collected so far; this runs before the rule decides the definition is invalid. It is a regression introduced by PR #1004 in 14.0.0: 13.0.2 processed a 313 KB input in 125 ms, while every version since takes about 11 seconds on the same input. At the sizes below, 200 KB takes 3.6 seconds, 400 KB takes 18.1 seconds, and 800 KB takes 74.0 seconds, which is roughly 4–5× per doubling. No options are required to trigger it. ### Details src/rules_block/reference.ts appends continuation lines with str += lineContent at lines 74, 83, 100, 133, and 150, then keeps indexing the accumulated string via str.charCodeAt(pos) in the label and whitespace loops and str.slice(...) in parseLinkTitle. V8 represents += as a cons-string, and the next charCodeAt or slice flattens it, copying everything collected so far, so one definition spanning n lines costs O(n²). Isolation confirms the rule is responsible: block-only parsing with inline disabled is still quadratic, md.disable('reference') makes the same input linear, and the same text without the leading [ is linear. The fix is to track positions in state.src instead of building str, or to collect line slices in an array and parse across them. At minimum, stop scanning the label after 999 characters (CommonMark §6.3) before pulling more lines, and cap title continuation. Add a pathological test with a 100k-line unclosed title and label. Open PR #1215 edits the same file but its label check runs after the label loop, so it does not bound either variant and the fix can land together with that PR. The observed output from PoC was: unclosed title n=100000 200009 B 3585.5 ms unclosed title n=200000 400009 B 18107.1 ms

Properties

Summary
markdown-it: Quadratic-time rendering of a single multi-line link reference definition with default options (regression since 14.0)
Severity
high
Cvss score
7.5
Retrieved at
2026-10-21T01:23:59+00:00
Ghsa published
2026-10-20T20:28:44Z
Source url
https://github.com/advisories/GHSA-gfr2-rv44-r23c
Ghsa updated
2026-10-20T20:28:46Z
Ghsa id
GHSA-gfr2-rv44-r23c
Last source
GitHub Advisory Database
Cve id
CVE-2026-111758
Cvss vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
First seen by Signal
2026-10-20T21:19:40+00:00
Is ghsa only
false

Related Entities (4)

AFFECTS (1)

→[Software]npm/markdown-it

VULNERABLE_TO (1)

←[Software]npm/markdown-it

Explore deeper with Ninja Signal's threat intelligence graph

CVE-2026-111758 (CVSS 7.5) — Ninja Signal Threat Intelligence | Ninja Signal