CVE-2026-42502

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

Published May 22, 2026 CVSS 3.1 · 6.1 Medium EPSS < 1% KEV · Not listed
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.

Analysis

AI-generated

Technical impact

Parsing arbitrary HTML with golang.org/x/net/html that is subsequently rendered via Render can produce an unexpected DOM structure. Attackers can exploit this to inject malicious scripts into web pages that believe they have sanitized input, leading to client‑side code execution. This vulnerability allows cross‑site scripting, potentially compromising user sessions, leaking sensitive data, or performing actions on behalf of the user.

Affected Systems

The affected product is golang.org/x/net, specifically the golang.org/x/net/html package. No specific version constraints are documented in the CVE, so any application that imports this package and renders HTML using Render is potentially impacted.

Risk and Exploitability

The CVSS score is 6.1, indicating medium severity, and EPSS score is < 1%, indicating a very low probability of exploitation. The vulnerability is not listed in the CISA KEV catalog. The attack vector is inferred to be local or remote depending on how the library is used; if a web application incorporates this HTML parser to clean or render user input, an attacker with ability to supply that input could trigger XSS. Exploitation requires that the application trusts the rendered output, so steps to verify sanitization or bypass are necessary.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Apply the latest release of golang.org/x/net/html that includes the fix for the foreign content parsing issue.
  • If a patch cannot be applied immediately, ensure that any HTML data processed with Render is not sent to users without additional whitelist‑based sanitization that removes script and potentially dangerous elements.
  • Implement a Content‑Security‑Policy header that blocks inline scripts and restricts where external scripts may be loaded from, reducing the impact of any residual XSS.

Generated by OpenCVE AI on May 29, 2026 at 20:53 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Weaknesses CWE-1021
CPEs cpe:2.3:a:golang:net:*:*:*:*:*:go:*:*
Type Values Removed Values Added
First Time appeared Golang
Golang net
Vendors & Products Golang
Golang net
Type Values Removed Values Added
Weaknesses CWE-79
Type Values Removed Values Added
Metrics cvssV3_1

{'score': 6.1, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N'}

ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
Weaknesses CWE-79
Type Values Removed Values Added
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.
Title Invoking incorrect handling of HTML elements in foreign content in golang.org/x/net/html
References
Weaknesses
  • CWE-1021

    Improper Restriction of Rendered UI Layers or Frames

Sources

Status
PUBLISHED
Assigner
Go
Published
Updated
May 22, 2026, 5:17 PM
Reserved
Apr 28, 2026, 12:21 AM
Status
Analyzed
Published
May 22, 2026, 4:16 PM
Modified
Jul 23, 2026, 4:10 PM