HTML Minifier Next: Regular expressions in `minify()` cause O(n²) backtracking on ignored and custom-fragment content
CVE-2026-140010GHSA-9wmg-23wv-h297Published 30 Nov 2026, 21:44 UTC
Real-world risk
3.8/ 10Low
Routine
PreliminaryFrom the CVSS vector only · confidence low
CVSS
8.7
scored by the vendor (CNA), CVSS 4.0
In plain words
No plain-language summary yet. The original description is below.
Original description (from GitHub_M)
HTML Minifier Next is a configurable HTML minifier and the enhanced successor to HTML Minifier. Prior to html-minifier-next 9.1.2, and from html-minifier 3.1.1 until 5.0.1, minify() in src/htmlminifier.js uses ambiguous regular expressions that can repeatedly rescan ignored or custom-fragment content. The ignoreCustomFragments whitespace-splitting variant dates to html-minifier 3.1.1, while html-minifier 5.0.0 carries both that variant and the RE_LAST_HTML_TAG variant used for htmlmin:ignore content. With collapseWhitespace enabled, a long htmlmin:ignore block without a matching tag reaches RE_LAST_HTML_TAG when the ignore-block placeholder and intervening text are followed by a real element; independently, a long whitespace run in a default custom fragment reaches the whitespace-splitting expression. Either form can cause quadratic regular-expression backtracking and occupy a CPU core for seconds or minutes. This issue is fixed in html-minifier-next 9.1.2 and html-minifier 5.0.1.
Am I affected?
| Product | Affected versions (from the sources) | Fixed in |
|---|---|---|
| html-minifierCommon | >= 3.1.1, < 5.0.1 | 5.0.1 |
| html-minifierNiche | >= 3.1.1, < 5.0.1 | 5.0.1 |
| html-minifier-nextNiche | < 9.1.2 | 9.1.2 |
| html-minifier-nextNiche | <= 9.1.1 | 9.1.2 |
What to do
Update to a fixed version: 5.0.1, 9.1.2.
Why this score
| Factor | Value | Evidence | × |
|---|---|---|---|
| Impact | Denial of serviceCrash or resource exhaustion only | From the CVSS vector | 0.40 |
| Attacker position | InternetAnyone on the Internet can reach a typical deployment | From the CVSS vector | 1.00 |
| Privileges needed | NoneNo account | From the CVSS vector | 1.00 |
| Victim interaction | NoneNothing | From the CVSS vector | 1.00 |
| Configuration | DefaultOut-of-the-box installs are vulnerable | From the CVSS vector | 1.00 |
| Reliability | ReliableDeterministic: injection, logic bug, path traversal | From the CVSS vector | 1.00 |
Threat level T3: Public proof of concept (× 0.95)
A qualifying GitHub proof of concept, an unverified Exploit-DB entry, CISA's SSVC says PoC, or a reference tagged as an exploit
- Reference tagged as exploit (link)
- CISA SSVC: proof of concept
EPSS 0.8% chance of exploitation in 30 days (percentile 57), as of 2026-12-02.
The arithmetic
- Prerequisites multiplied together1.000
- Threat T3: Public proof of concept0.950
- 10 × impact 0.4 × prerequisites 1 × threat 0.953.800
- Rounded to one decimal between 0.1 and 103.8
Exploitation and evidence timeline
- 30 Nov 2026 Published
- 2 Dec 2026 Reference tagged as exploit first seen
- 2 Dec 2026 CISA SSVC: proof of concept first seen
- 2 Dec 2026 Risk 3.8 (cvss fallback)
Weakness
CWE-1333
References
- https://github.com/j9t/html-minifier-next/security/advisories/GHSA-9wmg-23wv-h297exploit, vendor-advisory
- https://github.com/j9t/html-minifier-next/commit/28417322a9b0291de8b0d1c0694e09855d925545misc
- https://nvd.nist.gov/vuln/detail/CVE-2026-140010
- https://github.com/advisories/GHSA-9wmg-23wv-h297
- CVE-2026-140010 on CVE.org