Executive brief
Immer is a popular JavaScript library used by developers to manage application state. A security flaw in the library allows an attacker to inject malicious properties into the base objects of a JavaScript application. This could lead to application crashes, unauthorized data access, or potentially full control over the affected system.
Technical details
A prototype pollution vulnerability exists in Immer versions 7.0.0 through 9.0.5 due to a type confusion flaw in the 'applyPatches' function. The library's security check for reserved keys like '__proto__' and 'constructor' uses strict equality (===), which can be bypassed if the user-provided path keys are wrapped in an array (e.g., [['__proto__']]). An attacker who can control the path parameter of a patch operation can inject properties into the Object prototype. This can result in Denial of Service (DoS), property injection, or Remote Code Execution (RCE) depending on the application environment. The issue is fixed in version 9.0.6.
Affected products
- immerjs immer >=7.0.0 <9.0.6
Timeline
- 2021-08-12: disclosed: Vulnerability disclosed by Snyk Research Team
- 2021-09-01: advisory: NVD and Snyk published advisories
- 2021-09-02: patched: GitHub advisory published and fix confirmed in version 9.0.6