CVE-2026-140010: HTML Minifier Next: Regular expressions in `minify()` cause O(n²) backtracking on ignored and custom-fragment content

Published Nov 30, 2026
·
Updated

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 RELASTHTMLTAG variant used for htmlmin:ignore content. With collapseWhitespace enabled, a long htmlmin:ignore block without a matching tag reaches RELASTHTMLTAG 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 Software

2 affected components
npm/html-minifier-next<9.1.2
npm/html-minifier>=3.1.1<5.0.1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/html-minifier-next to a version that resolves this vulnerability.

    Fixed in 9.1.2
  2. Upgrade

    Upgrade npm/html-minifier to a version that resolves this vulnerability.

    Fixed in 5.0.1

Event History

Nov 30, 2026
CVE Published
via MITRE·09:44 PM
Data Sourced
via MITRE·09:44 PM
DescriptionWeakness
Data Sourced
via OSV·09:44 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·10:17 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which versions need to be upgraded?

Upgrade html-minifier-next to 9.1.2 or later, or html-minifier to 5.0.1 or later. The affected html-minifier-next releases are those before 9.1.2; for html-minifier, the affected range is 3.1.1 through versions before 5.0.1.

2

What processing conditions trigger the excessive CPU use?

collapseWhitespace must be enabled. One trigger is a long htmlmin:ignore block without a matching tag, where the ignored-block placeholder and intervening text are followed by a real element; another is a long whitespace run in a default custom fragment.

3

What happens when a triggering input is minified?

The ambiguous regular expressions can perform quadratic backtracking while repeatedly rescanning content. A single minify() operation can occupy a CPU core for seconds or minutes.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203