Inefficient Algorithmic Complexity Affecting domutils package, versions >=1.3.0 <4.1.0


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-JS-DOMUTILS-23745867
  • published4 Dec 2026
  • disclosed4 Dec 2026
  • creditUgur Celik (ucsurf)

Introduced: 4 Dec 2026

NewCVE-2026-145165  (opens in a new tab)
CWE-407  (opens in a new tab)

How to fix?

Upgrade domutils to version 4.1.0 or higher.

Overview

Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity via an inefficient algorithm in removeSubsets() that exhibits O(n² × depth) time complexity. When processing documents with many nested or sibling nodes, an attacker can submit HTML or XML input processed by css-select selectAll() or cheerio .find() to exhaust CPU and block the Node.js event loop for seconds.

PoC

import { parseDocument } from "htmlparser2";
import { getElementsByTagName, removeSubsets } from "domutils";

const doc = parseDocument("<b>".repeat(5_000) + "<i></i>".repeat(5_000));
const nodes = getElementsByTagName("i", doc);
console.time("removeSubsets");
removeSubsets(nodes); // about 15 s with domutils 4.0.2
console.timeEnd("removeSubsets");

CVSS Base Scores

version 4.0
version 3.1