CVE-2021-29489: Highcharts Cross-Site Scripting Vulnerability

HIGH
Advisory Identifier: GHSA-8j65-4pcq-xq95
CVSS 7.6
CWE-79
Published
Advisory Summary

CVE-2021-29489 is a HIGH (CVSS 7.6) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Highcharts libraries in the npm ecosystem. The issue involves options structure open to cross-site scripting if passed unfiltered. Remediation is available by upgrading affected packages to version 9.0.0.

CVE-2021-29489 at a Glance

CVE Identifier CVE-2021-29489
GHSA Identifier GHSA-8j65-4pcq-xq95
Severity HIGH
CVSS v3.1 Base Score 7.6
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Highcharts
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.6

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

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

How to Fix CVE-2021-29489

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

highcharts fixed: 9.0.0
npm install highcharts@9.0.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 highcharts

How to Check if You Are Affected

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

npm ls highcharts

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

Note: The npm ls highcharts 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 Highcharts, 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 In Highcharts versions 8 and earlier, the chart options structure was not systematically filtered for XSS vectors. The potential impact was that content from untrusted sources could execute code in the end user's browser. Especially when using the `useHTML` flag, HTML string options would be inserted unfiltered directly into the DOM. When `useHTML` was false, malicious code could be inserted by using various character replacement tricks or malformed HTML. If your chart configuration comes from a trusted source like a static setup or pre-filtered HTML (or no markup at all in the configuration), you are not impacted. ### Patches In version 9, the whole rendering layer was refactored to use an DOMParser, an AST and tag and HTML allow-listing to make sure only safe content entered the DOM. In addition, prototype pollution was stopped. ### Workarounds Implementers who are not able to upgrade may apply [DOMPurify](https://github.com/cure53/DOMPurify) recursively [to the options structure](https://jsfiddle.net/highcharts/zd3wcm5L/) to filter out malicious markup. ### References * Details on the improved [Highcharts security](https://www.highcharts.com/docs/chart-concepts/security) * [The AST and TextBuilder refactoring](https://github.com/highcharts/highcharts/pull/14913) * [The fix for prototype pollution](https://github.com/highcharts/highcharts/pull/14884) ### For more information If you have any questions or comments about this advisory: * Visit our [support page](https://www.highcharts.com/blog/support/) * For more Email us at [security@highcharts.com](mailto:security@highcharts.com)

CVE-2021-29489 Affected Highcharts Versions

1 component(s)
Fixed Versions:
9.0.0
Product / Package Ecosystem Affected Versions Fixed Version
highcharts
npm
< 9.0.0
9.0.0

References

Frequently Asked Questions

What is CVE-2021-29489?
CVE-2021-29489 is a security vulnerability in Highcharts involving Options structure open to Cross-site Scripting if passed unfiltered under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Highcharts versions are affected?
Affected versions include releases prior to 9.0.0 across affected packages: highcharts.
What version fixes CVE-2021-29489?
Upgrading to 9.0.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is highcharts affected?
Yes, highcharts is affected in releases prior to 9.0.0. Upgrade your dependency to 9.0.0 or later.
What is the CVSS score of CVE-2021-29489?
CVE-2021-29489 has a CVSS v3.1 base score of 7.6 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:H/A:L.
What CWE is associated with CVE-2021-29489?
CVE-2021-29489 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-2021-29489?
Run the dependency tree command: 'npm ls highcharts'. 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-8j65-4pcq-xq95",
  "modified" : "2022-06-06T18:17:02Z",
  "published" : "2021-05-06T15:45:03Z",
  "aliases" : [ "CVE-2021-29489" ],
  "summary" : "Options structure open to Cross-site Scripting if passed unfiltered",
  "details" : "### Impact\nIn Highcharts versions 8 and earlier, the chart options structure was not systematically filtered for XSS vectors. The potential impact was that content from untrusted sources could execute code in the end user's browser. Especially when using the `useHTML` flag, HTML string options would be inserted unfiltered directly into the DOM. When `useHTML` was false, malicious code could be inserted by using various character replacement tricks or malformed HTML.\n\nIf your chart configuration comes from a trusted source like a static setup or pre-filtered HTML (or no markup at all in the configuration), you are not impacted.\n\n### Patches\nIn version 9, the whole rendering layer was refactored to use an DOMParser, an AST and tag and HTML allow-listing to make sure only safe content entered the DOM. In addition, prototype pollution was stopped.\n\n### Workarounds\nImplementers who are not able to upgrade may apply [DOMPurify](https://github.com/cure53/DOMPurify) recursively [to the options structure](https://jsfiddle.net/highcharts/zd3wcm5L/) to filter out malicious markup.\n\n### References\n* Details on the improved [Highcharts security](https://www.highcharts.com/docs/chart-concepts/security)\n* [The AST and TextBuilder refactoring](https://github.com/highcharts/highcharts/pull/14913)\n* [The fix for prototype pollution](https://github.com/highcharts/highcharts/pull/14884)\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Visit our [support page](https://www.highcharts.com/blog/support/)\n* For more Email us at [security@highcharts.com](mailto:security@highcharts.com)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:H/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "highcharts"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "9.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/highcharts/highcharts/security/advisories/GHSA-8j65-4pcq-xq95"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-29489"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/highcharts/highcharts"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20210622-0005"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/package/highcharts"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-05T15:37:11Z",
    "nvd_published_at" : "2021-05-05T16:15:00Z"
  }
}