CVE-2026-25681 Invoking incorrect handling of character references in DOCTYPE nodes in golang.org/x/net/html
Attackers can execute XSS in applications sanitizing HTML via the Go net/html library due to incorrect DOCTYPE character reference handling.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2026-25681?
CVE-2026-25681 is a medium-severity cross-site scripting vulnerability in golang.org/x/net/html, published on 22 May 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Official description
Parsing arbitrary HTML which is then rendered using Render can result in an unexpected HTML tree. This can be leveraged to execute XSS attacks in applications that attempt to sanitize input HTML before rendering.
Weakness: CWE-1021
Which versions are affected by CVE-2026-25681?
1 open source package ship an affected version, including golang.org/x/net. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
golang.org/x/net Go | All versions | 0.55.0 |
Products include Golang Net.
How do I fix CVE-2026-25681?
Upgrade golang.org/x/net to 0.55.0 or later.
Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.
Is CVE-2026-25681 being exploited?
There is no known exploitation of CVE-2026-25681 in the wild and no public exploit code.
Other vulnerabilities in golang.org/x/net/html
- CVE-2026-39821 Invoking failure to reject ASCII-only Punycode-encoded labels in golang.org/x/net/idna
- CVE-2026-25680 Invoking denial of service when parsing arbitrary HTML in golang.org/x/net/html
- CVE-2026-27136 Invoking duplicate attributes can cause XSS in golang.org/x/net/html
- CVE-2026-42502 Invoking incorrect handling of HTML elements in foreign content in golang.org/x/net/html
- CVE-2026-42506 Invoking incorrect handling of namespaced elements in foreign content in golang.org/x/net/html
Sources
Also known as AZL-87158, AZL-87221, AZL-87314, AZL-87344, AZL-87378, AZL-87435 and 1371 more.