Files
advisory-db/packages/oneringbuf.json
T
2026-07-09 06:41:40 +00:00

140 lines
6.3 KiB
JSON

[
{
"id": "RUSTSEC-2026-0152",
"modified": "2026-07-09T06:36:22Z",
"published": "2026-05-27T12:00:00Z",
"aliases": [
"GHSA-q95x-7g78-rccv"
],
"related": [],
"summary": "Use-after-free",
"details": "Affected versions of `oneringbuf` exposed the obsolete `IntoRef::into_ref` method through the public `IntoRef` trait. For heap-backed ring buffers, this method returned a `DroppableRef` handle.\n\n`DroppableRef` stored an owning raw pointer created from `Box::into_raw`. Its `Clone` implementation copied this raw pointer without incrementing the internal `alive_iters` counter. Internally, this clone pattern appears to rely on a fixed number of handles being created to match the initial `alive_iters` value. However, exposing `DroppableRef` through the public `IntoRef::TargetRef` associated type allows safe external code to create additional clones beyond that fixed count, breaking the lifetime protocol. `Drop` later dereferenced the pointer and could free the backing allocation with `Box::from_raw`.\n\nSafe code could call `IntoRef::into_ref` to obtain a `DroppableRef` and then clone it. Each clone pointed to the same allocation, but the internal `alive_iters` counter was not increased. As a result, one clone could free the allocation while another clone still existed. Dropping the remaining clone then accessed freed memory, causing a heap-use-after-free.\n\nThe issue was fixed in version 0.8.0 by removing the obsolete `into_ref` method.\n\n## Trigger\n\n```rust\nuse oneringbuf::{IntoRef, LocalHeapRB};\n\nfn main() {\n let rb = LocalHeapRB::<usize>::from(vec![1, 2, 3]);\n\n let r = <LocalHeapRB<usize> as IntoRef>::into_ref(rb);\n let r2 = r.clone();\n let r3 = r.clone();\n\n drop(r);\n drop(r2);\n drop(r3); // AddressSanitizer: heap-use-after-free\n}\n```",
"severity": [],
"affected": [
{
"package": {
"ecosystem": "crates.io",
"name": "oneringbuf",
"purl": "pkg:cargo/oneringbuf"
},
"ecosystem_specific": {
"affects": {
"arch": [],
"os": [],
"functions": []
},
"affected_functions": null
},
"database_specific": {
"categories": [
"memory-corruption"
],
"cvss": null,
"informational": null
},
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "0.0.0-0"
},
{
"fixed": "0.8.0"
}
]
}
],
"versions": []
}
],
"references": [
{
"type": "PACKAGE",
"url": "https://crates.io/crates/oneringbuf"
},
{
"type": "ADVISORY",
"url": "https://rustsec.org/advisories/RUSTSEC-2026-0152.html"
},
{
"type": "WEB",
"url": "https://github.com/skilvingr/rust-oneringbuf/commit/643a24b30914068416dff9021a069c12c865a316"
},
{
"type": "WEB",
"url": "https://github.com/skilvingr/rust-oneringbuf/commit/643a24b30914068416dff9021a069c12c865a316"
}
],
"database_specific": {
"license": "CC0-1.0"
}
},
{
"id": "RUSTSEC-2026-0143",
"modified": "2026-05-14T21:26:19Z",
"published": "2026-05-14T12:00:00Z",
"aliases": [],
"related": [],
"summary": "Double-free in `vmem` storage reachable from safe Rust",
"details": "When the `vmem` feature is enabled, `VmemStorage<T>::new(Box<[UnsafeSyncCell<T>]>)` (and every public constructor that funnels through it — `ConcurrentHeapRB::default(cap)`, `ConcurrentHeapRB::from(Vec<T>)`, `From<Box<[T]>>`, etc.) bit-copies the input buffer into a freshly `mmap`'d region with `ptr::copy_nonoverlapping`, then lets the source `Box<[UnsafeSyncCell<T>]>` drop normally.\n\nBecause `UnsafeSyncCell<T>` has a `Drop` impl that runs `assume_init_drop` on its inner `MaybeUninit<T>`, the source-side `T` values are dropped at the end of `new`, while bitwise duplicates (carrying the same heap pointers for `String`, `Box`, `Vec`, `Arc`, …) remain inside the mmap region. When the ring buffer is later destructed, the destructor's `drop_in_place` over the slice runs `UnsafeSyncCell::drop` a second time on every cell — a deterministic double-free of every heap-owning element. Reachable from 100% safe Rust.\n\n## Trigger\n\n```rust\nlet v: Vec<Vec<u32>> = (0..1024).map(|i| vec![i, i+1, i+2]).collect();\nlet rb: oneringbuf::SharedVmemRB<Vec<u32>> = oneringbuf::SharedVmemRB::from(v);\ndrop(rb);\n// glibc: free(): double free detected in tcache 2 -> abort\n// ASan: AddressSanitizer: attempting double-free\n```\n\nAny `T` with a non-trivial `Drop` reproduces deterministically.\n\n## Fix\n\nFixed in `0.7.1` via upstream PR [skilvingr/rust-oneringbuf#3](https://github.com/skilvingr/rust-oneringbuf/pull/3), which deallocates the source `Box<[UnsafeSyncCell<T>]>` without running per-element `Drop` after the bytes have been copied into the mmap region. Vulnerable versions (`< 0.7.1`) have been yanked from crates.io.",
"severity": [],
"affected": [
{
"package": {
"ecosystem": "crates.io",
"name": "oneringbuf",
"purl": "pkg:cargo/oneringbuf"
},
"ecosystem_specific": {
"affects": {
"arch": [],
"os": [],
"functions": [
"oneringbuf::VmemStorage::new"
]
},
"affected_functions": null
},
"database_specific": {
"categories": [
"memory-corruption"
],
"cvss": null,
"informational": "unsound"
},
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "0.0.0-0"
},
{
"fixed": "0.7.1"
}
]
}
],
"versions": []
}
],
"references": [
{
"type": "PACKAGE",
"url": "https://crates.io/crates/oneringbuf"
},
{
"type": "ADVISORY",
"url": "https://rustsec.org/advisories/RUSTSEC-2026-0143.html"
},
{
"type": "WEB",
"url": "https://github.com/skilvingr/rust-oneringbuf/pull/3"
}
],
"database_specific": {
"license": "CC0-1.0"
}
}
]