CVE-2023-26486: Vega functions Vega Expression Language `scale` Expression Vulnerability

MODERATE
Advisory Identifier: GHSA-4vq7-882g-wcg4
CVSS 6.1
CWE-79
Published
Advisory Summary

CVE-2023-26486 is a MODERATE (CVSS 6.1) vega expression language `scale` expression vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Vega functions libraries in the npm ecosystem. The issue involves vega expression language `scale` expression function cross site scripting. Remediation is available by upgrading affected packages to version 5.13.1, 5.23.0.

CVE-2023-26486 at a Glance

CVE Identifier CVE-2023-26486
GHSA Identifier GHSA-4vq7-882g-wcg4
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Vega functions
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2023-26486

To remediate this vulnerability, upgrade all affected Vega functions 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-functions fixed: 5.13.1
npm install vega-functions@5.13.1
vega fixed: 5.23.0
npm install vega@5.23.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-functions

How to Check if You Are Affected

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

npm ls vega-functions

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

Note: The npm ls vega-functions 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-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Vega functions, 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

### Summary The Vega `scale` expression function has the ability to call arbitrary functions with a single controlled argument. This can be exploited to escape the Vega expression sandbox in order to execute arbitrary JavaScript. ### Details The [scale](https://github.dev/vega/vega/blob/72b9b3bbf912212e7879b6acaccc84aff969ef1c/packages/vega-functions/src/functions/scale.js#L36-L37) expression function passes a user supplied argument `group` to [getScale](https://github.dev/vega/vega/blob/72b9b3bbf912212e7879b6acaccc84aff969ef1c/packages/vega-functions/src/scales.js#L6), which is then used as if it were an internal context. The `context.scales[name].value` is accessed from `group` and called as a function back in `scale`. ### PoC The following Vega definition can be used to demonstrate this issue executing the JavaScript code `alert(1);` ```json { "$schema": "https://vega.github.io/schema/vega/v5.json", "data": [ { "name": "XSS PoC", "values": [1], "transform": [ { "type": "formula", "as": "amount", "expr": "scale('func', null, {context: {scales: {func: {value: scale('func', 'eval(atob(\"YWxlcnQoMSk7\"))', {context: {scales: {func: {value: [].constructor.constructor}}}})}}}})" } ] } ] } ``` This can be viewed in the Vega online IDE at https://vega.github.io/editor/#/url/vega/N4IgJAzgxgFgpgWwIYgFwhgF0wBwqgegIDc4BzJAOjIEtMYBXAI0poHsDp5kTykSArJQBWENgDsQAGhAATJJhSoA2qHFIEcNCAAaAZT0ACAApsAwtJDEkAGwZwIaZQEYAujMwAnJOIgAzNk8EJ1BMAE8cLXQAoIYbFBkkR3QNNgZxTEs4AA8cT21oWzgACgByP3SoUqlDcTibGsNgKAlMHMxUJsKbB07gCvEoPus7OE7ukvLK6sNSuBHihTYmYoAdEABNAHVsmyhxAEU2AFk9AGsAdnWASmuZ5tb2von8JoGhppH7TuVXShbfF4GFBMIF-hIIECQYEAL5wmHXeEIkAw1yomFAA

CVE-2023-26486 Affected Vega functions Versions

2 component(s)
Fixed Versions:
5.13.15.23.0
Product / Package Ecosystem Affected Versions Fixed Version
vega-functions
npm
< 5.13.1
5.13.1
vega
npm
< 5.23.0
5.23.0

References

Frequently Asked Questions

