Avoid quadratic complexity when coalescing text nodes in html in golang.org/x/net
- Published
- Last modified
- Where the record stands: published, rejected by its publisher, or superseded by another id.What do these mean? →
- published
- Whether CISA lists it in its Known Exploited Vulnerabilities catalog: proof that attackers are using it.What do these mean? →
- Not listed in CISA KEV
- Fix
- Fixed in 0.62.0
- Whether working attack code is public (Exploit-DB, Metasploit, Nuclei or GitHub). Public code makes attacks easier.What do these mean? →
- None on Exploit-DB, Metasploit or GitHub
Summary
The golang.org/x/net HTML parser, which Go programs use to parse HTML documents, is affected. Crafted HTML containing many short text fragments separated by ignored end tags can cause parsing time and memory use to grow quadratically, potentially slowing or exhausting resources on the system doing the parsing.
Summarized by anthropic/claude-haiku-5.5. Verify details against the original sources.
Read the original description
When coalescing adjacent text nodes in addText and fosterParent, appending to an existing TextNode's Data via string concatenation (n.Data += text) reallocated and copied the accumulated string on every token. Inputs containing many short text runs separated by ignored end tags (such as "a</x>") caused O(n^2) allocations and byte copies. Accumulate coalesced text in per-node byte slices during parsing and materialize Data strings once at the end of parse.
Timeline
- CVE published
- First seen by cve.now
Affected versions
- golang.org/x/net/html
fixed in 0.62.0
- golang.org/x/netGo
fixed in 0.62.0