{"dataType": "CVE_RECORD", "containers": {"adp": [{"metrics": [{"cvssV4_0": {"version": "4.0", "baseScore": 8.7, "attackVector": "NETWORK", "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", "userInteraction": "NONE", "attackComplexity": "LOW", "attackRequirements": "NONE", "privilegesRequired": "NONE", "subIntegrityImpact": "NONE", "vulnIntegrityImpact": "NONE", "subAvailabilityImpact": "NONE", "vulnAvailabilityImpact": "HIGH", "subConfidentialityImpact": "NONE", "vulnConfidentialityImpact": "NONE"}}, {"other": {"type": "Unknown", "content": {"data": "{\"description\":\"HIGH\"}"}}}], "affected": [{"vendor": "npm", "product": "html-minifier", "versions": [{"status": "affected", "version": "3.1.1", "lessThan": "5.0.1", "versionType": "semver"}], "defaultStatus": "unaffected"}, {"vendor": "npm", "product": "html-minifier-next", "versions": [{"status": "affected", "version": "0", "lessThan": "9.1.2", "versionType": "semver"}], "defaultStatus": "unaffected"}], "references": [{"url": "https://github.com/j9t/html-minifier-next"}, {"url": "https://github.com/j9t/html-minifier-next/commit/28417322a9b0291de8b0d1c0694e09855d925545"}, {"url": "https://github.com/j9t/html-minifier-next/security/advisories/GHSA-9wmg-23wv-h297"}, {"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-140010"}], "descriptions": [{"lang": "en", "value": "## Summary\n\nhtml-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.\n\nA 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).\n\n## Affected component and version\n\n- Repository: `j9t/html-minifier-next`\n- Affected version(s): Affected version(s): all releases up to and including 9.1.1\n- 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)\n- Status: the vulnerable expression is present at the referenced revision; no fix was identified at the time of reporting.\n\nhtml-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.\n\n## Reproduction input\n\nminify() on a document containing a large htmlmin:ignore block whose content is plain text with no '<tag' terminator (N=256000 characters).\n\n## Measured timings\n\nThe following values were measured against the real code path described above. Times are wall-clock milliseconds.\n\n```\nnode 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。\n```\n\nAdditional finding (maintainer)\n\nInput: `<p><?php a' + ' '.repeat(n) + 'a ?></p>`, minify() with default options.\n\nn=8000: 67 ms · n=16000: 206 ms · n=32000: 840 ms · n=64000: 3332 ms\n\nThe lazy `[\\s\\S]?` retries `(\\s)$` across the whole whitespace run at each step.\n\n## Impact\n\nA 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.\n\n## Suggested fix\n\nReplace 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."}, {"lang": "en", "value": "HTML Minifier Next: Regular expressions in `minify()` cause O(n²) backtracking on ignored and custom-fragment content"}], "providerMetadata": {"orgId": "386269d4-a6c6-4eaa-bf8e-bc0b0d010558", "shortName": "npm", "dateUpdated": "2026-12-01T17:56:57Z", "x_subShortName": "npm"}}], "cna": {"metrics": [{"format": "CVSS", "cvssV4_0": {"Safety": "NOT_DEFINED", "version": "4.0", "Recovery": "NOT_DEFINED", "baseScore": 8.7, "Automatable": "NOT_DEFINED", "attackVector": "NETWORK", "baseSeverity": "HIGH", "valueDensity": "NOT_DEFINED", "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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X", "exploitMaturity": "NOT_DEFINED", "providerUrgency": "NOT_DEFINED", "userInteraction": "NONE", "attackComplexity": "LOW", "attackRequirements": "NONE", "privilegesRequired": "NONE", "subIntegrityImpact": "NONE", "vulnIntegrityImpact": "NONE", "integrityRequirement": "NOT_DEFINED", "modifiedAttackVector": "NOT_DEFINED", "subAvailabilityImpact": "NONE", "vulnAvailabilityImpact": "HIGH", "availabilityRequirement": "NOT_DEFINED", "modifiedUserInteraction": "NOT_DEFINED", "modifiedAttackComplexity": "NOT_DEFINED", "subConfidentialityImpact": "NONE", "vulnConfidentialityImpact": "NONE", "confidentialityRequirement": "NOT_DEFINED", "modifiedAttackRequirements": "NOT_DEFINED", "modifiedPrivilegesRequired": "NOT_DEFINED", "modifiedSubIntegrityImpact": "NOT_DEFINED", "modifiedVulnIntegrityImpact": "NOT_DEFINED", "vulnerabilityResponseEffort": "NOT_DEFINED", "modifiedSubAvailabilityImpact": "NOT_DEFINED", "modifiedVulnAvailabilityImpact": "NOT_DEFINED", "modifiedSubConfidentialityImpact": "NOT_DEFINED", "modifiedVulnConfidentialityImpact": "NOT_DEFINED"}}], "affected": [{"vendor": "unknown", "product": "unknown", "defaultStatus": "unknown"}], "references": [{"url": "https://github.com/j9t/html-minifier-next/commit/28417322a9b0291de8b0d1c0694e09855d925545"}, {"url": "https://github.com/j9t/html-minifier-next/security/advisories/GHSA-9wmg-23wv-h297"}], "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."}], "problemTypes": [{"descriptions": [{"lang": "en", "cweId": "CWE-1333", "description": "CWE-1333"}]}], "providerMetadata": {"orgId": "00000000-0000-4000-A000-000000000003", "shortName": "DISCARDED_CNA", "dateUpdated": "2026-11-30T22:17:30Z", "x_subShortName": "nvd"}}}, "cveMetadata": {"cveId": "CVE-2026-140010", "state": "PUBLISHED", "dateUpdated": "2026-12-01T14:18:19Z", "assignerOrgId": "a0819718-46f1-4df5-94e2-005712e83aaa", "datePublished": "2026-11-30T22:17:30Z", "assignerShortName": "GitHub_M"}, "dataVersion": "5.0"}