What is CVE-2023-26486?
CVE-2023-26486 is a security vulnerability in Vega functions involving Vega Expression Language `scale` expression function Cross Site Scripting under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Vega functions versions are affected?
Affected versions include releases prior to 5.13.1, 5.23.0 across affected packages: vega-functions, vega.
What version fixes CVE-2023-26486?
Upgrading to 5.13.1, 5.23.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is vega-functions affected?
Yes, vega-functions is affected in releases prior to 5.13.1. Upgrade your dependency to 5.13.1 or later.
Is vega affected?
Yes, vega is affected in releases prior to 5.23.0. Upgrade your dependency to 5.23.0 or later.
What is the CVSS score of CVE-2023-26486?
CVE-2023-26486 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2023-26486?
CVE-2023-26486 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check npm dependencies for CVE-2023-26486?
Run the dependency tree command: 'npm ls vega-functions'. 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-4vq7-882g-wcg4",
  "modified" : "2023-03-09T21:58:49Z",
  "published" : "2023-03-02T23:11:05Z",
  "aliases" : [ "CVE-2023-26486" ],
  "summary" : "Vega Expression Language `scale` expression function Cross Site Scripting",
  "details" : "### Summary\nThe Vega `scale` expression function has the ability to call arbitrary functions with a single controlled argument. This can be exploited to escape the Vega expression sandbox in order to execute arbitrary JavaScript.\n\n### Details\n\nThe [scale](https://github.dev/vega/vega/blob/72b9b3bbf912212e7879b6acaccc84aff969ef1c/packages/vega-functions/src/functions/scale.js#L36-L37) expression function passes a user supplied argument `group` to [getScale](https://github.dev/vega/vega/blob/72b9b3bbf912212e7879b6acaccc84aff969ef1c/packages/vega-functions/src/scales.js#L6), which is then used as if it were an internal context. The `context.scales[name].value` is accessed from `group` and called as a function back in `scale`.\n\n### PoC\nThe following Vega definition can be used to demonstrate this issue executing the JavaScript code `alert(1);`\n```json\n{\n  \"$schema\": \"https://vega.github.io/schema/vega/v5.json\",\n  \"data\": [\n    {\n      \"name\": \"XSS PoC\",\n      \"values\": [1],\n      \"transform\": [\n        {\n          \"type\": \"formula\",\n          \"as\": \"amount\",\n          \"expr\": \"scale('func', null,  {context: {scales: {func: {value: scale('func', 'eval(atob(\\\"YWxlcnQoMSk7\\\"))', {context: {scales: {func: {value: [].constructor.constructor}}}})}}}})\"\n        }\n      ]\n    }\n  ]\n}\n```\n\nThis can be viewed in the Vega online IDE at https://vega.github.io/editor/#/url/vega/N4IgJAzgxgFgpgWwIYgFwhgF0wBwqgegIDc4BzJAOjIEtMYBXAI0poHsDp5kTykSArJQBWENgDsQAGhAATJJhSoA2qHFIEcNCAAaAZT0ACAApsAwtJDEkAGwZwIaZQEYAujMwAnJOIgAzNk8EJ1BMAE8cLXQAoIYbFBkkR3QNNgZxTEs4AA8cT21oWzgACgByP3SoUqlDcTibGsNgKAlMHMxUJsKbB07gCvEoPus7OE7ukvLK6sNSuBHihTYmYoAdEABNAHVsmyhxAEU2AFk9AGsAdnWASmuZ5tb2von8JoGhppH7TuVXShbfF4GFBMIF-hIIECQYEAL5wmHXeEIkAw1yomFAA\n\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "vega-functions"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.13.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "vega"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.23.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/vega/vega/security/advisories/GHSA-4vq7-882g-wcg4"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-26486"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/vega/vega"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vega/vega/releases/tag/v5.23.0"
  }, {
    "type" : "WEB",
    "url" : "https://github.dev/vega/vega/blob/72b9b3bbf912212e7879b6acaccc84aff969ef1c/packages/vega-functions/src/functions/scale.js#L36-L37"
  }, {
    "type" : "WEB",
    "url" : "https://github.dev/vega/vega/blob/72b9b3bbf912212e7879b6acaccc84aff969ef1c/packages/vega-functions/src/scales.js#L6"
  }, {
    "type" : "WEB",
    "url" : "https://vega.github.io/editor/#/url/vega/N4IgJAzgxgFgpgWwIYgFwhgF0wBwqgegIDc4BzJAOjIEtMYBXAI0poHsDp5kTykSArJQBWENgDsQAGhAATJJhSoA2qHFIEcNCAAaAZT0ACAApsAwtJDEkAGwZwIaZQEYAujMwAnJOIgAzNk8EJ1BMAE8cLXQAoIYbFBkkR3QNNgZxTEs4AA8cT21oWzgACgByP3SoUqlDcTibGsNgKAlMHMxUJsKbB07gCvEoPus7OE7ukvLK6sNSuBHihTYmYoAdEABNAHVsmyhxAEU2AFk9AGsAdnWASmuZ5tb2von8JoGhppH7TuVXShbfF4GFBMIF-hIIECQYEAL5wmHXeEIkAw1yomFAA"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-03-02T23:11:05Z",
    "nvd_published_at" : "2023-03-04T00:15:00Z"
  }
}