Rust advisories / nano_arena
Vulnerability CriticalRUSTSEC-2021-0031 · nano_arena
RUSTSEC-2021-0031: split_at allows obtaining multiple mutable references to the same data
Short answerA security vulnerability in the nano_arena crate: split_at allows obtaining multiple mutable references to the same data. Critical severity (CVSS 9.8). Fixed in 0.5.2: update to a fixed version.
| Crate | nano_arena |
|---|---|
| Type | Vulnerability (memory-corruption) |
| Affected versions | Before 0.5.2. |
| Fixed in | 0.5.2 |
| Severity | Critical, CVSS 9.8 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| Published | 2021-01-31 |
| Last changed | 2023-11-08 |
| Also known as | CVE-2021-28032, GHSA-wp34-mqw5-jj85 |
| Affected functions | nano_arena::Arena::split_at, nano_arena::ArenaSplit::split_at |
What to do
- See which version you have:
cargo tree -i nano_arena(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p nano_arena. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for examplenano_arena = "0.5.2") or update the dependency that pulls it in. - Check again with
cargo audit, or paste your Cargo.lock into our Cargo.toml checker.
Details from the advisory
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.
References
- Package: crates.io/crates/nano_arena
- Advisory: rustsec.org/advisories/RUSTSEC-2021-0031.html
- Report: github.com/bennetthardwick/nano-arena/issues/1
From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.
Up next
Are you affected?Check your whole dependency treePaste Cargo.lock: every advisory, for your exact versions.Read it next →Also worth your time
Did this answer your question?