CVE-2021-21368: Prototype Poisoning in msgpack5

msgpack5 Updated 02 Oct 2025

Summary

12/03/2021
Yes i
Moderate
6.7

CVE-2021-21368: Prototype poisoning. Affects msgpack5 across 3 version ranges.

< 3.6.1 >= 4.0.0, < 4.5.1 >= 5.0.0, < 5.2.1

Fixed in 3.6.1, 4.5.1 or 5.2.1, depending on the release line you run. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

msgpack5 is an npm package that provides a MessagePack implementation for JavaScript. MessagePack is a binary serialization format that is more compact and faster to encode/decode than JSON. msgpack5 allows users to encode and decode data using the MessagePack format. However, a vulnerability has been discovered in msgpack5 that allows for prototype poisoning.

Vulnerability Detail

The vulnerability, known as prototype poisoning, occurs when msgpack5 decodes a map containing a key named "proto". The decoded value is assigned to the __proto__ property, which is an accessor property for the receiver's prototype. If the decoded value is an object or null, msgpack5 sets the decoded object's prototype to that value. This can lead to unexpected behavior, such as values appearing to be of other types, unexpected prototype properties and methods, and potential exceptions when used. However, it is important to note that this vulnerability does not affect the global prototype.

How To Fix

Latest published version: 6.1.0 as of 22 Oct 2026

npm install msgpack5@6.1.0

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 3.6.1 3.6.1
    npm install msgpack5@3.6.1
  • >= 4.0.0, < 4.5.1 4.5.1
    npm install msgpack5@4.5.1
  • >= 5.0.0, < 5.2.1 5.2.1
    npm install msgpack5@5.2.1

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

As a workaround, users should always validate incoming data after parsing before performing any processing. This can help mitigate the risk of prototype poisoning attacks.

Conclusion

The prototype poisoning vulnerability in msgpack5 can lead to unexpected behavior and potential security risks. It is important for users to update to the patched versions of msgpack5 and validate incoming data to mitigate the risk. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for msgpack5 →

Share this vulnerability

FAQ

Prototype poisoning is a vulnerability that occurs when an attacker manipulates the prototype of an object to achieve unexpected behavior or gain unauthorized access.

The consequences of prototype poisoning in msgpack5 include values appearing to be of other types, unexpected prototype properties and methods, and potential exceptions when used.

Versions 0.0.0 to 3.6.0, 4.0.0 to 4.5.0, and 5.0.0 to 5.2.0 of msgpack5 are affected by this vulnerability.

You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply provide your package-lock.json file and the playground will analyze it for vulnerabilities.

No, there is currently no known way to escalate this vulnerability to true prototype pollution. The impact is limited to the decoded value's prototype and cannot affect the global prototype.

Related vulnerabilities

Recent vulnerabilities recorded for msgpack5.

How To Fix

Latest published version: 6.1.0 as of 22 Oct 2026

npm install msgpack5@6.1.0

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 3.6.1 3.6.1
    npm install msgpack5@3.6.1
  • >= 4.0.0, < 4.5.1 4.5.1
    npm install msgpack5@4.5.1
  • >= 5.0.0, < 5.2.1 5.2.1
    npm install msgpack5@5.2.1

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback