{"id":"CVE-2026-140010","state":"PUBLISHED","title":"HTML Minifier Next: Regular expressions in `minify()` cause O(n²) backtracking on ignored and custom-fragment content","description":"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.","publishedAt":"2026-11-30T21:44:38.140Z","updatedAt":"2026-11-30T21:44:38.140Z","severity":{"score":8.7,"label":"High","version":"4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","source":"GitHub_M"},"assigner":"GitHub_M","products":["j9t html-minifier-next","j9t html-minifier"],"affected":[{"vendor":"j9t","product":"html-minifier-next","versions":[{"version":"< 9.1.2","status":"affected"}]},{"vendor":"j9t","product":"html-minifier","versions":[{"version":">= 3.1.1, < 5.0.1","status":"affected"}]}],"references":["https://github.com/j9t/html-minifier-next/security/advisories/GHSA-9wmg-23wv-h297","https://github.com/j9t/html-minifier-next/commit/28417322a9b0291de8b0d1c0694e09855d925545"],"weaknesses":["CWE-1333"],"ingestedAt":"2026-11-30T21:58:07.068Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/140xxx/CVE-2026-140010.json","commit":"f71934d0dee299cdbebf9dda3900e8dd67cca0b3","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-140010","state":"PUBLISHED","datePublished":"2026-11-30T21:44:38.140Z","dateUpdated":"2026-11-30T21:44:38.140Z","assignerShortName":"GitHub_M","assignerOrgId":"a0819718-46f1-4df5-94e2-005712e83aaa","dateReserved":"2026-11-30T17:42:59.710Z"},"containers":{"cna":{"title":"HTML Minifier Next: Regular expressions in `minify()` cause O(n²) backtracking on ignored and custom-fragment content","descriptions":[{"lang":"en","value":"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."}],"affected":[{"vendor":"j9t","product":"html-minifier-next","versions":[{"version":"< 9.1.2","status":"affected"}]},{"vendor":"j9t","product":"html-minifier","versions":[{"version":">= 3.1.1, < 5.0.1","status":"affected"}]}],"references":[{"url":"https://github.com/j9t/html-minifier-next/security/advisories/GHSA-9wmg-23wv-h297","name":"https://github.com/j9t/html-minifier-next/security/advisories/GHSA-9wmg-23wv-h297","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/j9t/html-minifier-next/commit/28417322a9b0291de8b0d1c0694e09855d925545","name":"https://github.com/j9t/html-minifier-next/commit/28417322a9b0291de8b0d1c0694e09855d925545","tags":["x_refsource_MISC"]}],"metrics":[{"cvssV4_0":{"attackVector":"NETWORK","attackComplexity":"LOW","attackRequirements":"NONE","privilegesRequired":"NONE","userInteraction":"NONE","vulnConfidentialityImpact":"NONE","vulnIntegrityImpact":"NONE","vulnAvailabilityImpact":"HIGH","subConfidentialityImpact":"NONE","subIntegrityImpact":"NONE","subAvailabilityImpact":"NONE","baseScore":8.7,"baseSeverity":"HIGH","vectorString":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","version":"4.0"}}],"problemTypes":[{"descriptions":[{"cweId":"CWE-1333","lang":"en","description":"CWE-1333: Inefficient Regular Expression Complexity","type":"CWE"}]}],"providerMetadata":{"shortName":"GitHub_M","orgId":"a0819718-46f1-4df5-94e2-005712e83aaa","dateUpdated":"2026-11-30T21:44:38.140Z"},"source":{"advisory":"GHSA-9wmg-23wv-h297","discovery":"UNKNOWN"}}}}}