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 package | Versions | Reported by |
|---|---|---|
| Unspecified product | n/a | CVE List |
| cdr (crates.io) | before 0.2.4, from 0.0.0-0 before 0.2.4 | GitHub Advisory Database, RustSec Advisory Database |
| cdr_project cdr | before 0.2.4 | NVD |
All scores
| GitHub | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| RustSec Advisory Database | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 7.5high CVSS:2.0 | AV: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. 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
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-26305 changed 2024-08-03 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-37jj-wp7g-7wj4 changed 2023-11-08 | CC-BY-4.0 |
| RustSec Advisory Database | RUSTSEC-2021-0012 changed 2023-11-08 | CC0-1.0 |
| NVD | CVE-2021-26305 changed 2026-06-17 | Public domain |