/

CVE-2025-65110

Severity:

HIGH RISK

(8.1)

XSS in Untrusted Vega Specs with Global View Exposure

CVE-2025-65110

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Arbitrary JavaScript Execution in Browser (DOM XSS)

Severity:

HIGH RISK

(8.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A DOM-based cross-site scripting vulnerability in Vega can enable arbitrary JavaScript execution when untrusted Vega JSON specifications are rendered in applications that expose vega or vega.View instances (or equivalent gadgets) on the global window object.

Under these conditions, an attacker who convinces a user to open a crafted Vega specification can execute script in the context of the application's domain, compromising confidentiality and integrity despite the use of Vega's "safe mode" expression interpreter.

Affected context

The vulnerability affects web applications that embed Vega visualizations and:

  • Expose vega, vega.View, or similar function objects on the global window (for example, mimicking the Vega Editor pattern or using global debug handles), and
  • Accept Vega JSON specifications from users or other untrusted sources, rather than only from static, trusted application code.

In these environments, user-controlled Vega specs can interact with globally exposed objects in ways not fully constrained by Vega's "safe mode" expression interpreter, creating a DOM XSS risk.

Exploit preconditions

  • Attack surface: Web pages that render Vega visualizations in a browser.
  • Required access: Ability to supply or influence a Vega JSON specification (e.g., user-uploaded visualization configs, shared specs, or editable chart definitions).
  • Trigger point: A victim visits or interacts with a page that renders the malicious Vega spec; user interaction is required to fully trigger the exploit.
  • Environmental conditions:
  • The application exposes vega, vega.View, or other suitable gadget functions on window or other global variables.
  • The Vega rendering path treats the provided JSON as trusted, without additional sandboxing or strict isolation from global objects.
  • Why exploitation is possible: Despite the "safe mode" expression interpreter, the presence of powerful global objects and gadget functions enables attacker-controlled data embedded in the Vega spec to be leveraged into arbitrary script execution within the DOM.

Why this happens

This issue stems from a combination of DOM-based cross-site scripting and insecure exposure of powerful global objects.

From a CWE-79 perspective, the application effectively allows untrusted content (Vega JSON specs) to influence script-relevant behavior in the browser without robust isolation, CSP hardening, or removal of dangerous gadgets. By attaching vega, vega.View, or similar objects directly to window, the runtime provides an unintended capability surface that can be driven by attacker-controlled configuration. Even though Vega's expression interpreter operates in a "safe mode", it does not fully neutralize the risk when the surrounding environment exposes functions or objects that can be repurposed to execute arbitrary JavaScript.

Conceptually, this is an insecure pattern where:

  • Configuration is treated as data-only, but is interpreted in a context that has access to executable capabilities, and
  • Global debugging or convenience hooks inadvertently act as gadget chains for script execution.

Potential impact

  • Execution of arbitrary JavaScript in the victim's browser within the application's origin.
  • Theft or exfiltration of sensitive information such as authentication tokens, session identifiers, or API keys accessible to the page.
  • Manipulation or falsification of data presented in Vega visualizations or other parts of the UI.
  • Execution of unauthorized actions on behalf of the user (e.g., posting data, changing settings, initiating transactions).
  • Lateral movement to other components that trust the compromised origin (e.g., OAuth flows, single sign-on sessions, or shared cookies).

General mitigation guidance

Effective mitigation focuses on reducing the power of untrusted Vega specs and eliminating high-value gadgets in the global scope:

  • Avoid exposing vega, vega.View, or similar powerful objects on the global window in production; keep them scoped inside modules or closures and remove debugging hooks before deployment.
  • Treat all user-supplied Vega and Vega-Lite JSON definitions as untrusted; restrict where and how they are rendered, or gate them behind review/approval workflows.
  • Run Vega rendering within a constrained environment, such as an iframe sandbox with limited permissions, to reduce impact if script execution occurs.
  • Apply strict Content Security Policy (CSP) where feasible (e.g., disallow inline scripts and restrict script-src) to make gadget-based exploitation harder.
  • Design applications so that visualization configuration is data-only and cannot naturally reach executable APIs without explicit, narrowly scoped mediation.

These patterns help ensure that even if an attacker controls the Vega spec, they cannot easily escalate that control into arbitrary JavaScript execution.

How teams detect issues like this

Detection can combine static analysis, configuration review, and runtime observation:

  • Static analysis and code review:
  • Search for code that assigns vega, vega.View, or other framework/library objects to window or other global variables, especially in production bundles.
  • Flag patterns where untrusted Vega JSON is accepted from users (forms, APIs, query parameters) and passed directly into rendering functions.
  • Review debugging utilities and sample code to ensure development-only patterns are not compiled into production builds.
  • Automated tooling:
  • Use linters or custom static analysis rules to detect global exposure of library internals and to enforce modular, non-global patterns.
  • Integrate security scanning into CI to detect known XSS antipatterns in client-side code.
  • Runtime and policy checks:
  • Monitor CSP violation reports for blocked script execution related to visualization pages.
  • Instrument logging for unusual or malformed Vega specs, especially those containing unexpected expressions or structures.

Combining code-level checks with runtime telemetry helps identify both existing vulnerabilities and attempts at exploitation.

Sources

SourceLink
github.comgithub.com/vega/vega/security/advisories/GHSA-829q-m3qg-ph8r

Frequently asked

questions

Yes. If an application accepts Vega specs from untrusted parties and exposes suitable global gadgets, an attacker can host or send a crafted Vega spec and convince a victim to open it, leading to arbitrary JavaScript execution in the victim's browser.

It depends on how the application is designed. If only authenticated users can submit or share Vega specs, an attacker might need an account. However, if public submission or sharing is allowed, unauthenticated attackers may be able to exploit the issue as long as they can influence a spec the victim will load.

The most robust pattern is to remove all exposure of vega, vega.View, and similar objects from the global scope in production and to strictly limit the capabilities available to untrusted Vega specs. Keeping Vega internals scoped, combined with safe-by-default rendering contexts and strong CSP, significantly reduces the attack surface.

Treat visualization definitions as untrusted input, avoid exporting powerful objects to window, and design rendering flows so configs cannot directly reach executable APIs. Enforce security-oriented coding standards (e.g., no global debug handles, CSP-by-default, module-scoped libraries) and include automated checks and security review for any feature that evaluates user-controlled configuration in the browser.

Find out what's already
exploitable in your codebase.