CVE-2025-59840
Vega Cross-Site Scripting (XSS) via expressions abusing toString calls in environments using the VEGA_DEBUG global variable
Also known as GHSA-7f2v-3qq3-vvjf
Mitigation
- Upgrade vega to 6.2.0 or later.
- Upgrade vega-expression to one of 6.1.0, 5.2.1 (or later in the same release line).
- Upgrade vega-interpreter to one of 2.2.1, 1.2.1 (or later in the same release line).
Who should check
- Projects that depend on npm package vega (< 6.2.0)
- Projects that depend on npm package vega-expression (>= 6.0.0, < 6.1.0)
- Projects that depend on npm package vega-interpreter (>= 2.0.0, < 2.2.1)
- Anyone running vega vega < 6.2.0; vega-expression >= 6.0.0, < 6.1.0; vega-expression < 5.2.1; vega-interpreter >= 2.0.0, < 2.2.1; vega-interpreter < 1.2.1
Vulnerability facts
- Affected
- vega < 6.2.0; vega-expression >= 6.0.0, < 6.1.0; vega-interpreter >= 2.0.0, < 2.2.1
- Fixed in
- 6.2.0, 6.1.0, 5.2.1, 2.2.1, 1.2.1
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Remote, no login needed
- CVSS
- 8.1 (v3.1, CNA)CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:NOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Network
- Attack complexity: Low
- Privileges required: None
- User interaction: Required
- Scope: Unchanged
- Confidentiality impact: High
- Integrity impact: High
- Availability impact: None
- EPSS
- 0.65% chance of exploitation in 30 days (percentile 46, 2026-11-26)
- CWE
- CWE-79
- Modified
Description
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.
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| npm vega | < 6.2.0 | 6.2.0 | osv |
| npm vega-expression | >= 6.0.0, < 6.1.0 | 6.1.0, 5.2.1 | osv |
| npm vega-interpreter | >= 2.0.0, < 2.2.1 | 2.2.1, 1.2.1 | osv |
| vega | vega < 6.2.0; vega-expression >= 6.0.0, < 6.1.0; vega-expression < 5.2.1; vega-interpreter >= 2.0.0, < 2.2.1; vega-interpreter < 1.2.1 | — | cvelist |
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2025-59840. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2025-59840.md Affected: vega < 6.2.0; vega-expression >= 6.0.0, < 6.1.0; vega-interpreter >= 2.0.0, < 2.2.1 Fixed in: 6.2.0, 6.1.0, 5.2.1, 2.2.1, 1.2.1 Steps: 1. Search this machine and project for vega (npm), vega-expression (npm), vega-interpreter (npm), vega: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Vendor advisories
Other
- https://github.com/vega/editor/blob/e102355589d23cdd0dbfd607a2cc5f9c5b7a4c55/src/components/renderer/renderer.tsx#L239
- https://github.com/vega/editor/blob/e102355589d23cdd0dbfd607a2cc5f9c5b7a4c55/src/index.tsx#L14-L16
- https://github.com/vega/vega
- https://vega.github.io/editor/#/url/vega/N4IgJAzgxgFgpgWwIYgFwhgF0wBwqgegIDc4BzJAOjIEtMYBXAI0poHsDp5kTykSArJQBWENgDsQAGhAB3GgBN6aAMwCADDPg0yWVRplIGmNhBoAvOGhDiJVmQrjQATjRyZ2k9ABU2ZMgA2cAAEAELGJpIyZmTiSAEQaADaoHEIVugm-kHSIMTxDBmYzoUyEsmgcKTimImooJgAnjgZIFABNFAA1rnIzl1prVA0zu1WAL4yDDgKSJitWYEhAPzBAGbxECGowcWFIOMAupOpSOnWSAoKAGI0AfPOueWoKSBVcDV1Dc2tCGwMWz+pFyYgYo1a8nECjYsgOUxmc1aAApgCYAMrFGjiMiod41SjEGhwWSUABqAFEAOIAQQA+gARcmhACqlIJfEoAGEkOJ8hAABI8hRBZyUHDONgmJotSgSKTBPGYAByZzguOqmAJRJJUAkYiClACfiktJgQpF+GADChcDWWLgClQAHJ4nBnJgkWxXLRxMEANTBAAGwQAGmi0cEJMFSM4zFHAwGKTSGUzWWSqXSKQAlNEASQA8kqAJROyam81u3M2gAe6o+msJxMoVXi4yLfoAjAdjscgA
- https://vega.github.io/vega/usage/interpreter
FAQ
Is CVE-2025-59840 being exploited?
There is no confirmed exploitation: CVE-2025-59840 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.65% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2025-59840?
High: CVSS 8.1 (v3.1, scored by CNA). Remote, no login needed. A user has to take an action, such as opening a link, for the attack to work.
Which versions are affected by CVE-2025-59840?
vega < 6.2.0; vega-expression >= 6.0.0, < 6.1.0; vega-interpreter >= 2.0.0, < 2.2.1.
Is there a fix for CVE-2025-59840?
Yes. Fixed in 6.2.0, 6.1.0, 5.2.1, 2.2.1, 1.2.1. Upgrade vega to 6.2.0 or later. Upgrade vega-expression to one of 6.1.0, 5.2.1 (or later in the same release line). Upgrade vega-interpreter to one of 2.2.1, 1.2.1 (or later in the same release line).
How do I check if I'm affected by CVE-2025-59840?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.