CVE-2020-28477: Prototype Pollution in immer

immer Updated 02 Oct 2025

Summary

20/01/2021
Yes i
High
7.5

CVE-2020-28477: Prototype Pollution in immer. Affects immer versions >= 7.0.0, < 8.0.1. Fixed in 8.0.1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

immer is an open-source JavaScript library that allows for easy and efficient immutable state updates. It provides a simple API to create immutable copies of data structures, enabling developers to write more predictable and maintainable code. However, versions of immer prior to 8.0.1 are vulnerable to Prototype Pollution.

Vulnerability Detail

Prototype Pollution is a vulnerability that occurs when an attacker can inject properties into existing JavaScript objects. In the case of immer, an attacker can exploit this vulnerability to modify the prototype of an object, leading to unexpected behavior and potential security issues. By manipulating the prototype, an attacker can add or modify properties on all instances of the object, potentially leading to remote code execution or information disclosure.

How To Fix

Latest published version: 11.2.9 as of 23 Oct 2026

npm install immer@11.2.9

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

8.0.1

This is the first release that contains the fix.

npm install immer@8.0.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If updating to the latest version of immer is not feasible, a possible workaround is to sanitize user input before using it to modify objects. By validating and sanitizing input, developers can prevent malicious data from polluting the prototype chain. Here is an example of how to sanitize user input using the immer library:

const { produceWithPatches } = require('immer');

function sanitizeInput(input) {
  // Perform input validation and sanitization
  // ...
  return sanitizedInput;
}

let obj = {};
const sanitizedInput = sanitizeInput(userInput);
const [newObj] = produceWithPatches(obj, draft => {
  // Use the sanitized input to modify the object
  // ...
});

Conclusion

In conclusion, versions of immer prior to 8.0.1 are vulnerable to Prototype Pollution. This vulnerability can be exploited to modify the prototype of an object, leading to unexpected behavior and potential security issues. To mitigate this vulnerability, it is crucial to update immer to version 8.0.1 or later. If updating is not possible, developers should sanitize user input before using it to modify objects. For further assistance and support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for immer →

Share this vulnerability

FAQ

immer is a JavaScript library that provides an easy way to create immutable copies of data structures. It helps developers write more predictable and maintainable code by enabling efficient state updates.

Prototype Pollution is a vulnerability that allows an attacker to inject properties into existing JavaScript objects. By manipulating the prototype, an attacker can add or modify properties on all instances of the object, potentially leading to security issues.

Applications using vulnerable versions of immer are at risk of having their objects' prototypes polluted. This can result in unexpected behavior, security vulnerabilities, and potential remote code execution or information disclosure.

To fix this vulnerability, it is recommended to update immer to version 8.0.1 or later. This version contains a fix for the Prototype Pollution vulnerability. Developers can update the package by running the following command: npm install immer@8.0.1

If updating to the latest version of immer is not feasible, a possible workaround is to sanitize user input before using it to modify objects. By validating and sanitizing input, developers can prevent malicious data from polluting the prototype chain.

Related vulnerabilities

Recent vulnerabilities recorded for immer.

How To Fix

Latest published version: 11.2.9 as of 23 Oct 2026

npm install immer@11.2.9

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

8.0.1

This is the first release that contains the fix.

npm install immer@8.0.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback