CVE-2025-25304: Vega Cross-Site Scripting Vulnerability
MODERATECVE-2025-25304 is a MODERATE cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Vega libraries in the npm ecosystem. The issue involves vega allows cross-site scripting via the vlselectiontuples function. Remediation is available by upgrading affected packages to version 5.26.0, 5.4.2.
CVE-2025-25304 at a Glance
How to Fix CVE-2025-25304
To remediate this vulnerability, upgrade all affected Vega dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install vega@5.26.0
npm install vega-selections@5.4.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls vega
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2025-25304, inspect your project dependencies using npm:
npm ls vega
Analyze the terminal output to locate any version of Vega in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.26.0), your application is affected.
Note: The npm ls vega command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
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 Vega, 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-25304 Affected Vega Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
vega
|
npm |
< 5.26.0
|
5.26.0
|
|
vega-selections
|
npm |
< 5.4.2
|
5.4.2
|
References
Frequently Asked Questions
What is CVE-2025-25304?
Which Vega versions are affected?
What version fixes CVE-2025-25304?
Is vega affected?
Is vega-selections affected?
What CWE is associated with CVE-2025-25304?
How can I check npm dependencies for CVE-2025-25304?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-mp7w-mhcv-673j",
"modified" : "2025-02-14T22:17:54Z",
"published" : "2025-02-14T17:33:58Z",
"aliases" : [ "CVE-2025-25304" ],
"summary" : "Vega allows Cross-site Scripting via the vlSelectionTuples function",
"details" : "### Summary\nThe `vlSelectionTuples` function can be used to call JavaScript functions, leading to XSS.\n\n### Details\n[`vlSelectionTuples`](https://github.com/vega/vega/blob/b45cf431cd6c0d0c0e1567f087f9b3b55bc236fa/packages/vega-selections/src/selectionTuples.js#L14) calls multiple functions that can be controlled by an attacker, including one call with an attacker-controlled argument.\n\nExample call: `vlSelectionTuples([{datum:<argument>}], {fields:[{getter:<function>}]})`\n\nThis can be used to call `Function()` with arbitrary JavaScript and the resulting function can be called with `vlSelectionTuples` or using a type coercion to call `toString` or `valueOf`.\n\n### PoC\n```\n{\"$schema\":\"https://vega.github.io/schema/vega/v5.json\",\"signals\":[{\"name\":\"a\",\"init\":\"+{valueOf:vlSelectionTuples([{datum:'alert(1)'}],{fields:[{getter:[].at.constructor}]})[0].values[0]}\"}]}\n```",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "vega"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "5.26.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "vega-selections"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "5.4.2"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/vega/vega/security/advisories/GHSA-mp7w-mhcv-673j"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-25304"
}, {
"type" : "WEB",
"url" : "https://github.com/vega/vega/commit/9fb9ea07e27984394e463d286eb73944fa61411e"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/vega/vega"
}, {
"type" : "WEB",
"url" : "https://github.com/vega/vega/blob/b45cf431cd6c0d0c0e1567f087f9b3b55bc236fa/packages/vega-selections/src/selectionTuples.js#L14"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2025-02-14T17:33:58Z",
"nvd_published_at" : "2025-02-14T20:15:36Z"
}
}