CVE-2021-21368
Prototype poisoning
Check your servers for CVE-2021-21368
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2021-21368 affects msgpack5, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
msgpack5 is a msgpack v5 implementation for node.js and the browser. In msgpack5 before versions 3.6.1, 4.5.1, and 5.2.1 there is a "Prototype Poisoning" vulnerability. When msgpack5 decodes a map containing a key "__proto__", it assigns the decoded value to __proto__. Object.prototype.__proto__ is an accessor property for the receiver's prototype. If the value corresponding to the key __proto__ decodes to an object or null, msgpack5 sets the decoded object's prototype to that value. An attacker who can submit crafted MessagePack data to a service can use this to produce values that appear to be of other types; may have unexpected prototype properties and methods (for example length, numeric properties, and push et al if __proto__'s value decodes to an Array); and/or may throw unexpected exceptions when used (for example if the __proto__ value decodes to a Map or Date). Other unexpected behavior might be produced for other types. There is no effect on the global prototype. This "prototype poisoning" is sort of a very limited inversion of a prototype pollution attack. Only the decoded value's prototype is affected, and it can only be set to msgpack5 values (though if the victim makes use of custom codecs, anything could be a msgpack5 value). We have not found a way to escalate this to true prototype pollution (absent other bugs in the consumer's code). This has been fixed in msgpack5 version 3.6.1, 4.5.1, and 5.2.1. See the referenced GitHub Security Advisory for an example and more details.
Severity (CVSS)
CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:H/A:H
- Attack vector
- network: an attacker can reach the vulnerable part over the network, often from the internet
- Attack complexity
- high: an attack depends on conditions outside the control of the attacker, such as a race
- Privileges required
- low: the attacker needs an ordinary user account
- User interaction
- required: a user has to do something, such as open a link or a file
- Scope
- unchanged: the damage stays inside the vulnerable component
- Impact
- confidentiality low, integrity high, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 1.65%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 77.2% of all scored CVEs. Scores of 1 Dec 2026.
Weakness
- CWE-915 Improperly Controlled Modification of Dynamically-Determined Object Attributes
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| msgpack5 |
affected < 3.6.1 affected >= 4.0.0, < 4.5.1 affected >= 5.0.0, < 5.2.1
|
Is my server affected?
Find the installed version of msgpack5 and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.
Debian, Ubuntu
dpkg -l | grep -i msgpack5
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2021-21368 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2021-21368RHEL, Rocky, Alma, Fedora
rpm -q msgpack5
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2021-21368Alpine
apk list --installed | grep -i msgpack5With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2021-21368
trivy image --scanners vuln IMAGE | grep CVE-2021-21368
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Advisories
Other references
- https://www.npmjs.com/package/msgpack5 npmjs.com
- https://github.com/mcollina/msgpack5/releases/tag/v3.6.1 github.com
- https://github.com/mcollina/msgpack5/releases/tag/v4.5.1 github.com
- https://github.com/mcollina/msgpack5/releases/tag/v5.2.1 github.com
- https://github.com/mcollina/msgpack5/commit/d4e6cb956ae51c8bb2828e71c7c1107c340cf1e8 github.com
Source: the record CVE-2021-21368 of the CVE List (CVE Program), CVE Terms of Use; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse