CVE-2021-45691
Description
An issue was discovered in the messagepack-rs crate through 2021-01-26 for Rust. deserialize_string may read from uninitialized memory locations.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
messagepack-rs crate through 2021-01-26 has a vulnerability where `deserialize_string` reads uninitialized memory, leading to potential memory exposure.
Vulnerability
The messagepack-rs crate for Rust, versions up to and including 2021-01-26, contains a memory-safety vulnerability in the deserialize_string function (and related deserialization functions). The issue arises because these functions use unsafe { buf.set_len(size); } on a Vec created with Vec::with_capacity(size), which does not initialize the memory. The uninitialized buffer is then passed to a user-provided Read implementation via buf_reader.read_exact(...). If the Read operation fails, the function returns an error, but the uninitialized memory content may be leaked or used in further operations [2][3].
Exploitation
An attacker can exploit this vulnerability by crafting malicious data that causes read_exact to fail partially or by controlling the size parameter to expose uninitialized heap memory. The attacker does not need authentication or special privileges, but must be able to supply input to a process that uses the affected messagepack-rs crate for deserialization. The vulnerable code path is triggered when deserialize_string, deserialize_binary, or similar functions are called and the Read operation encounters an error [2][3].
Impact
Successful exploitation allows an attacker to cause the application to read from uninitialized memory locations, potentially leaking sensitive heap data. This memory exposure can lead to information disclosure, and in certain cases, may be leveraged for further attacks. The RustSec advisory classifies this as a memory-exposure vulnerability [3].
Mitigation
As of the last update of the RustSec advisory (June 2023), no patched version of messagepack-rs has been released [3]. The crate appears to be unmaintained, and users are advised to avoid using it. Workarounds include switching to alternative MessagePack implementations in Rust that are actively maintained [3][4]. The vulnerability is not listed in CISA's Known Exploited Vulnerabilities (KEV) catalog.
AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
messagepack-rscrates.io | <= 0.8.1 | — |
Affected products
2- messagepack-rs/messagepack-rsdescription
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
5- github.com/advisories/GHSA-jwfh-j623-m97hghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2021-45691ghsaADVISORY
- github.com/otake84/messagepack-rs/issues/2ghsaWEB
- raw.githubusercontent.com/rustsec/advisory-db/main/crates/messagepack-rs/RUSTSEC-2021-0092.mdghsax_refsource_MISCWEB
- rustsec.org/advisories/RUSTSEC-2021-0092.htmlghsax_refsource_MISCWEB
News mentions
0No linked articles in our index yet.