CVE-2021-21368: msgpack5 prototype poisoning in map decoding

CVE-2021-21368 · Severity: low · CVSS 3.1 · Published 2021-03-12

msgpack5 is a JavaScript library for encoding and decoding MessagePack binary data. When processing crafted MessagePack messages, the library improperly handles the "__proto__" key, allowing an attacker to manipulate an object's prototype chain. This can cause decoded objects to behave unexpectedly or throw errors when used, potentially leading to application malfunction or serving as a stepping stone for further exploitation.

Technologies: msgpack5 (npm). Vendors: npm.

Quick answers

Is CVE-2021-21368 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2021-21368 being exploited in the wild.
How severe is CVE-2021-21368?
Low severity, with a CVSS score of 3.1, published 12 March 2021.
Which products and versions are affected?
msgpack5 (npm) SEMVER:introduced=0,fixed=3.6.1.
Is there a fix for CVE-2021-21368?
Yes. msgpack5 (npm): upgrade to 3.6.1 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2021-21368 attacked?
It is attacked over the network.
Am I affected by CVE-2021-21368?
Check whether you run msgpack5 (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • msgpack5 (npm): upgrade to 3.6.1 or later
    npm install msgpack5@3.6.1

Technical details

The vulnerability is a prototype poisoning flaw in the map decoding logic of msgpack5. When msgpack5 decodes a MessagePack map containing a "__proto__" key, it assigns the decoded value directly to the object's __proto__ property, overwriting the object's prototype chain. The attack requires network-reachable access to submit crafted MessagePack payloads and low privileges (or ability to send data to the service). An attacker can craft payloads where the "__proto__" value decodes to an object (such as a Map or Array), causing the decoded object to masquerade as that type while failing when actual type-specific methods are invoked. The issue does not affect the global prototype and is limited to individual decoded objects. Patches are available in versions 3.6.1, 4.5.1, and 5.2.1.

Affected products

  • msgpack5 msgpack5 < 3.6.1, 4.0.0 to < 4.5.1, 5.0.0 to < 5.2.1

Identifiers

  • CVE-2021-21368
  • GHSA-gmjw-49p4-pcfm

Timeline

  • 2021-03-09: disclosed
  • 2021-03-12: patched: Patches released in versions 3.6.1, 4.5.1, and 5.2.1

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.