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 package | Versions | Reported by |
|---|---|---|
| Unspecified product | n/a | CVE List |
| nano_arena (crates.io) | before 0.5.2, from 0.0.0-0 before 0.5.2 | GitHub Advisory Database, RustSec Advisory Database |
| nano_arena_project nano_arena | before 0.5.2 | 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 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. 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. Esto puede tener como resultado una escritura fuera de límites o un uso de la memoria previamente liberada
References
| https://rustsec.org/advisories/RUSTSEC-2021-0031.html | advisory, exploit, patch, third-party-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2021-28032 | advisory | |
| https://github.com/bennetthardwick/nano-arena/issues/1 | report, web | |
| https://github.com/bennetthardwick/nano-arena/commit/6b83f9d0708337a9f8b709c1624a8587021ceba2 | web | |
| https://github.com/bennetthardwick/nano-arena | package | |
| https://crates.io/crates/nano_arena | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-28032 changed 2024-08-03 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-wp34-mqw5-jj85 changed 2023-11-08 | CC-BY-4.0 |
| RustSec Advisory Database | RUSTSEC-2021-0031 changed 2023-11-08 | CC0-1.0 |
| NVD | CVE-2021-28032 changed 2026-06-17 | Public domain |