Junglewise Threat Intelligence

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

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

Executive brief

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.

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

Timeline

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

References