Live › vulnerability › CVE-2026-111766
Go to dashboardmarkdown-it takes quadratic time to parse many unterminated HTML constructs (comments, processing instructions, declarations, CDATA) inside a paragraph when html is enabled. An attacker who can submit Markdown gets a few hundred kilobytes of input that blocks the Node.js event loop for seconds or tens of seconds.
Summary written from the sources below. Check the originals before acting.
First seen by InfraStack 2026-10-23 19:11 UTC, 3h before NVD. All times on this page are UTC.
| Product | Ecosystem | Affected | Fixed in |
|---|---|---|---|
| markdown-it | npm | < 14.3.3 | 14.3.3 |
| markdown-it | npm | >= 15.0.0, < 15.0.3 | 15.0.3 |
Run npm ls markdown-it and check whether the version is below 14.3.3 or in the range >=15.0.0 <15.0.3.
Check whether the code calls new MarkdownIt({ html: true }) or uses the commonmark preset.
If both apply, the app is exposed to attacker-supplied Markdown.
14.3.3 on the 14.x line or 15.0.3 on the 15.x lineEach row is the first time that source carried this signal. The analyst’s rows are its own findings.
With html: true, markdown-it takes quadratic time to parse repeated unterminated HTML constructs inside a paragraph. This affects HTML comments (<!--), processing instructions (<?), declarations (<!A), and CDATA sections (<![CDATA[).
An attacker-controlled input of a few hundred kilobytes can block the Node.js event loop for seconds or tens of seconds. The default configuration has HTML disabled, but the commonmark preset enables it.
The issue was reported against the published [email protected] package on Node.js 20 and reproduced on the current source with Node.js 24.16.0.
src/rules_inline/text.ts treats < as a terminator, causing the inline parser to attempt the HTML rule at successive HTML construct openers.
With HTML enabled, src/rules_inline/html_inline.ts applies an anchored regular expression to the remaining input:
const match = state.src.slice(pos).match(HTML_TAG_RE)
The comment, processing instruction, declaration, and CDATA alternatives in src/common/html_re.ts scan the remaining input for their respective terminators: -->, ?>, >, and ]]>.
When the terminator is absent, matching fails. Parsing eventually reaches the next opener and scans an overlapping suffix again. Repeating this across the paragraph produces quadratic total work. For these inputs, the problem is repeated scanning across separate matches.
The payload must reach inline parsing. Prefixing it with x keeps it inside a paragraph. Starting a line directly with one of these constructs instead invokes HTML block parsing, which does not exhibit the same repeated inline scans for these payloads.
The existing unclosed <!-- test in test/markdown-it/pathological.test.mjs already contains a reproducer:
'</' + '<!--'.repeat(100000)
However, it runs with default options, where HTML is disabled.
A fix should avoid repeated searches for absent terminators across all four affected alternatives, for example by caching failed searches on the inline state. Fixing only the comment alternative leaves the other three cases affected. Regression coverage should exercise all four with html: true.
The original report was submitted by @JarLob. It credits the GitHub Security Lab Taskflow Agent as part of the GitHub Secure Open Source Fund.
Install the affected package in an empty directory:
npm install [email protected]
Save the following as poc.mjs and run node poc.mjs:
import MarkdownIt from 'markdown-it'
import { performance } from 'node:perf_hooks'
const mdHtml = new MarkdownIt({ html: true })
const mdDefault = new MarkdownIt()
const sizes = [8000, 16000, 32000, 64000]
function measure(md, src) {
const start = performance.now()
md.render(src)
return (performance.now() - start).toFixed(1)
}
const variants = {
comment: '<!--',
processing: '<?x',
declaration: '<!A',
cdata: '<![CDATA['
}
for (const [name, opener] of Object.entries(variants)) {
console.log(`\n${name}`)
for (const n sizes) {
src = + opener.(n)
.({
n,
: .(src),
: (mdHtml, src)
})
}
}
n = sizes.(-)
controls = {
: [mdDefault, + .(n)],
: [mdHtml, + .(n)],
: [mdHtml, .(n)],
: [mdHtml, + .(n)]
}
( [name, [md, src]] .(controls)) {
.({ : name, : (md, src) })
}
repoPayload = + .()
.({
: ,
: (mdDefault, repoPayload),
: (mdHtml, repoPayload)
})
Measurements from the original report on [email protected], Node.js 20:
| Construct | 8,000 repetitions | 64,000 repetitions |
|---|---|---|
| Comment | 170 ms | 8,799 ms |
| Processing instruction | 26 ms | 1,566 ms |
| Declaration | 93 ms | 5,628 ms |
| CDATA | 119 ms | 4,179 ms |
An eightfold increase in repetitions produces approximately 35–60 times the execution time, consistent with quadratic growth becoming dominant.
For the comment payload at 64,000 repetitions:
The existing pathological-test payload with 100,000 comment openers took 33 ms with HTML disabled and 21,030 ms with HTML enabled. A separate comment payload with 128,000 repetitions, approximately 500 KiB, took 32,847 ms.
Exact timings depend on the runtime and hardware.
This is an availability issue affecting applications that render attacker-controlled Markdown with html: true, including applications using the commonmark preset.
On Node.js, a synchronous render() call can occupy a CPU core and block the event loop for seconds or tens of seconds, delaying other requests handled by the same process. Repeated submissions can cause denial of service. Browser applications can similarly become unresponsive when rendering on the main thread.
Sanitizing the generated HTML afterwards does not prevent the issue because the expensive processing occurs during Markdown rendering.
The default configuration, with HTML disabled, is unaffected by these payloads. Disabling HTML or limiting input size can reduce exposure while a fix is prepared.
The reported affected release is 15.0.2; the full affected version range has not been established.
This page as .md · .json · in your agent: get_signal("CVE-2026-111766")
GitHub Advisory Database, CC-BY 4.0 · NVD data is provided by NIST and is public domain. Posts quoted belong to their authors.