HTML Minifier Next: Regular expressions
Affects html-minifier-nextSource GCVE Database
Not known to be exploited · CVSS 8.7 High : upgrade to 9.1.2 soon.
Data as of 1 Dec 2026, 19:00 UTC
Thin evidence
One scorer or none| CNA (GitHub_M) | CVSS 4.0 | 8.7 |
|---|
- Patch
- Available – fixed in 9.1.2, 5.0.1
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:NExploitation evidence
Disclosed: evidence found.
CVE published 30 Nov 2026
Detectable: no evidence on record.
No public nuclei template indexed
Weaponized: no evidence on record.
No public exploit code indexed in Metasploit or Exploit-DB
Exploited in the wildExploited: no evidence on record.
Not in CISA KEV and no source reports exploitation
Observed by OffSeq MirageSeen by Mirage: no evidence on record.
No attack traffic recorded by OffSeq Mirage sensors
A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 1 Dec 2026.
What to do
Upgrade html-minifier-next to 9.1.2; html-minifier to 5.0.1.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| npmhtml-minifier-next | Affected
| Fixed in
|
| npmhtml-minifier | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
Description
## Summary html-minifier-next finds the last HTML tag inside htmlmin:ignore blocks with the expression /[\s\S]*<(\/?[a-zA-Z][\w:-]*)/. A large ignore block without a matching tag makes the greedy prefix rescan the content, so the public minify() API takes about 89 seconds for 256 KB. A second expression with the same flaw, `/^(\s*)[\s\S]?(\s)$/`, splits whitespace off matches of `ignoreCustomFragments`. A long whitespace run inside such a fragment triggers it with default options, since the default fragments cover `<? … ?>` and `<% … %>` (64 KB: about 3.3 s). ## Affected component and version - Repository: `j9t/html-minifier-next` - Affected version(s): Affected version(s): all releases up to and including 9.1.1 - Component: src/htmlminifier.js:691 (`RE_LAST_HTML_TAG`), :1795 (exec on `htmlmin:ignore` content, requires `collapseWhitespace`); src/htmlminifier.js:1279 (whitespace split of `ignoreCustomFragments` matches, default options) html-minifier is affected as well: The custom-fragment issue dates back to html-minifier 3.1.1, and 5.0.0, rebuilt on HTML Minifier Next 9.1.1, carries both. ## Reproduction input minify() on a document containing a large htmlmin:ignore block whose content is plain text with no '<tag' terminator (N=256000 characters). ## Measured timings The following values were measured against the real code path described above. Times are wall-clock milliseconds. ``` node e2e_htmlmin2.mjs → "n=4000 len=4021 ms=5.8 / n=8000 len=8021 ms=20.8 / n=16000 len=16021 ms=92.7 / n=32000 len=32021 ms=333.0";node -e(64000/128000/256000)→ 1461 / 16511 / 89226 ms。源码 src/htmlminifier.js:691 `const RE_LAST_HTML_TAG = /[\s\S]*<(\/?[a-zA-Z][\w:-]*)/;`,使用点 :1795 `RE_LAST_HTML_TAG.exec(content)`;公开入口 :2997 `export const minify = async function (value, options)`。control(短 ignore 块)ms<1。 ``` Additional finding (maintainer) Input: `<p><?php a' + ' '.repeat(n) + 'a ?></p>`, minify() with default options. n=8000: 67 ms · n=16000: 206 ms · n=32000: 840 ms · n=64000: 3332 ms The lazy `[\s\S]?` retries `(\s)$` across the whole whitespace run at each step. ## Impact A modest attacker-controlled input drives superlinear or unbounded regular-expression backtracking (or recursive stack exhaustion), occupying a CPU core for seconds to minutes and enabling denial of service against the affected service or library consumer. ## Suggested fix Replace the ambiguous expression with an unambiguous, linear-time equivalent (bounded character classes, possessive or atomic groups, or an index-based scanner), enforce a length limit at the entry point, and add a regression test using the adversarial input above.
References
- github.com/j9t/html-minifier-next/security/advisories/GHSA-9wmg-23wv-h297 (opens in a new tab)
- nvd.nist.gov/vuln/detail/CVE-2026-140010 (opens in a new tab)
- github.com/j9t/html-minifier-next/commit/28417322a9b0291de8b0d1c0694e09855d925545 (opens in a new tab)
- github.com/j9t/html-minifier-next (opens in a new tab)