# CVE-2025-59840: Vega Cross-Site Scripting (XSS) via expressions abusing toString calls in environments using the VEGA\_DEBUG global variable

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 8.1
- **CVSS:** 8.1 (v3.1, CNA) `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N`
- **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
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 0.65% (percentile 46, 2026-11-26)
- **CWE:** CWE-79
- **Aliases:** GHSA-7f2v-3qq3-vvjf
- **Published:** 2025-11-13T19:54:26.256Z
- **Modified:** 2026-10-19T13:10:00.110Z

## 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

## 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

- npm `vega`: affected \< 6.2.0; fixed 6.2.0 (osv)
- npm `vega-expression`: affected \>= 6.0.0, \< 6.1.0; fixed 6.1.0, 5.2.1 (osv)
- npm `vega-interpreter`: affected \>= 2.0.0, \< 2.2.1; fixed 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)

## 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).

## Check your systems with an agent

Paste this into a coding agent:

```text
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.
```

## 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.

## References

- vendor: <https://github.com/vega/vega/security/advisories/GHSA-7f2v-3qq3-vvjf>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2025-59840>
- other: <https://github.com/vega/editor/blob/e102355589d23cdd0dbfd607a2cc5f9c5b7a4c55/src/components/renderer/renderer.tsx#L239>
- other: <https://github.com/vega/editor/blob/e102355589d23cdd0dbfd607a2cc5f9c5b7a4c55/src/index.tsx#L14-L16>
- other: <https://github.com/vega/vega>
- other: <https://vega.github.io/editor/#/url/vega/N4IgJAzgxgFgpgWwIYgFwhgF0wBwqgegIDc4BzJAOjIEtMYBXAI0poHsDp5kTykSArJQBWENgDsQAGhAB3GgBN6aAMwCADDPg0yWVRplIGmNhBoAvOGhDiJVmQrjQATjRyZ2k9ABU2ZMgA2cAAEAELGJpIyZmTiSAEQaADaoHEIVugm-kHSIMTxDBmYzoUyEsmgcKTimImooJgAnjgZIFABNFAA1rnIzl1prVA0zu1WAL4yDDgKSJitWYEhAPzBAGbxECGowcWFIOMAupOpSOnWSAoKAGI0AfPOueWoKSBVcDV1Dc2tCGwMWz+pFyYgYo1a8nECjYsgOUxmc1aAApgCYAMrFGjiMiod41SjEGhwWSUABqAFEAOIAQQA+gARcmhACqlIJfEoAGEkOJ8hAABI8hRBZyUHDONgmJotSgSKTBPGYAByZzguOqmAJRJJUAkYiClACfiktJgQpF+GADChcDWWLgClQAHJ4nBnJgkWxXLRxMEANTBAAGwQAGmi0cEJMFSM4zFHAwGKTSGUzWWSqXSKQAlNEASQA8kqAJROyam81u3M2gAe6o+msJxMoVXi4yLfoAjAdjscgA>
- other: <https://vega.github.io/vega/usage/interpreter>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2025-59840>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-7f2v-3qq3-vvjf> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2025-59840> · JSON: <https://flawdb.com/api/v1/entries/CVE-2025-59840>
