{"id":"CVE-2025-27793","aliases":["CVE-2025-27793","GHSA-963h-3v39-3pqf"],"related":[],"kind":"vulnerability","state":"published","title":"Vega vulnerable to Cross-site Scripting via RegExp.prototype[@@replace]","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"## Impact\n\nUsers running Vega/Vega-lite JSON definitions could run unexpected JavaScript code when drawing graphs, unless the library is used with the `vega-interpreter`.\n\n## Workarounds\n\n- Use `vega` with [expression interpreter](https://vega.github.io/vega/usage/interpreter/)\n- Upgrade to a [newer Vega version](https://github.com/vega/vega/releases/tag/v5.32.0) (`5.32.0`)\n\n### POC Summary\n\nCalling `replace` with a `RegExp`-like pattern calls `RegExp.prototype[@@replace]`, which can then call an attacker-controlled `exec` function.\n\n### POC Details\n\nConsider the function call `replace('foo', {__proto__: /h/.constructor.prototype, global: false})`. Since `pattern` has `RegExp.prototype[@@replace]`, `pattern.exec('foo')` winds up being called.\n\nThe resulting malicious call looks like this:\n```\nreplace(<string argument>, {__proto__: /h/.constructor.prototype, exec: <function>, global: false})\n```\n\nSince functions cannot be returned from this, an attacker that wishes to escalate to XSS must abuse `event.view` to gain access to `eval`.\n\n### Reproduction steps\n\n```\n{\"$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})\"}]}]}\n```","format":"markdown","source":"ghsa"},{"lang":"es","text":"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.","source":"nvd"}],"published":"2025-03-27T14:07:52.264Z","modified":"2026-06-17T09:04:14.073Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","score":5.3,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","score":5.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","rating":"MEDIUM"}],"cwes":["CWE-79","CWE-87"],"affected":[{"ranges":[{"version":"< 5.32.0","status":"affected"}],"vendor":"vega","product":"vega","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"5.32.0"}],"ecosystem":"npm","package":"vega","purl":"pkg:npm/vega","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"5.17.0"}],"ecosystem":"npm","package":"vega-functions","purl":"pkg:npm/vega-functions","source":"ghsa"}],"references":[{"url":"https://github.com/vega/vega/security/advisories/GHSA-963h-3v39-3pqf","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/vega/vega/commit/694560c0aa576df8b6c5f0f7d202ac82233e6966","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/vega/vega/releases/tag/v5.32.0","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://vega.github.io/vega/usage/interpreter","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-27793","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/vega/vega","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2025-03-27T15:17:13.409Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-27793","url":"https://www.cve.org/CVERecord?id=CVE-2025-27793","licence":"CVE Terms of Use","modified":"2025-03-27T15:17:18.354Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-963h-3v39-3pqf","url":"https://github.com/advisories/GHSA-963h-3v39-3pqf","licence":"CC-BY-4.0","modified":"2025-03-27T18:08:39.051Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-27793","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-27793","licence":"Public domain","modified":"2026-06-17T09:04:14.073Z"}],"updatedAt":"2026-11-25T22:58:55.602Z","epss":{"score":0.00517,"percentile":0.4545,"date":"2026-12-01T12:00:22.000Z"}}