# CVE-2021-21368: Prototype poisoning

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 6.7
- **CVSS:** 6.7 (v3.1, CNA) `CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:H/A:H`
- **CVSS metrics:** Attack vector: Network; Attack complexity: High; Privileges required: Low; User interaction: Required; Scope: Unchanged; Confidentiality impact: Low; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, login needed
- **EPSS:** 1.65% (percentile 77, 2026-11-26)
- **CWE:** CWE-915
- **Aliases:** GHSA-gmjw-49p4-pcfm
- **Published:** 2021-03-12T17:00:19.000Z
- **Modified:** 2026-09-10T03:49:01.975Z

## Who should check

- Projects that depend on npm package msgpack5 (\< 3.6.1)
- Anyone running mcollina msgpack5 \< 3.6.1; \>= 4.0.0, \< 4.5.1; \>= 5.0.0, \< 5.2.1

## 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.

## Affected and fixed versions

- npm `msgpack5`: affected \< 3.6.1; fixed 3.6.1, 4.5.1, 5.2.1 (osv)
- mcollina msgpack5: \< 3.6.1; \>= 4.0.0, \< 4.5.1; \>= 5.0.0, \< 5.2.1 (cvelist)

## Mitigation

- Upgrade msgpack5 to one of 3.6.1, 4.5.1, 5.2.1 (or later in the same release line).

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2021-21368. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2021-21368.md
Affected: msgpack5 < 3.6.1
Fixed in: 3.6.1, 4.5.1, 5.2.1

Steps:
1. Search this machine and project for msgpack5 (npm), mcollina msgpack5: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2021-21368 being exploited?

There is no confirmed exploitation: CVE-2021-21368 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 1.65% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2021-21368?

Medium: CVSS 6.7 (v3.1, scored by CNA). Remote, login needed. A user has to take an action, such as opening a link, for the attack to work. The attack needs conditions outside the attacker's control, which makes it harder.

### Which versions are affected by CVE-2021-21368?

msgpack5 \< 3.6.1.

### Is there a fix for CVE-2021-21368?

Yes. Fixed in 3.6.1, 4.5.1, 5.2.1. Upgrade msgpack5 to one of 3.6.1, 4.5.1, 5.2.1 (or later in the same release line).

### How do I check if I'm affected by CVE-2021-21368?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/mcollina/msgpack5/security/advisories/GHSA-gmjw-49p4-pcfm>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2021-21368>
- patch: <https://github.com/mcollina/msgpack5/commit/d4e6cb956ae51c8bb2828e71c7c1107c340cf1e8>
- other: <https://www.npmjs.com/package/msgpack5>
- other: <https://github.com/mcollina/msgpack5/releases/tag/v3.6.1>
- other: <https://github.com/mcollina/msgpack5/releases/tag/v4.5.1>
- other: <https://github.com/mcollina/msgpack5/releases/tag/v5.2.1>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2021-21368>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-gmjw-49p4-pcfm> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2021-21368> · JSON: <https://flawdb.com/api/v1/entries/CVE-2021-21368>
