Skip to content

GO-2026-5027 CVE-2026-42502

Invoking incorrect handling of HTML elements in foreign content in golang.org/x/net/html

Medium Go
Severity
6.1 / 10
Medium · CVSS 3.1
Exploit chance (EPSS)
0.22%
Chance of exploitation in the next 30 days. Higher than 12.99% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-1021 Improper Restriction of Rendered UI Layers or Frames
Fix
0.55.0
Upgrade golang.org/x/net to this version or later

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.

Affected versions

Go

PackageVulnerableFixed in
golang.org/x/net
< 0.55.0
0.55.0

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

golang.org/x/net Go → 0.55.0

go
go get golang.org/x/net@v0.55.0 && go mod tidy

Severity breakdown

CVSS 3.1 6.1

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
None

Weakness

CWE-1021: Improper Restriction of Rendered UI Layers or Frames

The web application does not restrict or incorrectly restricts frame objects or UI layers that belong to another application or domain.

How to prevent it
  • Implementation: The use of X-Frame-Options allows developers of web content to restrict the usage of their application within the form of overlays, frames, or iFrames. The developer can indicate from which domains can frame the content. The concept of X-Frame-Options is well documented, but implementation of this protection mechanism is in development to cover gaps. There is a need for allowing frames from multiple domains.
  • Implementation: A developer can use a "frame-breaker" script in each page that should not be framed. This is very helpful for legacy browsers that do not support X-Frame-Options security feature previously mentioned. It is also important to note that this tactic has been circumvented or bypassed. Improper usage of frames can persist in the web application through nested frames. The "frame-breaking" script does not intuitively account for multiple nested frames that can be presented to the user.
  • Implementation: This defense-in-depth technique can be used to prevent the improper usage of frames in web applications. It prioritizes the valid sources of data to be loaded into the application through the usage of declarative policies. Based on which implementation of Content Security Policy is in use, the developer should use the "frame-ancestors" directive or the "frame-src" directive to mitigate this weakness. Both directives allow for the placement of restrictions when it comes to allowing embedded content.
  • Implementation: In addition to frames or iframes as previously mentioned, the web application is expected to place restrictions on whether it is allowed to be rendered within objects, embed, or applet elements.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-4374-p667-p6c8
HTTP/2 rapid reset can cause excessive work in net/http
High Known exploited Also affects golang.org/x/net
GHSA-qppj-fm5r-hxr3
HTTP/2 Stream Cancellation Attack
Medium Known exploited Also affects golang.org/x/net
GO-2026-6866
Check all ancestor namespace transitions when rendering raw text in html in golang.org/x/net
Not rated yet Also affects golang.org/x/net
GO-2026-6860
Avoid quadratic complexity when coalescing text nodes in html in golang.org/x/net
Not rated yet Also affects golang.org/x/net
GO-2026-6617
HTTP/2 server crash due to HPACK encoder race in net/http
High Also affects golang.org/x/net
GO-2026-6612
Double flow control refund on HTTP/2 server streams in net/http
Critical Also affects golang.org/x/net
GO-2026-6611
Excessive CPU consumption from repeated initial window changes in net/http
High Also affects golang.org/x/net
GO-2026-6610
HTTP/2 transport accepts malformed framing-related headers in net/http
High Also affects golang.org/x/net

Credits: Tristan Madani

Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor