CVE-2026-111758: markdown-it Quadratic-time Rendering Of A Single Vulnerability

HIGH
Advisory Identifier: GHSA-gfr2-rv44-r23c
CVSS 7.5
CWE-400 CWE-407
Published
Advisory Summary

CVE-2026-111758 is a HIGH (CVSS 7.5) quadratic-time rendering of a single vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting markdown-it libraries in the npm ecosystem. The issue involves quadratic-time rendering of a single multi-line link reference definition with default options (regression since 14.0). Remediation is available by upgrading affected packages to version 14.3.3, 15.0.3.

CVE-2026-111758 at a Glance

CVE Identifier CVE-2026-111758
GHSA Identifier GHSA-gfr2-rv44-r23c
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product markdown-it
Package Ecosystem npm
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2026-111758

To remediate this vulnerability, upgrade all affected markdown-it dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

markdown-it fixed: 14.3.3
npm install markdown-it@14.3.3
markdown-it fixed: 15.0.3
npm install markdown-it@15.0.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls markdown-it

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-111758, inspect your project dependencies using npm:

npm ls markdown-it

Analyze the terminal output to locate any version of markdown-it in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 14.3.3), your application is affected.

Note: The npm ls markdown-it command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In markdown-it, 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

### 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 (5.05x) unclosed title n=400000 800009 B 73954.4 ms (4.08x) Regression comparison at 313 KB: 13.0.2 → 125 ms, 14.1.0 → 11.4 s, 15.0.0 → 10.6 s, 15.0.2 → 10.7 s. ### Proof of concept How to execute the PoC: 1. mkdir -p markdown-it-poc && cd markdown-it-poc 2. npm init -y 3. npm i markdown-it@15.0.2 4. node poc_markdown_it.js PoC below is: ```javascript // poc_markdown_it.js // Requires: npm install markdown-it@15.0.2 const MarkdownIt = require('markdown-it'); const md = new MarkdownIt(); function bench(label, src) { const t0 = process.hrtime.bigint(); md.render(src); const t1 = process.hrtime.bigint(); console.log( `${label.padEnd(30)} ${String(src.length).padStart(9)} B ${(Number(t1 - t0) / 1e6).toFixed(1).padStart(9)} ms` ); } // Unclosed title: one reference definition spread over many lines for (const n of [100000, 200000, 400000]) { bench(`unclosed title n=${n}`, '[a]: /u "' + 'x\n'.repeat(n)); } // Unclosed label for (const n of [5000, 10000, 20000]) { bench(`unclosed label n=${n}`, '[' + 'a\n'.repeat(n)); } ``` ### Impact This is an algorithmic-complexity denial of service (CWE-407). Any server that renders user Markdown with markdown-it is affected with default options, including comments, issues, chat, wikis, docs previews, and LLM chat UIs. A ~400 KB request body blocks the Node.js event loop for about 18 seconds and an ~800 KB body for about 74 seconds. This is the same class and attacker model as GHSA-253c, but it is reachable without any opt-in option, since the affected path is a core block rule.

CVE-2026-111758 Affected markdown-it Versions

2 component(s)
Fixed Versions:
14.3.315.0.3
Product / Package Ecosystem Affected Versions Fixed Version
markdown-it
npm
≥ 14.1.0
< 14.3.3
14.3.3
markdown-it
npm
≥ 15.0.0
< 15.0.3
15.0.3

References

Frequently Asked Questions

What is CVE-2026-111758?
CVE-2026-111758 is a security vulnerability in markdown-it involving Quadratic-time rendering of a single multi-line link reference definition with default options (regression since 14.0) under CWE-400: Uncontrolled Resource Consumption.
Which markdown-it versions are affected?
Affected versions include releases prior to 14.3.3, 15.0.3 across affected packages: markdown-it.
What version fixes CVE-2026-111758?
Upgrading to 14.3.3, 15.0.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is markdown-it affected?
Yes, markdown-it is affected in releases prior to 14.3.3, 15.0.3. Upgrade your dependency to 14.3.3, 15.0.3 or later.
What is the CVSS score of CVE-2026-111758?
CVE-2026-111758 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-111758?
CVE-2026-111758 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check npm dependencies for CVE-2026-111758?
Run the dependency tree command: 'npm ls markdown-it'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-gfr2-rv44-r23c",
  "modified" : "2026-10-20T20:28:44Z",
  "published" : "2026-10-20T20:28:44Z",
  "aliases" : [ "CVE-2026-111758" ],
  "summary" : "markdown-it: Quadratic-time rendering of a single multi-line link reference definition with default options (regression since 14.0)",
  "details" : "### Summary\n\nA 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.\n\n### Details\n\nsrc/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.\n\nThe observed output from PoC was:\nunclosed title n=100000   200009 B    3585.5 ms\nunclosed title n=200000   400009 B   18107.1 ms   (5.05x)\nunclosed title n=400000   800009 B   73954.4 ms   (4.08x)\n\nRegression comparison at 313 KB: 13.0.2 → 125 ms, 14.1.0 → 11.4 s, 15.0.0 → 10.6 s, 15.0.2 → 10.7 s.\n\n### Proof of concept\n\nHow to execute the PoC:\n1. mkdir -p markdown-it-poc && cd markdown-it-poc\n2. npm init -y\n3. npm i markdown-it@15.0.2\n4. node poc_markdown_it.js\n\nPoC below is:\n```javascript\n// poc_markdown_it.js\n// Requires: npm install markdown-it@15.0.2\nconst MarkdownIt = require('markdown-it');\nconst md = new MarkdownIt();\n\nfunction bench(label, src) {\n  const t0 = process.hrtime.bigint();\n  md.render(src);\n  const t1 = process.hrtime.bigint();\n  console.log(\n    `${label.padEnd(30)} ${String(src.length).padStart(9)} B ${(Number(t1 - t0) / 1e6).toFixed(1).padStart(9)} ms`\n  );\n}\n\n// Unclosed title: one reference definition spread over many lines\nfor (const n of [100000, 200000, 400000]) {\n  bench(`unclosed title n=${n}`, '[a]: /u \"' + 'x\\n'.repeat(n));\n}\n\n// Unclosed label\nfor (const n of [5000, 10000, 20000]) {\n  bench(`unclosed label n=${n}`, '[' + 'a\\n'.repeat(n));\n}\n```\n\n### Impact\n\nThis is an algorithmic-complexity denial of service (CWE-407). Any server that renders user Markdown with markdown-it is affected with default options, including comments, issues, chat, wikis, docs previews, and LLM chat UIs. A ~400 KB request body blocks the Node.js event loop for about 18 seconds and an ~800 KB body for about 74 seconds. This is the same class and attacker model as GHSA-253c, but it is reachable without any opt-in option, since the affected path is a core block rule.",
  "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" : "npm",
      "name" : "markdown-it"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "14.1.0"
      }, {
        "fixed" : "14.3.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "markdown-it"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "15.0.0"
      }, {
        "fixed" : "15.0.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/markdown-it/markdown-it/security/advisories/GHSA-gfr2-rv44-r23c"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/markdown-it/markdown-it/commit/48fbc465812c440020c663f040ab22deaf8f1eca"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/markdown-it/markdown-it/commit/d99f48839d37af6fd8a2617516c43dab90755503"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/markdown-it/markdown-it"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/markdown-it/markdown-it/releases/tag/14.3.3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/markdown-it/markdown-it/releases/tag/15.0.3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400", "CWE-407" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-10-20T20:28:44Z",
    "nvd_published_at" : null
  }
}