CVE-2021-26305
JSON

9.8critical

Read of uninitialized memory in cdr

Severity
9.8critical CVSS:3.1 by NVD
Exploit likelihood
1.66% (higher than 77% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
mitre
Also known as
GHSA-37jj-wp7g-7wj4RUSTSEC-2021-0012

Description

An issue was discovered in Deserializer::read_vec in the cdr crate before 0.2.4 for Rust. A user-provided Read implementation can gain access to the old contents of newly allocated heap memory, violating soundness.

Affected

Product or packageVersionsReported by
Unspecified productn/aCVE List
cdr (crates.io)before 0.2.4, from 0.0.0-0 before 0.2.4GitHub Advisory Database, RustSec Advisory Database
cdr_project cdrbefore 0.2.4NVD

All scores

GitHub9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
RustSec Advisory Database9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NVD9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NVD7.5high CVSS:2.0AV:N/AC:L/Au:N/C:P/I:P/A:P

Classification

What each source says

CVE List

An issue was discovered in Deserializer::read_vec in the cdr crate before 0.2.4 for Rust. A user-provided Read implementation can gain access to the old contents of newly allocated heap memory, violating soundness.

RustSec Advisory Database

Deserializer::read_vec() created an uninitialized buffer and passes it to a user-provided Read implementation (Deserializer.reader.read_exact()).

Passing an uninitialized buffer to an arbitrary Read implementation is currently defined as undefined behavior in Rust. Official documentation for the Read trait explains the following: "It is your responsibility to make sure that buf is initialized before calling read. Calling read with an uninitialized buf (of the kind one obtains via MaybeUninit<T>) is not safe, and can lead to undefined behavior."

The flaw was corrected in commit ce310f7 by zero-initializing the newly allocated buffer before handing it to Deserializer.reader.read_exact().

NVD (es)

Se detectó un problema en la función Deserializer::read_vec en la crate cdr versiones anteriores a 0.2.4 para Rust.&#xa0;Una implementación de Lectura proporcionada por el usuario puede conseguir acceso a los contenidos antiguos de la memoria de pila recién asignada, violando la solidez

References

Sources

SourceRecordLicence
CVE ListCVE-2021-26305 changed 2024-08-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-37jj-wp7g-7wj4 changed 2023-11-08CC-BY-4.0
RustSec Advisory DatabaseRUSTSEC-2021-0012 changed 2023-11-08CC0-1.0
NVDCVE-2021-26305 changed 2026-06-17Public domain