CVE-2025-22872: Golang.org/x/net Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-vvgc-356p-c3xw
CWE-79
Published
Advisory Summary

CVE-2025-22872 is a MODERATE cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Golang.org/x/net libraries in the Go ecosystem. The issue involves golang.org/x/net vulnerable to cross-site scripting. Remediation is available by upgrading affected packages to version 0.38.0.

CVE-2025-22872 at a Glance

CVE Identifier CVE-2025-22872
GHSA Identifier GHSA-vvgc-356p-c3xw
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Golang.org/x/net
Package Ecosystem Go
Published Date
Last Updated

How to Fix CVE-2025-22872

To remediate this vulnerability, upgrade all affected Golang.org/x/net dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

golang.org/x/net fixed: 0.38.0
Upgrade golang.org/x/net to 0.38.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for golang.org/x/net

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-22872, inspect your project dependencies for Golang.org/x/net:

inspect dependencies for golang.org/x/net

Analyze the terminal output to locate any version of Golang.org/x/net in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.38.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Golang.org/x/net, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

The tokenizer incorrectly interprets tags with unquoted attribute values that end with a solidus character (/) as self-closing. When directly using Tokenizer, this can result in such tags incorrectly being marked as self-closing, and when using the Parse functions, this can result in content following such tags as being placed in the wrong scope during DOM construction, but only when tags are in foreign content (e.g. <math>, <svg>, etc contexts).

CVE-2025-22872 Affected Golang.org/x/net Versions

1 component(s)
Fixed Versions:
0.38.0
Product / Package Ecosystem Affected Versions Fixed Version
golang.org/x/net
Go
< 0.38.0
0.38.0

References

Frequently Asked Questions

What is CVE-2025-22872?
CVE-2025-22872 is a security vulnerability in Golang.org/x/net involving golang.org/x/net vulnerable to Cross-site Scripting under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Golang.org/x/net versions are affected?
Affected versions include releases prior to 0.38.0 across affected packages: golang.org/x/net.
What version fixes CVE-2025-22872?
Upgrading to 0.38.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is golang.org/x/net affected?
Yes, golang.org/x/net is affected in releases prior to 0.38.0. Upgrade your dependency to 0.38.0 or later.
What CWE is associated with CVE-2025-22872?
CVE-2025-22872 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check Go dependencies for CVE-2025-22872?
Run the dependency tree command: 'inspect dependencies for golang.org/x/net'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-vvgc-356p-c3xw",
  "modified" : "2025-05-17T18:49:25Z",
  "published" : "2025-04-16T19:22:51Z",
  "aliases" : [ "CVE-2025-22872" ],
  "summary" : "golang.org/x/net vulnerable to Cross-site Scripting",
  "details" : "The tokenizer incorrectly interprets tags with unquoted attribute values that end with a solidus character (/) as self-closing. When directly using Tokenizer, this can result in such tags incorrectly being marked as self-closing, and when using the Parse functions, this can result in content following such tags as being placed in the wrong scope during DOM construction, but only when tags are in foreign content (e.g. <math>, <svg>, etc contexts).",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "golang.org/x/net"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.38.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-22872"
  }, {
    "type" : "WEB",
    "url" : "https://go.dev/cl/662715"
  }, {
    "type" : "WEB",
    "url" : "https://go.dev/issue/73070"
  }, {
    "type" : "WEB",
    "url" : "https://groups.google.com/g/golang-announce/c/ezSKR9vqbqA"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2025-3595"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20250516-0007"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-04-16T19:22:51Z",
    "nvd_published_at" : "2025-04-16T18:16:04Z"
  }
}