Executive brief
Vega is a popular visualization grammar library used to create interactive data visualizations in web applications. The lassoAppend function, which handles selection interactions on visualizations, fails to validate input types, allowing attackers to inject arbitrary JavaScript code that executes in the context of the page viewing the visualization. This could allow stealing sensitive data, session tokens, or performing unauthorized actions on behalf of users.
Technical details
The vulnerability is a cross-site scripting (XSS) flaw in Vega's lassoAppend function (CWE-79). The function accepts three arguments but does not validate that the first argument is actually an array; it merely calls the push method on whatever object is passed in. An attacker can pass any object with a push property set to any function accessible via event.view (such as setImmediate, console.log, or alert), which is then invoked with attacker-controlled arguments. The attack is triggered via a malicious Vega specification that uses mouse events to invoke lassoAppend with a crafted first argument. No authentication is required; the vulnerability is exploitable if a user opens a page or embeds a visualization containing the malicious Vega JSON. Patches are available in vega v5.23.0 and vega-functions v5.13.1.
Affected products
- Vega Vega before 5.23.0
- Vega vega-functions before 5.13.1
Timeline
- 2023-03-02: disclosed: Advisory published
- 2023-03-02: patched: Vega v5.23.0 and vega-functions v5.13.1 released