VDB
Sign up
MEDIUM

GHSA-mp7w-mhcv-673j

Vega allows Cross-site Scripting via the vlSelectionTuples function

Quick fix

GHSA-mp7w-mhcv-673j — vega: upgrade to the fixed version with the command below.

npm install vega@5.26.0

Details

### Summary The `vlSelectionTuples` function can be used to call JavaScript functions, leading to XSS.

### Details [`vlSelectionTuples`](https://github.com/vega/vega/blob/b45cf431cd6c0d0c0e1567f087f9b3b55bc236fa/packages/vega-selections/src/selectionTuples.js#L14) calls multiple functions that can be controlled by an attacker, including one call with an attacker-controlled argument.

Example call: `vlSelectionTuples([{datum:<argument>}], {fields:[{getter:<function>}]})`

This can be used to call `Function()` with arbitrary JavaScript and the resulting function can be called with `vlSelectionTuples` or using a type coercion to call `toString` or `valueOf`.

### PoC ``` {"$schema":"https://vega.github.io/schema/vega/v5.json","signals":[{"name":"a","init":"+{valueOf:vlSelectionTuples([{datum:'alert(1)'}],{fields:[{getter:[].at.constructor}]})[0].values[0]}"}]} ```

Are you affected?

Enter the version of the package you're using.

Affected packages

npm/vega
Introduced in: 0Fixed in: 5.26.0
Fixnpm install vega@5.26.0
npm/vega-selections
Introduced in: 0Fixed in: 5.4.2
Fixnpm install vega-selections@5.4.2

References