JavaScriptSeverity: MediumStatus: Published
Deeply nested documents overflow the call stack during text extraction
Applications that extract text from untrusted HTML or XML documents with domutils’ getText(), textContent() or innerText() are affected (CWE-674). These functions called themselves once per level of the document, so a deeply nested document exhausts the JavaScript call stack and makes them throw a RangeError. npm package domutils versions >= 1.1.0 and <= 4.0.2 are affected: getText() from 1.1.0, and textContent() and innerText() from 2.7.0. Fixed in 4.1.0. GitHub rates it medium, with CVSS 3.1 score 5.3. The advisory credits Linus-Shyu and ucsurf as reporters. Fixed by Felix Boehm (@fb55).
Impact
Applications that extract text from untrusted HTML or XML documents with domutils’ getText(), textContent() or innerText() are affected. These functions called themselves once per level of the document (CWE-674), so a deeply nested document exhausts the JavaScript call stack and makes them throw a RangeError. If the application does not catch the error, it can fail the request or terminate the process.
Affected versions and fix
The npm package domutils is affected in versions >= 1.1.0 and <= 4.0.2: getText() from 1.1.0, and textContent() and innerText() from 2.7.0. The patched release is 4.1.0.
The published advisory is GHSA-f3vc-4w2g-4762. GitHub rates it medium, with CVSS 3.1 score 5.3 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L). Felix Boehm (@fb55) published the advisory on 2026-12-03. It was reported on 2026-10-05 through GitHub private vulnerability reporting. The advisory credits Linus-Shyu and ucsurf as reporters.
The advisory says this was fixed in 4.1.0, which collects text with an explicit stack instead of recursion. On the repository, Felix Boehm merged pull request 2408 (“fix: collect text without recursive calls”) on 2026-12-03. That change is in v4.1.0. The pull request is not ours.
The advisory suggests catching errors thrown by these functions and treating the document as invalid, or rejecting documents nested deeper than the application needs, if an upgrade is not possible yet.
Timeline
- Found
- Reported via private vulnerability report
- Advisory published
- Entry last updated
Machine-readable: JSON · Markdown · ID security/javascript/fb55__domutils/2026-10-05-text-extraction-stack-overflow
If this work is useful to you, you can support it on Buy Me a Coffee.