Visit the Wiz Whimzical Shop at AWS re:Invent
Vulnerability DatabaseCVE-2026-140010

CVE-2026-140010: 
JavaScript vulnerability analysis and mitigation

Overview

CVE-2026-140010 is a Regular Expression Denial of Service (ReDoS) vulnerability in the minify() function of HTML Minifier Next and its predecessor HTML Minifier. The flaw stems from ambiguous regular expressions (RE_LAST_HTML_TAG and a whitespace-splitting variant) that cause quadratic backtracking when processing attacker-controlled HTML content. Affected versions include html-minifier-next prior to 9.1.2 and html-minifier from 3.1.1 up to (but not including) 5.0.1. It was published on November 30, 2026, and carries a CVSS v4.0 base score of 8.7 (High) (GitHub Advisory).

Technical details

The root cause is classified as CWE-1333 (Inefficient Regular Expression Complexity), mapped to CAPEC-492 (Regular Expression Exponential Blowup). Two problematic expressions exist in src/htmlminifier.js: RE_LAST_HTML_TAG = /[\s\S]*<(\/?[a-zA-Z][\w:-]*)/ (line 691) and /^(\s*)[\s\S]?(\s)$/ (line 1279). The greedy [\s\S]* prefix followed by a required literal < forces the regex engine to retry at every character boundary when no < is present, producing O(n²) work. The RE_LAST_HTML_TAG variant is triggered when collapseWhitespace is enabled and a large htmlmin:ignore block (with no matching closing tag) is followed by a real HTML element; the whitespace-splitting variant is triggered independently by a long whitespace run inside a default ignoreCustomFragments match. User-controlled HTML content flows directly into these regex evaluations with no length pre-check (GitHub Advisory, Fix Commit).

Impact

Successful exploitation causes severe CPU exhaustion on the server running the minifier: a 256 KB malicious payload can block a Node.js process for approximately 89 seconds, with complexity scaling quadratically (128 KB ≈ 16.5 s, 64 KB ≈ 1.5 s). In web service or API contexts, a small number of concurrent malicious requests can exhaust the event loop and CPU, rendering the service unavailable. The attack surface is broad — any application that passes untrusted HTML to minify() with collapseWhitespace enabled is affected, including CMS platforms, comment systems, email template renderers, online HTML optimization tools, and CI/CD build pipelines. There is no confidentiality or integrity impact; the sole consequence is availability loss (GitHub Advisory).

Exploitability

No public proof-of-concept exploit code has been observed, and there is no evidence of in-the-wild exploitation at the time of disclosure. The EPSS score is 0.0, and the vulnerability is not listed in the CISA Known Exploited Vulnerabilities catalog. However, the attack requires no authentication, no special privileges, and no user interaction — an attacker only needs the ability to submit HTML content that is subsequently processed by the minifier. The advisory itself includes a detailed PoC script (e2e_htmlmin2.mjs) demonstrating the quadratic timing behavior, lowering the barrier for exploitation (GitHub Advisory).

Exploitation steps

  1. Identify target: Locate a web application or API endpoint that accepts user-supplied HTML and processes it through html-minifier-next (< 9.1.2) or html-minifier (3.1.1–5.0.0) with collapseWhitespace: true enabled.
  2. Craft ReDoS payload (RE_LAST_HTML_TAG variant): Construct an HTML document containing a large htmlmin:ignore block filled with characters that contain no <, followed by a real HTML element. Example structure: <htmlmin:ignore> + 'a'.repeat(256000) + </htmlmin:ignore> + <b>y</b>.
  3. Craft ReDoS payload (whitespace-splitting variant): Alternatively, embed a long whitespace run inside a default ignoreCustomFragments match (e.g., inside a <!-- ... --> or <% ... %> block) to trigger the /^(\s*)[\s\S]?(\s)$/ expression.
  4. Submit payload: Send the crafted HTML to the target endpoint (e.g., via HTTP POST to a form, API, or content submission interface).
  5. Achieve denial of service: The minify() call enters quadratic backtracking, occupying a CPU core for seconds to minutes per request. Sending a small number of concurrent requests exhausts server CPU, causing service unavailability (GitHub Advisory).

Indicators of compromise

  • Process: Node.js process exhibiting sustained near-100% CPU utilization on a single core for extended periods (seconds to minutes) during HTML processing operations.
  • Logs: Application logs showing unusually long response times or timeouts on endpoints that invoke minify(); event loop lag alerts in Node.js APM tools.
  • Network: Repeated HTTP requests to content submission or HTML processing endpoints containing large htmlmin:ignore blocks or payloads with long whitespace runs in comment or template tag fragments.
  • File System: Presence of html-minifier-next versions ≤ 9.1.1 or html-minifier versions 3.1.1–5.0.0 in node_modules/ (check package-lock.json or npm list html-minifier-next html-minifier).

Mitigation and workarounds

The primary remediation is to upgrade to html-minifier-next version 9.1.2 or later, or html-minifier version 5.0.1 or later, which replace the ambiguous regular expressions with linear-time equivalents (Fix Commit). If immediate patching is not possible, the following workarounds can reduce risk: disable the collapseWhitespace option to prevent the RE_LAST_HTML_TAG code path from being reached; implement input validation to reject or truncate HTML inputs exceeding a safe length threshold before passing them to minify(); and enforce per-request CPU time limits or timeouts on the minification process. Running the minifier in a worker thread with a timeout can also limit the blast radius of a successful attack (GitHub Advisory).

Additional resources


Source: This report was generated using AI

Related JavaScript vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-140097CRITICAL9.1
  • JavaScript logoJavaScript
  • vite
NoYesNov 30, 2026
CVE-2026-140010HIGH8.7
  • JavaScript logoJavaScript
  • html-minifier
NoYesNov 30, 2026
CVE-2026-140008HIGH8.7
  • JavaScript logoJavaScript
  • minimatch
NoYesNov 30, 2026
CVE-2026-140102HIGH7.5
  • JavaScript logoJavaScript
  • http-proxy-middleware
NoNoNov 30, 2026
CVE-2026-140103MEDIUM5.4
  • JavaScript logoJavaScript
  • http-proxy-middleware
NoYesNov 30, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Additional Wiz resources

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management