Vulnerabilities in pkg:npm/chart.js
PACKAGECVE-2020-7746 is a HIGH (CVSS 7.5) prototype pollution vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting Chart.js libraries in the npm ecosystem. The issue involves prototype pollution in chart.js. Remediation is available by upgrading affected packages to version 2.9.4.
pkg:npm/chart.js
Vulnerability advisories affecting package pkg:npm/chart.js. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-h68q-55jf-x68w | CVE-2020-7746 | HIGH | Prototype pollution in chart.js |
CVE-2020-7746 at a Glance
Security Impact
CVSS: 7.5
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:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2020-7746
To remediate this vulnerability, upgrade all affected Chart.js dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install chart.js@2.9.4
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls chart.js
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2020-7746, inspect your project dependencies using npm:
npm ls chart.js
Analyze the terminal output to locate any version of Chart.js in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.9.4), your application is affected.
Note: The npm ls chart.js 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-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'), where the product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype. In Chart.js, 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
CVE-2020-7746 Affected Chart.js Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
chart.js
|
npm |
< 2.9.4
|
2.9.4
|
References
Frequently Asked Questions
What is CVE-2020-7746?
Which Chart.js versions are affected?
What version fixes CVE-2020-7746?
Is chart.js affected?
What is the CVSS score of CVE-2020-7746?
What CWE is associated with CVE-2020-7746?
How can I check npm dependencies for CVE-2020-7746?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-h68q-55jf-x68w",
"modified" : "2021-04-20T17:46:27Z",
"published" : "2021-05-10T18:47:53Z",
"aliases" : [ "CVE-2020-7746" ],
"summary" : "Prototype pollution in chart.js",
"details" : "This affects the package chart.js before 2.9.4. The options parameter is not properly sanitized when it is processed. When the options are processed, the existing options (or the defaults options) are deeply merged with provided options. However, during this operation, the keys of the object being set are not checked, leading to a prototype pollution.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "chart.js"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.9.4"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-7746"
}, {
"type" : "WEB",
"url" : "https://github.com/chartjs/Chart.js/pull/7920"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSBOWER-1019375"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSBOWERGITHUBCHARTJS-1019376"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-1019374"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JS-CHARTJS-1018716"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1321", "CWE-915" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-04-20T17:46:27Z",
"nvd_published_at" : "2020-10-29T08:15:00Z"
}
}