CVE-2026-144958: Masterminds html5-php before 2.12.0 CPU Exhaustion via Parse-Error Position Tracking
Masterminds html5-php before 2.12.0 contains a cross-site scripting vulnerability because UTF8Utils::convertToUTF8 deletes invalid UTF-8 bytes instead of replacing them with U+FFFD. Attackers can split tokens like <scr\xFFipt> with bytes such as 0xFF to evade raw-byte tag filters and inject script elements into rendered output.
Other sources
Masterminds html5-php before 2.12.0 contains a cross-site scripting vulnerability in OutputRules::namespaceAttrs, which writes xmlns: namespace declaration values into double-quoted attributes without escaping. Attackers can supply HTML with an xmlns:x value containing a double quote to bypass DOM-walking sanitizers and inject script into output re-serialized with saveHTML.
— NVD
Masterminds html5-php before 2.12.0 contains a denial of service vulnerability that allows remote attackers to exhaust CPU through quadratic parse-error position tracking in Tokenizer::parseError. Attackers can submit small HTML documents with repeated '&;' sequences that trigger full-buffer rescans in Scanner::currentLine and Scanner::columnOffset, consuming seconds of CPU per document.
— OSV
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 2.12.0
Event History
Frequently Asked Questions
Which versions should be treated as affected?
Versions of composer/masterminds/html5-php before 2.12.0 are affected. Version 2.12.0 is identified as the fixed release.
What conditions are required for exploitation?
An attacker must be able to supply HTML containing an xmlns:* namespace declaration whose value includes a double quote. The supplied HTML must then be processed by a DOM-walking sanitizer and re-serialized with saveHTML.
What can be done while upgrading is not immediately possible?
Do not allow untrusted HTML with attacker-controlled xmlns:* namespace declaration values to reach the affected sanitization and saveHTML re-serialization path. Prioritize controlling HTML inputs processed by that path until the dependency can be updated.