Vulnerabilities in pkg:npm/immer
PACKAGECVE-2020-28477 is a HIGH (CVSS 7.5) prototype pollution vulnerability (CWE-471: Modification of Assumed-Immutable Data (MAID)) affecting Immer libraries in the npm ecosystem. The issue involves prototype pollution in immer. Remediation is available by upgrading affected packages to version 8.0.1.
pkg:npm/immer
Vulnerability advisories affecting package pkg:npm/immer. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-9qmh-276g-x5pj | CVE-2020-28477 | HIGH | Prototype Pollution in immer |
| GHSA-33f9-j839-rf8h | CVE-2021-23436 | CRITICAL | Prototype Pollution in immer |
| GHSA-c36v-fmgq-m8hx | CVE-2021-3757 | HIGH | Prototype Pollution in immer |
CVE-2020-28477 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-28477
To remediate this vulnerability, upgrade all affected Immer 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 immer@8.0.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls immer
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2020-28477, inspect your project dependencies using npm:
npm ls immer
Analyze the terminal output to locate any version of Immer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 8.0.1), your application is affected.
Note: The npm ls immer 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-471: Modification of Assumed-Immutable Data (MAID), where the product does not properly protect an assumed-immutable element from being modified by an attacker. In Immer, 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-28477 Affected Immer Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
immer
|
npm |
≥ 7.0.0
< 8.0.1
|
8.0.1
|
References
Frequently Asked Questions
What is CVE-2020-28477?
Which Immer versions are affected?
What version fixes CVE-2020-28477?
Is immer affected?
What is the CVSS score of CVE-2020-28477?
What CWE is associated with CVE-2020-28477?
How can I check npm dependencies for CVE-2020-28477?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-9qmh-276g-x5pj",
"modified" : "2024-04-25T22:17:51Z",
"published" : "2021-01-20T21:27:56Z",
"aliases" : [ "CVE-2020-28477" ],
"summary" : "Prototype Pollution in immer",
"details" : "## Overview\n\nAffected versions of immer are vulnerable to Prototype Pollution.\n\n## Proof of exploit\n\n```js\nconst {applyPatches, enablePatches} = require(\"immer\");\nenablePatches();\nlet obj = {};\nconsole.log(\"Before : \" + obj.polluted);\napplyPatches({}, [ { op: 'add', path: [ \"__proto__\", \"polluted\" ], value: \"yes\" } ]);\n// applyPatches({}, [ { op: 'replace', path: [ \"__proto__\", \"polluted\" ], value: \"yes\" } ]);\nconsole.log(\"After : \" + obj.polluted);\n```\n\n## Remediation\n\nVersion 8.0.1 contains a [fix](https://github.com/immerjs/immer/commit/da2bd4fa0edc9335543089fe7d290d6a346c40c5) for this vulnerability, updating is recommended.",
"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" : "immer"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "7.0.0"
}, {
"fixed" : "8.0.1"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-28477"
}, {
"type" : "WEB",
"url" : "https://github.com/immerjs/immer/issues/738"
}, {
"type" : "WEB",
"url" : "https://github.com/immerjs/immer/commit/da2bd4fa0edc9335543089fe7d290d6a346c40c5"
}, {
"type" : "WEB",
"url" : "https://github.com/immerjs/immer/blob/master/src/plugins/patches.ts%23L213"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-1061986"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JS-IMMER-1019369"
}, {
"type" : "WEB",
"url" : "https://www.npmjs.com/package/immer"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-471" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-01-20T19:37:58Z",
"nvd_published_at" : "2021-01-19T11:15:00Z"
}
}