CVE-2025-22872: Golang.org/x/net Cross-Site Scripting Vulnerability
MODERATECVE-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
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.
Upgrade golang.org/x/net to 0.38.0
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
CVE-2025-22872 Affected Golang.org/x/net Versions
1 component(s)| 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?
Which Golang.org/x/net versions are affected?
What version fixes CVE-2025-22872?
Is golang.org/x/net affected?
What CWE is associated with CVE-2025-22872?
How can I check Go dependencies for CVE-2025-22872?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}