CVE-2025-27793: Vega Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-963h-3v39-3pqf
CWE-87 CWE-79
Published
Advisory Summary

CVE-2025-27793 is a MODERATE cross-site scripting vulnerability (CWE-87: Improper Neutralization of Alternate XSS Syntax) affecting Vega libraries in the npm ecosystem. The issue involves vega vulnerable to cross-site scripting via regexp.prototype[@@replace]. Remediation is available by upgrading affected packages to version 5.32.0, 5.17.0.

CVE-2025-27793 at a Glance

CVE Identifier CVE-2025-27793
GHSA Identifier GHSA-963h-3v39-3pqf
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-87: Improper Neutralization of Alternate XSS Syntax
Affected Product Vega
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2025-27793

To remediate this vulnerability, upgrade all affected Vega dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

vega fixed: 5.32.0
npm install vega@5.32.0
vega-functions fixed: 5.17.0
npm install vega-functions@5.17.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls vega

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2025-27793, inspect your project dependencies using npm:

npm ls vega

Analyze the terminal output to locate any version of Vega in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.32.0), your application is affected.

Note: The npm ls vega command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-87: Improper Neutralization of Alternate XSS Syntax, where the product does not neutralize or incorrectly neutralizes user-controlled input for alternate script syntax. In Vega, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## 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 - Use `vega` with [expression interpreter](https://vega.github.io/vega/usage/interpreter/) - Upgrade to a [newer Vega version](https://github.com/vega/vega/releases/tag/v5.32.0) (`5.32.0`) ### 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})"}]}]} ```

CVE-2025-27793 Affected Vega Versions

2 component(s)
Fixed Versions:
5.32.05.17.0
Product / Package Ecosystem Affected Versions Fixed Version
vega
npm
< 5.32.0
5.32.0
vega-functions
npm
< 5.17.0
5.17.0

References

Frequently Asked Questions

What is CVE-2025-27793?
CVE-2025-27793 is a security vulnerability in Vega involving Vega vulnerable to Cross-site Scripting via RegExp.prototype[@@replace] under CWE-87: Improper Neutralization of Alternate XSS Syntax.
Which Vega versions are affected?
Affected versions include releases prior to 5.32.0, 5.17.0 across affected packages: vega, vega-functions.
What version fixes CVE-2025-27793?
Upgrading to 5.32.0, 5.17.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is vega affected?
Yes, vega is affected in releases prior to 5.32.0. Upgrade your dependency to 5.32.0 or later.
Is vega-functions affected?
Yes, vega-functions is affected in releases prior to 5.17.0. Upgrade your dependency to 5.17.0 or later.
What CWE is associated with CVE-2025-27793?
CVE-2025-27793 is classified under CWE-87: Improper Neutralization of Alternate XSS Syntax (The product does not neutralize or incorrectly neutralizes user-controlled input for alternate script syntax.).
How can I check npm dependencies for CVE-2025-27793?
Run the dependency tree command: 'npm ls vega'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-963h-3v39-3pqf",
  "modified" : "2025-03-27T18:00:24Z",
  "published" : "2025-03-27T18:00:24Z",
  "aliases" : [ "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```",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "vega"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.32.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "vega-functions"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.17.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "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" : "WEB",
    "url" : "https://github.com/vega/vega/commit/694560c0aa576df8b6c5f0f7d202ac82233e6966"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/vega/vega"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vega/vega/releases/tag/v5.32.0"
  }, {
    "type" : "WEB",
    "url" : "https://vega.github.io/vega/usage/interpreter"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79", "CWE-87" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-03-27T18:00:24Z",
    "nvd_published_at" : "2025-03-27T14:15:54Z"
  }
}