CVE-2026-42506 Invoking incorrect handling of namespaced elements in foreign content in golang.org/x/net/html

Medium 6.1 Published Updated

Attackers can execute XSS in applications sanitizing HTML via the Go net/html library due to incorrect handling of namespaced elements.

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-42506?

CVE-2026-42506 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-79

Which versions are affected by CVE-2026-42506?

1 open source package ship an affected version, including golang.org/x/net. It affects 1 product.

PackageAffectedFixed in
golang.org/x/net GoAll versions0.55.0

Products include Golang Net.

How do I fix CVE-2026-42506?

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-42506 being exploited?

There is no known exploitation of CVE-2026-42506 in the wild and no public exploit code.

Sources

Also known as AZL-87152, AZL-87209, AZL-87323, AZL-87341, AZL-87363, AZL-87432 and 1369 more.

Is CVE-2026-42506 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free