CVE-2021-28032
JSON

9.8critical

Use after free in nano_arena

Severity
9.8critical CVSS:3.1 by NVD
Exploit likelihood
1.55% (higher than 75% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
mitre
Also known as
GHSA-wp34-mqw5-jj85RUSTSEC-2021-0031

Description

An issue was discovered in the nano_arena crate before 0.5.2 for Rust. There is an aliasing violation in split_at because two mutable references can exist for the same element, if Borrow<Idx> behaves in certain ways. This can have a resultant out-of-bounds write or use-after-free.

Affected

Product or packageVersionsReported by
Unspecified productn/aCVE List
nano_arena (crates.io)before 0.5.2, from 0.0.0-0 before 0.5.2GitHub Advisory Database, RustSec Advisory Database
nano_arena_project nano_arenabefore 0.5.2NVD

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 the nano_arena crate before 0.5.2 for Rust. There is an aliasing violation in split_at because two mutable references can exist for the same element, if Borrow<Idx> behaves in certain ways. This can have a resultant out-of-bounds write or use-after-free.

GitHub Advisory Database

Affected versions of this crate assumed that Borrow<Idx> was guaranteed to return the same value on .borrow(). The borrowed index value was used to retrieve a mutable reference to a value.

If the Borrow<Idx> implementation returned a different index, the split arena would allow retrieving the index as a mutable reference creating two mutable references to the same element. This violates Rust's aliasing rules and allows for memory safety issues such as writing out of bounds and use-after-frees.

The flaw was corrected in commit 6b83f9d by storing the .borrow() value in a temporary variable.

RustSec Advisory Database

Affected versions of this crate assumed that Borrow<Idx> was guaranteed to return the same value on .borrow(). The borrowed index value was used to retrieve a mutable reference to a value.

If the Borrow<Idx> implementation returned a different index, the split arena would allow retrieving the index as a mutable reference creating two mutable references to the same element. This violates Rust's aliasing rules and allows for memory safety issues such as writing out of bounds and use-after-frees.

The flaw was corrected in commit 6b83f9d by storing the .borrow() value in a temporary variable.

NVD (es)

Se detectó un problema en la crate nano_arena versiones anteriores a 0.5.2 para Rust.&#xa0;Se presenta una violación de alias en split_at porque pueden presentar dos referencias mutables para el mismo elemento, si Borrow(Idx) se comporta de determinadas maneras.&#xa0;Esto puede tener como resultado una escritura fuera de límites o un uso de la memoria previamente liberada

References

Sources

SourceRecordLicence
CVE ListCVE-2021-28032 changed 2024-08-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-wp34-mqw5-jj85 changed 2023-11-08CC-BY-4.0
RustSec Advisory DatabaseRUSTSEC-2021-0031 changed 2023-11-08CC0-1.0
NVDCVE-2021-28032 changed 2026-06-17Public domain